From 0aa77a9a3a24bae3ccb6b6c44162d055c977d4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 26 Jan 2026 17:34:58 +0100 Subject: [PATCH] Wayland: Release input devices where possible On systems with wl_seat verison 3 or later, use release instead of destroy on input devices when they are disconnected. --- src/wl_window.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 5caa8fa3..5c6ad835 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1926,7 +1926,11 @@ static void seatHandleCapabilities(void* userData, } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer) { - wl_pointer_destroy(_glfw.wl.pointer); + if (wl_pointer_get_version(_glfw.wl.pointer) >= WL_POINTER_RELEASE_SINCE_VERSION) + wl_pointer_release(_glfw.wl.pointer); + else + wl_pointer_destroy(_glfw.wl.pointer); + _glfw.wl.pointer = NULL; } @@ -1937,7 +1941,11 @@ static void seatHandleCapabilities(void* userData, } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard) { - wl_keyboard_destroy(_glfw.wl.keyboard); + if (wl_keyboard_get_version(_glfw.wl.keyboard) >= WL_KEYBOARD_RELEASE_SINCE_VERSION) + wl_keyboard_release(_glfw.wl.keyboard); + else + wl_keyboard_destroy(_glfw.wl.keyboard); + _glfw.wl.keyboard = NULL; } }