1
0
Fork 0

core: Split x11-display initialization in 2 signals

We have a "setup" phase, used internally to initialize early the x11
side of things like the stack tracker, and an "opened" phase where
other upper parts may hook up to. This latter phase is delayed during
initialization so the upper parts have a change to connect to on
plugin creation.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/771
This commit is contained in:
Carlos Garnacho 2019-09-11 22:26:49 +02:00
parent ef2e04a613
commit 850ef51879
2 changed files with 13 additions and 2 deletions

View file

@ -126,6 +126,7 @@ G_DEFINE_TYPE(MetaDisplay, meta_display, G_TYPE_OBJECT);
enum enum
{ {
CURSOR_UPDATED, CURSOR_UPDATED,
X11_DISPLAY_SETUP,
X11_DISPLAY_OPENED, X11_DISPLAY_OPENED,
X11_DISPLAY_CLOSING, X11_DISPLAY_CLOSING,
OVERLAY_KEY, OVERLAY_KEY,
@ -232,6 +233,14 @@ meta_display_class_init (MetaDisplayClass *klass)
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
display_signals[X11_DISPLAY_SETUP] =
g_signal_new ("x11-display-setup",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
display_signals[X11_DISPLAY_OPENED] = display_signals[X11_DISPLAY_OPENED] =
g_signal_new ("x11-display-opened", g_signal_new ("x11-display-opened",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
@ -657,12 +666,13 @@ meta_display_init_x11 (MetaDisplay *display,
return FALSE; return FALSE;
display->x11_display = x11_display; display->x11_display = x11_display;
g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0); g_signal_emit (display, display_signals[X11_DISPLAY_SETUP], 0);
meta_x11_display_create_guard_window (x11_display); meta_x11_display_create_guard_window (x11_display);
if (!display->display_opening) if (!display->display_opening)
{ {
g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0);
meta_display_manage_all_xwindows (display); meta_display_manage_all_xwindows (display);
meta_compositor_redirect_x11_windows (display->compositor); meta_compositor_redirect_x11_windows (display->compositor);
} }
@ -803,6 +813,7 @@ meta_display_open (void)
if (display->x11_display) if (display->x11_display)
{ {
g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0);
meta_x11_display_restore_active_workspace (display->x11_display); meta_x11_display_restore_active_workspace (display->x11_display);
meta_x11_display_create_guard_window (display->x11_display); meta_x11_display_create_guard_window (display->x11_display);
} }

View file

@ -556,7 +556,7 @@ meta_stack_tracker_new (MetaDisplay *display)
tracker->unverified_predictions = g_queue_new (); tracker->unverified_predictions = g_queue_new ();
g_signal_connect (display, g_signal_connect (display,
"x11-display-opened", "x11-display-setup",
G_CALLBACK (query_xserver_stack), G_CALLBACK (query_xserver_stack),
tracker); tracker);
g_signal_connect (display, g_signal_connect (display,