wayland: Trigger full focus sync after keyboard focus surface is destroyed

This used to be implicitly done by popups using a META_GRAB_OP_WAYLAND_POPUP
MetaDisplay grab. Since commit a8cd488c6f Wayland popups no longer do that,
so the keyboard focus was simply unset if a popup was destroyed while having
the keyboard focus.

Trigger a full input focus sync, so the correct MetaWaylandKeyboard focus
surface is looked up from the focused MetaWindow.

Fixes: a8cd488c6f - wayland: Drop redundant MetaDisplay grab op
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2833>
This commit is contained in:
Carlos Garnacho 2023-02-09 16:17:34 +01:00
parent c4d8ba0f72
commit 228d681be8

View File

@ -229,10 +229,15 @@ on_keymap_layout_group_changed (MetaBackend *backend,
static void static void
keyboard_handle_focus_surface_destroy (struct wl_listener *listener, void *data) keyboard_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
{ {
MetaWaylandKeyboard *keyboard = wl_container_of (listener, keyboard, MetaWaylandKeyboard *keyboard =
focus_surface_listener); wl_container_of (listener, keyboard, focus_surface_listener);
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (keyboard);
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
MetaContext *context = meta_wayland_compositor_get_context (compositor);
MetaDisplay *display = meta_context_get_display (context);
meta_wayland_keyboard_set_focus (keyboard, NULL); meta_display_sync_wayland_input_focus (display);
} }
static gboolean static gboolean