-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format shortcut_guide according to .clang-format
- Loading branch information
Showing
10 changed files
with
1,392 additions
and
1,168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.