From dea99146927ccd8272f470c1f0737dda9db4e9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Jul 2022 12:54:24 +0200 Subject: [PATCH] Wayland: Fix reappearing key repeat If the key or character callback performs actions that indirectly updates the key repeat timer, those changes would be undone once the key callback returned. This fixes the order of operations so that key repeat is fully set up before the key related events are emitted. (cherry picked from commit 40b5a8a37cb4770ff5d307beb660fadc64be1265) --- src/wl_window.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index d6f2dbbe..db366c49 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1511,14 +1511,11 @@ static void keyboardHandleKey(void* userData, state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; _glfw.wl.serial = serial; - _glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers); struct itimerspec timer = {0}; if (action == GLFW_PRESS) { - inputText(window, scancode); - const xkb_keycode_t keycode = scancode + 8; if (xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode) && @@ -1536,6 +1533,11 @@ static void keyboardHandleKey(void* userData, } timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL); + + _glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers); + + if (action == GLFW_PRESS) + inputText(window, scancode); } static void keyboardHandleModifiers(void* userData,