From 9240ee5ddfa3d53c404caaf2aa6cf480434711b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 22 Dec 2021 14:19:55 +0100 Subject: [PATCH] Wayland: Fix key repeat continuing when refocused If a window lost input focus while a key was held down, the key repeat mechanism would resume once the window regained focus. (cherry picked from commit e24fe4b189d2cf99e0374992e7fc6650f4c6cf01) --- README.md | 1 + src/wl_init.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 7bd6ace6..e008b06f 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Key repeat could lead to a race condition (#1710) - [Wayland] Bugfix: Activating a window would emit two input focus events + - [Wayland] Bugfix: Disable key repeat mechanism when window loses input focus ## Contact diff --git a/src/wl_init.c b/src/wl_init.c index ba32707f..ed8ea80e 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -503,6 +503,9 @@ static void keyboardHandleLeave(void* data, _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = NULL; _glfwInputWindowFocus(window, GLFW_FALSE); + + struct itimerspec timer = {}; + timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL); } static int toGLFWKeyCode(uint32_t key)