Win32: Fix flaky GetAsyncKeyState bit for CAPITAL and NUMLOCK

This bug was reported on the Chromium bug tracker at https://crbug.com/922095 and seems to have been caused by a race between 7c87948eaf that fixed the use of the first bit, and 0e8c4ea7ce that added support for CAPITAL and NUM_LOCK.
This commit is contained in:
Corentin Wallez 2019-02-07 14:30:39 +01:00
parent 90e22947c6
commit 73900a231b
2 changed files with 5 additions and 4 deletions

View File

@ -231,6 +231,7 @@ information on what to include when reporting a bug.
(#1315,#1316)
- [Win32] Bugfix: A title bar would be drawn over undecorated windows in some
circumstances (#1383)
- [Win32] Bugfix: GetAsyncKeyState used flaky bit for CAPS and NUM LOCK (#1428)
- [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125)
- [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
- [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X

View File

@ -422,9 +422,9 @@ static int getKeyMods(void)
mods |= GLFW_MOD_ALT;
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x8000)
mods |= GLFW_MOD_SUPER;
if (GetKeyState(VK_CAPITAL) & 1)
if (GetKeyState(VK_CAPITAL) & 0x8000)
mods |= GLFW_MOD_CAPS_LOCK;
if (GetKeyState(VK_NUMLOCK) & 1)
if (GetKeyState(VK_NUMLOCK) & 0x8000)
mods |= GLFW_MOD_NUM_LOCK;
return mods;
@ -444,9 +444,9 @@ static int getAsyncKeyMods(void)
mods |= GLFW_MOD_ALT;
if ((GetAsyncKeyState(VK_LWIN) | GetAsyncKeyState(VK_RWIN)) & 0x8000)
mods |= GLFW_MOD_SUPER;
if (GetAsyncKeyState(VK_CAPITAL) & 1)
if (GetAsyncKeyState(VK_CAPITAL) & 0x8000)
mods |= GLFW_MOD_CAPS_LOCK;
if (GetAsyncKeyState(VK_NUMLOCK) & 1)
if (GetAsyncKeyState(VK_NUMLOCK) & 0x8000)
mods |= GLFW_MOD_NUM_LOCK;
return mods;