mirror of
https://github.com/glfw/glfw.git
synced 2024-11-11 21:13:50 +00:00
Win32: Fix no Super key release event after Win+V
The Win+V hotkey brings up a clipboard history IME that consumes the key
release. This adds left and right Super to the modifier keys manually
polled for undetected release during event processing.
Fixes #1622.
(cherry picked from commit 562c17d131
)
This commit is contained in:
parent
85172703db
commit
8552152f80
@ -118,6 +118,7 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
- [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622)
|
||||||
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
|
||||||
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
|
||||||
- [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM
|
- [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM
|
||||||
|
@ -1924,30 +1924,39 @@ void _glfwPlatformPollEvents(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: Release modifier keys that the system did not emit KEYUP for
|
||||||
|
// NOTE: Shift keys on Windows tend to "stick" when both are pressed as
|
||||||
|
// no key up message is generated by the first key release
|
||||||
|
// NOTE: Windows key is not reported as released by the Win+V hotkey
|
||||||
|
// Other Win hotkeys are handled implicitly by _glfwInputWindowFocus
|
||||||
|
// because they change the input focus
|
||||||
handle = GetActiveWindow();
|
handle = GetActiveWindow();
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
// NOTE: Shift keys on Windows tend to "stick" when both are pressed as
|
|
||||||
// no key up message is generated by the first key release
|
|
||||||
// The other half of this is in the handling of WM_KEYUP
|
|
||||||
// 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 GLFWbool lshift = (GetAsyncKeyState(VK_LSHIFT) & 0x8000) != 0;
|
int i;
|
||||||
const GLFWbool rshift = (GetAsyncKeyState(VK_RSHIFT) & 0x8000) != 0;
|
const int keys[4][2] =
|
||||||
|
{
|
||||||
|
{ VK_LSHIFT, GLFW_KEY_LEFT_SHIFT },
|
||||||
|
{ VK_RSHIFT, GLFW_KEY_RIGHT_SHIFT },
|
||||||
|
{ VK_LWIN, GLFW_KEY_LEFT_SUPER },
|
||||||
|
{ VK_RWIN, GLFW_KEY_RIGHT_SUPER }
|
||||||
|
};
|
||||||
|
|
||||||
if (!lshift && window->keys[GLFW_KEY_LEFT_SHIFT] == GLFW_PRESS)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
const int mods = getAsyncKeyMods();
|
const int vk = keys[i][0];
|
||||||
const int scancode = _glfw.win32.scancodes[GLFW_KEY_LEFT_SHIFT];
|
const int key = keys[i][1];
|
||||||
_glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, GLFW_RELEASE, mods);
|
const int scancode = _glfw.win32.scancodes[key];
|
||||||
}
|
|
||||||
else if (!rshift && window->keys[GLFW_KEY_RIGHT_SHIFT] == GLFW_PRESS)
|
if ((GetAsyncKeyState(vk) & 0x8000))
|
||||||
{
|
continue;
|
||||||
const int mods = getAsyncKeyMods();
|
if (window->keys[key] != GLFW_PRESS)
|
||||||
const int scancode = _glfw.win32.scancodes[GLFW_KEY_RIGHT_SHIFT];
|
continue;
|
||||||
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, GLFW_RELEASE, mods);
|
|
||||||
|
_glfwInputKey(window, key, scancode, GLFW_RELEASE, getAsyncKeyMods());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user