Wayland: Clean up key repeat logic

(cherry picked from commit 9180923ea0)
This commit is contained in:
Camilla Löwy
2022-07-13 21:32:30 +02:00
parent a8d543f1f8
commit 1acd67eeb6
3 changed files with 32 additions and 29 deletions
+7 -4
View File
@@ -314,7 +314,7 @@ int _glfwPlatformInit(void)
int cursorSize;
// These must be set before any failure checks
_glfw.wl.timerfd = -1;
_glfw.wl.keyRepeatTimerfd = -1;
_glfw.wl.cursorTimerfd = -1;
_glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0");
@@ -435,7 +435,10 @@ int _glfwPlatformInit(void)
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
{
_glfw.wl.keyRepeatTimerfd =
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
}
#endif
if (!_glfw.wl.wmBase)
@@ -571,8 +574,8 @@ void _glfwPlatformTerminate(void)
wl_display_disconnect(_glfw.wl.display);
}
if (_glfw.wl.timerfd >= 0)
close(_glfw.wl.timerfd);
if (_glfw.wl.keyRepeatTimerfd >= 0)
close(_glfw.wl.keyRepeatTimerfd);
if (_glfw.wl.cursorTimerfd >= 0)
close(_glfw.wl.cursorTimerfd);