mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 08:39:45 +00:00
Wayland: Fix key repeat on very old compositors
The client-side key repeat timer fd was only created for wl_seat version 4 or later, but was then used unconditionally during event processing. Rather than have this mechanism do nothing in a more correct way on wl_seat version 3 or earlier (which is very old by now), this commit creates the key repeat timer fd and then sets (hopefully gentle) hardcoded repeat delay and rate.
This commit is contained in:
+10
-7
@@ -137,13 +137,6 @@ static void registryHandleGlobal(void* userData,
|
||||
wl_registry_bind(registry, name, &wl_seat_interface,
|
||||
_glfw_min(4, version));
|
||||
_glfwAddSeatListenerWayland(_glfw.wl.seat);
|
||||
|
||||
if (wl_seat_get_version(_glfw.wl.seat) >=
|
||||
WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
|
||||
{
|
||||
_glfw.wl.keyRepeatTimerfd =
|
||||
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(interface, "wl_data_device_manager") == 0)
|
||||
@@ -834,6 +827,16 @@ int _glfwInitWayland(void)
|
||||
|
||||
createKeyTables();
|
||||
|
||||
_glfw.wl.keyRepeatTimerfd =
|
||||
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
if (_glfw.wl.keyRepeatTimerfd == -1)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Failed to create timerfd: %s",
|
||||
strerror(errno));
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
_glfw.wl.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
if (!_glfw.wl.xkb.context)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user