diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index a5a5cb352..786420cc1 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -406,11 +406,12 @@ data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab) */ if (drag_grab->generic.pointer->grab == (MetaWaylandPointerGrab *) drag_grab) { - MetaDisplay *display = display_from_data_device (data_device); + MetaWaylandCompositor *wayland_compositor = + meta_wayland_seat_get_compositor (data_device->seat); meta_wayland_pointer_end_grab (drag_grab->generic.pointer); meta_wayland_keyboard_end_grab (drag_grab->keyboard_grab.keyboard); - meta_display_sync_wayland_input_focus (display); + meta_wayland_compositor_sync_focus (wayland_compositor); } g_free (drag_grab); diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c index f89c43a51..07439f22b 100644 --- a/src/wayland/meta-wayland-seat.c +++ b/src/wayland/meta-wayland-seat.c @@ -158,15 +158,10 @@ meta_wayland_seat_set_capabilities (MetaWaylandSeat *seat, { MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat); - MetaContext *context = meta_wayland_compositor_get_context (compositor); - MetaDisplay *display; meta_wayland_keyboard_enable (seat->keyboard); - /* Post-initialization, ensure the input focus is in sync */ - display = meta_context_get_display (context); - if (display) - meta_display_sync_wayland_input_focus (display); + meta_wayland_compositor_sync_focus (compositor); } else if (CAPABILITY_DISABLED (prev_flags, flags, WL_SEAT_CAPABILITY_KEYBOARD)) meta_wayland_keyboard_disable (seat->keyboard); diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 00dc9c752..91df6ec0f 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -592,11 +592,15 @@ xdg_popup_destructor (struct wl_resource *resource) META_WAYLAND_SURFACE_ROLE (xdg_popup); MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (surface_role); + MetaDisplay *display = display_from_surface (surface); + MetaContext *context = meta_display_get_context (display); + MetaWaylandCompositor *wayland_compositor = + meta_context_get_wayland_compositor (context); dismiss_popup (xdg_popup); xdg_popup->resource = NULL; - meta_display_sync_wayland_input_focus (display_from_surface (surface)); + meta_wayland_compositor_sync_focus (wayland_compositor); } static void diff --git a/src/wayland/meta-xwayland-grab-keyboard.c b/src/wayland/meta-xwayland-grab-keyboard.c index 7a739b282..ce555bbe8 100644 --- a/src/wayland/meta-xwayland-grab-keyboard.c +++ b/src/wayland/meta-xwayland-grab-keyboard.c @@ -88,12 +88,10 @@ meta_xwayland_keyboard_grab_end (MetaXwaylandKeyboardActiveGrab *active_grab) { MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (active_grab->seat); - MetaContext *context = meta_wayland_compositor_get_context (compositor); - MetaDisplay *display = meta_context_get_display (context); meta_wayland_keyboard_end_grab (active_grab->keyboard_grab.keyboard); meta_wayland_keyboard_set_focus (active_grab->keyboard_grab.keyboard, NULL); - meta_display_sync_wayland_input_focus (display); + meta_wayland_compositor_sync_focus (compositor); } if (!active_grab->surface) diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index 365c74d1f..ea9c27d74 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -87,6 +87,9 @@ meta_xwayland_associate_window_with_surface (MetaWindow *window, { MetaDisplay *display = window->display; MetaXwaylandSurface *xwayland_surface; + MetaContext *context = meta_display_get_context (display); + MetaWaylandCompositor *wayland_compositor = + meta_context_get_wayland_compositor (context); if (!meta_wayland_surface_assign_role (surface, META_TYPE_XWAYLAND_SURFACE, @@ -103,7 +106,7 @@ meta_xwayland_associate_window_with_surface (MetaWindow *window, meta_xwayland_surface_associate_with_window (xwayland_surface, window); /* Now that we have a surface check if it should have focus. */ - meta_display_sync_wayland_input_focus (display); + meta_wayland_compositor_sync_focus (wayland_compositor); } static gboolean