From 4ea7ed07ffef6acbe916866ae9ed9aba5c88ba12 Mon Sep 17 00:00:00 2001 From: Luca Rood Date: Sun, 21 Apr 2019 16:28:42 +0200 Subject: [PATCH] Fix #1112: simultaneous key presses being dropped This improves the mechanism to check for duplicate key press events, by checking if the event with the same time code actually corresponds to the same key. This will correctly process any key known to GLFW, handling simultanous presses of different keys, while still filtering out duplicate presses of the same key. Note that this still does not properly handle keys that are GLFW_KEY_UNKNOWN, as I am not aware of a good way to check for previous events on those keys. --- README.md | 2 +- src/x11_window.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3fce2f8c2..5c31fb600 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ information on what to include when reporting a bug. ## Changelog -User-visible changes since the last release. +- [X11] Bugfix: Simultanous key presses were being ignored (#1112) ## Contact diff --git a/src/x11_window.c b/src/x11_window.c index 1b3f403fc..9feecdc82 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1258,7 +1258,8 @@ static void processEvent(XEvent *event) // These have the same timestamp as the original event // Corresponding release events are filtered out // implicitly by the GLFW key repeat logic - if (window->x11.lastKeyTime < event->xkey.time) + if (window->x11.lastKeyTime < event->xkey.time || + (key != GLFW_KEY_UNKNOWN && window->keys[key] != GLFW_PRESS)) { if (keycode) _glfwInputKey(window, key, keycode, GLFW_PRESS, mods);