mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
wayland: Hook focus synchronization to MetaDisplay signals
Instead of letting the MetaDisplay be aware of the Wayland compositor, and take care of updating its focus. This makes the MetaWaylandCompositor able to track focus changes by itself, using MetaDisplay as the source of truth. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
This commit is contained in:
parent
38421b07c7
commit
962eb9e054
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user