Pass scancode with synthetic key release events

This commit is contained in:
Camilla Löwy 2017-01-29 16:18:58 +01:00
parent a2867ff6ea
commit f3e20ca437
3 changed files with 13 additions and 3 deletions

View File

@ -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)

View File

@ -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);
}
}
}

View File

@ -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++)