Skip to content

Commit

Permalink
Format shortcut_guide according to .clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyoyuppe authored and yuyoyuppe committed Dec 6, 2019
1 parent 946e74a commit f22a30c
Show file tree
Hide file tree
Showing 10 changed files with 1,392 additions and 1,168 deletions.
46 changes: 26 additions & 20 deletions src/modules/shortcut_guide/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,32 @@
#include "overlay_window.h"
#include "trace.h"

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
Trace::RegisterProvider();
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
Trace::UnregisterProvider();
break;
}
return TRUE;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
Trace::RegisterProvider();
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
Trace::UnregisterProvider();
break;
}
return TRUE;
}

extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create() {
if (!instance) {
instance = new OverlayWindow();
return instance;
} else {
return nullptr;
}
extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()
{
if (!instance)
{
instance = new OverlayWindow();
return instance;
}
else
{
return nullptr;
}
}
29 changes: 16 additions & 13 deletions src/modules/shortcut_guide/keyboard_state.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
#include "pch.h"
#include "keyboard_state.h"

bool winkey_held() {
auto left = GetAsyncKeyState(VK_LWIN);
auto right = GetAsyncKeyState(VK_RWIN);
return (left & 0x8000) || (right & 0x8000);
bool winkey_held()
{
auto left = GetAsyncKeyState(VK_LWIN);
auto right = GetAsyncKeyState(VK_RWIN);
return (left & 0x8000) || (right & 0x8000);
}

bool only_winkey_key_held() {
/* There are situations, when some of the keys are not registered correctly by
bool only_winkey_key_held()
{
/* There are situations, when some of the keys are not registered correctly by
GetKeyboardState. The M key can get stuck as "pressed" after Win+M, and
Shift etc. keys are not always reported as expected.
*/
for (int vk = 0; vk <= VK_OEM_CLEAR; ++vk) {
if (vk == VK_LWIN || vk == VK_RWIN)
continue;
if (GetAsyncKeyState(vk) & 0x8000)
return false;
}
return true;
for (int vk = 0; vk <= VK_OEM_CLEAR; ++vk)
{
if (vk == VK_LWIN || vk == VK_RWIN)
continue;
if (GetAsyncKeyState(vk) & 0x8000)
return false;
}
return true;
}

0 comments on commit f22a30c

Please sign in to comment.