mirror of
https://github.com/glfw/glfw.git
synced 2026-02-06 18:57:36 +00:00
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.
This commit is contained in:
parent
7b370d8df0
commit
0aa77a9a3a
@ -1926,7 +1926,11 @@ static void seatHandleCapabilities(void* userData,
|
|||||||
}
|
}
|
||||||
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer)
|
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;
|
_glfw.wl.pointer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1937,7 +1941,11 @@ static void seatHandleCapabilities(void* userData,
|
|||||||
}
|
}
|
||||||
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard)
|
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;
|
_glfw.wl.keyboard = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user