mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Add lock key modifier bits input mode
This adds the GLFW_MOD_CAPS_LOCK and GLFW_MOD_NUM_LOCK modifier bits. Set the GLFW_LOCK_KEY_MODS input mode to enable these for all callbacks that receive modifier bits. Fixes #946.
This commit is contained in:
@@ -392,6 +392,10 @@ 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)
|
||||
mods |= GLFW_MOD_CAPS_LOCK;
|
||||
if (GetKeyState(VK_NUMLOCK) & 1)
|
||||
mods |= GLFW_MOD_NUM_LOCK;
|
||||
|
||||
return mods;
|
||||
}
|
||||
@@ -410,6 +414,10 @@ 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)
|
||||
mods |= GLFW_MOD_CAPS_LOCK;
|
||||
if (GetAsyncKeyState(VK_NUMLOCK) & 1)
|
||||
mods |= GLFW_MOD_NUM_LOCK;
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user