mirror of
https://github.com/gwm17/glfw.git
synced 2025-02-07 06:38:50 -05:00
Win32: Cleanup
This commit is contained in:
parent
260dbf0a1d
commit
43c1910453
|
@ -1413,28 +1413,24 @@ void _glfwPlatformPollEvents(void)
|
||||||
handle = GetActiveWindow();
|
handle = GetActiveWindow();
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
// LSHIFT/RSHIFT fixup (keys tend to "stick" without this fix)
|
// NOTE: Shift keys on Windows tend to "stick" when both are pressed as
|
||||||
// This is the only async event handling in GLFW, but it solves some
|
// no key up message is generated by the first key release
|
||||||
// nasty problems
|
// HACK: Query actual key state and synthesize release events as needed
|
||||||
window = GetPropW(handle, L"GLFW");
|
window = GetPropW(handle, L"GLFW");
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
const int mods = getAsyncKeyMods();
|
const GLFWbool lshift = (GetAsyncKeyState(VK_LSHIFT) >> 15) & 1;
|
||||||
|
const GLFWbool rshift = (GetAsyncKeyState(VK_RSHIFT) >> 15) & 1;
|
||||||
|
|
||||||
// Get current state of left and right shift keys
|
if (!lshift && window->keys[GLFW_KEY_LEFT_SHIFT] == GLFW_PRESS)
|
||||||
const int lshiftDown = (GetAsyncKeyState(VK_LSHIFT) >> 15) & 1;
|
|
||||||
const int rshiftDown = (GetAsyncKeyState(VK_RSHIFT) >> 15) & 1;
|
|
||||||
|
|
||||||
// See if this differs from our belief of what has happened
|
|
||||||
// (we only have to check for lost key up events)
|
|
||||||
if (!lshiftDown && window->keys[GLFW_KEY_LEFT_SHIFT] == 1)
|
|
||||||
{
|
{
|
||||||
|
const int mods = getAsyncKeyMods();
|
||||||
const int scancode = _glfw.win32.scancodes[GLFW_KEY_LEFT_SHIFT];
|
const int scancode = _glfw.win32.scancodes[GLFW_KEY_LEFT_SHIFT];
|
||||||
_glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, GLFW_RELEASE, mods);
|
_glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, GLFW_RELEASE, mods);
|
||||||
}
|
}
|
||||||
|
else if (!rshift && window->keys[GLFW_KEY_RIGHT_SHIFT] == GLFW_PRESS)
|
||||||
if (!rshiftDown && window->keys[GLFW_KEY_RIGHT_SHIFT] == 1)
|
|
||||||
{
|
{
|
||||||
|
const int mods = getAsyncKeyMods();
|
||||||
const int scancode = _glfw.win32.scancodes[GLFW_KEY_RIGHT_SHIFT];
|
const int scancode = _glfw.win32.scancodes[GLFW_KEY_RIGHT_SHIFT];
|
||||||
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, GLFW_RELEASE, mods);
|
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, GLFW_RELEASE, mods);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user