From 53797b9eadd09f4dfe0e8d36e42a2881f67dd73a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 22 Nov 2020 12:14:52 +0530 Subject: [PATCH] Wayland: Fix key repeat being stopped by the release of an unrelated key Fixes #2191 --- docs/changelog.rst | 3 +++ glfw/wl_init.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a1a88c9d4..513992ddc 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -20,6 +20,9 @@ To update |kitty|, :doc:`follow the instructions `. - Preserve lines in the scrollback if a scrolling region is defined that is contiguous with the top of the screen (:iss:`3113`) +- Wayland: Fix key repeat being stopped by the release of an unrelated key + (:iss:`2191`) + 0.19.2 [2020-11-13] ------------------- diff --git a/glfw/wl_init.c b/glfw/wl_init.c index c14934a2f..ea99a05c1 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -446,7 +446,6 @@ static void keyboardHandleKey(void* data UNUSED, _glfw.wl.serial = serial; glfw_xkb_handle_key_event(window, &_glfw.wl.xkb, key, action); bool repeatable = false; - _glfw.wl.keyRepeatInfo.key = 0; if (action == GLFW_PRESS && _glfw.wl.keyboardRepeatRate > 0 && glfw_xkb_should_repeat(&_glfw.wl.xkb, key)) { @@ -456,8 +455,11 @@ static void keyboardHandleKey(void* data UNUSED, } if (repeatable) { changeTimerInterval(&_glfw.wl.eventLoopData, _glfw.wl.keyRepeatInfo.keyRepeatTimer, _glfw.wl.keyboardRepeatDelay); + toggleTimer(&_glfw.wl.eventLoopData, _glfw.wl.keyRepeatInfo.keyRepeatTimer, 1); + } else if (action == GLFW_RELEASE && key == _glfw.wl.keyRepeatInfo.key) { + _glfw.wl.keyRepeatInfo.key = 0; + toggleTimer(&_glfw.wl.eventLoopData, _glfw.wl.keyRepeatInfo.keyRepeatTimer, 0); } - toggleTimer(&_glfw.wl.eventLoopData, _glfw.wl.keyRepeatInfo.keyRepeatTimer, repeatable ? 1 : 0); } static void keyboardHandleModifiers(void* data UNUSED,