diff --git a/glfw/wl_init.c b/glfw/wl_init.c index b35efb4b9..6e797470a 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -484,7 +484,6 @@ static void keyboardHandleKey(void* data, { _glfw.wl.keyRepeatInfo.glfwKeyCode = keyCode; _glfw.wl.keyRepeatInfo.scancode = key; - _glfw.wl.keyRepeatInfo.isFirstRepeat = GLFW_TRUE; _glfw.wl.keyRepeatInfo.nextRepeatAt = glfwGetTime() + (double)(_glfw.wl.keyboardRepeatDelay) / 1000.0; _glfw.wl.keyRepeatInfo.keyboardFocus = window; } diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index 776196277..da472af60 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -208,7 +208,6 @@ typedef struct _GLFWlibraryWayland int plain; int glfwKeyCode; int scancode; - GLFWbool isFirstRepeat; double nextRepeatAt; _GLFWwindow* keyboardFocus; } keyRepeatInfo; diff --git a/glfw/wl_window.c b/glfw/wl_window.c index cf1b24e77..333fd3721 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -693,13 +693,12 @@ static void dispatchPendingKeyRepeats() { if (_glfw.wl.keyRepeatInfo.nextRepeatAt <= 0 || _glfw.wl.keyRepeatInfo.keyboardFocus != _glfw.wl.keyboardFocus || _glfw.wl.keyboardRepeatRate == 0) return; double now = glfwGetTime(); + const int mods = _glfw.wl.xkb.modifiers; while (_glfw.wl.keyRepeatInfo.nextRepeatAt <= now) { - const int mods = _glfw.wl.xkb.modifiers; _glfwInputKey(_glfw.wl.keyRepeatInfo.keyboardFocus, _glfw.wl.keyRepeatInfo.glfwKeyCode, _glfw.wl.keyRepeatInfo.scancode, GLFW_REPEAT, mods); if (_glfw.wl.keyRepeatInfo.codepoint > -1) _glfwInputChar(_glfw.wl.keyRepeatInfo.keyboardFocus, _glfw.wl.keyRepeatInfo.codepoint, mods, _glfw.wl.keyRepeatInfo.plain); + _glfw.wl.keyRepeatInfo.nextRepeatAt += 1.0 / _glfw.wl.keyboardRepeatRate; now = glfwGetTime(); - _glfw.wl.keyRepeatInfo.nextRepeatAt = now + (1.0 / _glfw.wl.keyboardRepeatRate); - _glfw.wl.keyRepeatInfo.isFirstRepeat = GLFW_FALSE; } }