1
0
Fork 0

Merge pull request #95331 from Riteo/seat-tight-this-is-weird

Wayland: Avoid recreating input objects on capability change
This commit is contained in:
Rémi Verschelde 2024-08-12 14:10:07 +02:00
commit 4ab4613f90
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 22 additions and 18 deletions

View File

@ -1263,6 +1263,7 @@ void WaylandThread::_wl_seat_on_capabilities(void *data, struct wl_seat *wl_seat
// Pointer handling.
if (capabilities & WL_SEAT_CAPABILITY_POINTER) {
if (!ss->wl_pointer) {
ss->cursor_surface = wl_compositor_create_surface(ss->registry->wl_compositor);
wl_surface_commit(ss->cursor_surface);
@ -1280,6 +1281,7 @@ void WaylandThread::_wl_seat_on_capabilities(void *data, struct wl_seat *wl_seat
}
// TODO: Constrain new pointers if the global mouse mode is constrained.
}
} else {
if (ss->cursor_frame_callback) {
// Just in case. I got bitten by weird race-like conditions already.
@ -1317,11 +1319,13 @@ void WaylandThread::_wl_seat_on_capabilities(void *data, struct wl_seat *wl_seat
// Keyboard handling.
if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD) {
if (!ss->wl_keyboard) {
ss->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
ERR_FAIL_NULL(ss->xkb_context);
ss->wl_keyboard = wl_seat_get_keyboard(wl_seat);
wl_keyboard_add_listener(ss->wl_keyboard, &wl_keyboard_listener, ss);
}
} else {
if (ss->xkb_context) {
xkb_context_unref(ss->xkb_context);