mirror of https://github.com/godotengine/godot
Merge pull request #95331 from Riteo/seat-tight-this-is-weird
Wayland: Avoid recreating input objects on capability change
This commit is contained in:
commit
4ab4613f90
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue