diff --git a/README.md b/README.md index 3b9da02d..09205013 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ information on what to include when reporting a bug. - Bugfix: `glfwGetInstanceProcAddress` returned `NULL` for `vkGetInstanceProcAddr` when `_GLFW_VULKAN_STATIC` was enabled - Bugfix: Invalid library paths were used in test and example CMake files (#930) +- Bugfix: The scancode for synthetic key release events was always zero - [Win32] Added system error strings to relevant GLFW error descriptions (#733) - [Win32] Bugfix: Undecorated windows could not be iconified by the user (#861) - [Win32] Bugfix: Deadzone logic could underflow with some controllers (#910) diff --git a/src/win32_window.c b/src/win32_window.c index 11fb6cd6..ab6c4a10 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1428,10 +1428,16 @@ void _glfwPlatformPollEvents(void) // 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) - _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, 0, GLFW_RELEASE, mods); + { + const int scancode = _glfw.win32.scancodes[GLFW_KEY_LEFT_SHIFT]; + _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, GLFW_RELEASE, mods); + } if (!rshiftDown && window->keys[GLFW_KEY_RIGHT_SHIFT] == 1) - _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, 0, GLFW_RELEASE, mods); + { + const int scancode = _glfw.win32.scancodes[GLFW_KEY_RIGHT_SHIFT]; + _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, GLFW_RELEASE, mods); + } } } diff --git a/src/window.c b/src/window.c index 957b5fd0..9fdc308f 100644 --- a/src/window.c +++ b/src/window.c @@ -50,7 +50,10 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused) for (key = 0; key <= GLFW_KEY_LAST; key++) { if (window->keys[key] == GLFW_PRESS) - _glfwInputKey(window, key, 0, GLFW_RELEASE, 0); + { + const int scancode = _glfwPlatformGetKeyScancode(key); + _glfwInputKey(window, key, scancode, GLFW_RELEASE, 0); + } } for (button = 0; button <= GLFW_MOUSE_BUTTON_LAST; button++)