diff --git a/src/core/display-private.h b/src/core/display-private.h index 829b34acf..bd67dc0f0 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -255,7 +255,6 @@ void meta_display_accelerator_activate (MetaDisplay *display, const ClutterKeyEvent *event); gboolean meta_display_modifiers_accelerator_activate (MetaDisplay *display); -void meta_display_sync_wayland_input_focus (MetaDisplay *display); void meta_display_update_focus_window (MetaDisplay *display, MetaWindow *window); diff --git a/src/core/display.c b/src/core/display.c index 4d4b72af3..d5a448f82 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1488,16 +1488,6 @@ meta_display_queue_autoraise_callback (MetaDisplay *display, display->autoraise_window = window; } -void -meta_display_sync_wayland_input_focus (MetaDisplay *display) -{ -#ifdef HAVE_WAYLAND - MetaWaylandCompositor *compositor = wayland_compositor_from_display (display); - - meta_wayland_compositor_sync_focus (compositor); -#endif -} - static void meta_window_set_inactive_since (MetaWindow *window, int64_t inactive_since_us) @@ -1567,9 +1557,6 @@ meta_display_update_focus_window (MetaDisplay *display, meta_window_set_inactive_since (display->focus_window, -1); } - if (meta_is_wayland_compositor ()) - meta_display_sync_wayland_input_focus (display); - g_object_notify (G_OBJECT (display), "focus-window"); } diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index 36ce5aed2..ac7f0e250 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -100,6 +100,9 @@ typedef struct int64_t target_presentation_time_us; } FrameCallbackSource; +static void meta_wayland_compositor_update_focus (MetaWaylandCompositor *compositor, + MetaWindow *window); + static gboolean wayland_event_source_prepare (GSource *base, int *timeout) @@ -465,6 +468,18 @@ on_presented (ClutterStage *stage, } } +static void +on_started (MetaContext *context, + MetaWaylandCompositor *compositor) +{ + MetaDisplay *display = meta_context_get_display (context); + + g_signal_connect_object (display, "focus-window", + G_CALLBACK (meta_wayland_compositor_update_focus), + compositor, + G_CONNECT_SWAPPED); +} + /** * meta_wayland_compositor_handle_event: * @compositor: the #MetaWaylandCompositor instance @@ -780,6 +795,9 @@ meta_wayland_compositor_new (MetaContext *context) g_signal_connect (stage, "presented", G_CALLBACK (on_presented), compositor); + g_signal_connect (context, "started", + G_CALLBACK (on_started), compositor); + if (!wl_global_create (compositor->wayland_display, &wl_compositor_interface, META_WL_COMPOSITOR_VERSION,