mirror of
https://github.com/microsoft/PowerToys
synced 2025-10-13 13:55:58 +00:00
FancyZones and Shortcut Guide initial commit
Co-authored-by: Alexis Campailla <alexis@janeasystems.com> Co-authored-by: Bret Anderson <bretan@microsoft.com> Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Jeff Bogdan <jeffbog@microsoft.com> Co-authored-by: March Rogers <marchr@microsoft.com> Co-authored-by: Mike Harsh <mharsh@microsoft.com> Co-authored-by: Nachum Bundak <Nachum.Bundak@microsoft.com> Co-authored-by: Oliver Jones <ojones@microsoft.com> Co-authored-by: Patrick Little <plittle@microsoft.com>
This commit is contained in:
committed by
Bartosz Sosnowski
parent
10c5396099
commit
8431b80e48
22
src/modules/shortcut_guide/keyboard_state.cpp
Normal file
22
src/modules/shortcut_guide/keyboard_state.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#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 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;
|
||||
}
|
Reference in New Issue
Block a user