From 850ef518795dcc20d3b9a4f661f70ff8d0ddacb2 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 11 Sep 2019 22:26:49 +0200 Subject: [PATCH] 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 --- src/core/display.c | 13 ++++++++++++- src/core/stack-tracker.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/display.c b/src/core/display.c index e803f5557..2ddcbbc1f 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -126,6 +126,7 @@ G_DEFINE_TYPE(MetaDisplay, meta_display, G_TYPE_OBJECT); enum { CURSOR_UPDATED, + X11_DISPLAY_SETUP, X11_DISPLAY_OPENED, X11_DISPLAY_CLOSING, OVERLAY_KEY, @@ -232,6 +233,14 @@ meta_display_class_init (MetaDisplayClass *klass) NULL, NULL, NULL, 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] = g_signal_new ("x11-display-opened", G_TYPE_FROM_CLASS (klass), @@ -657,12 +666,13 @@ meta_display_init_x11 (MetaDisplay *display, return FALSE; 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); if (!display->display_opening) { + g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0); meta_display_manage_all_xwindows (display); meta_compositor_redirect_x11_windows (display->compositor); } @@ -803,6 +813,7 @@ meta_display_open (void) 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_create_guard_window (display->x11_display); } diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c index 5a2956c00..a37760ec2 100644 --- a/src/core/stack-tracker.c +++ b/src/core/stack-tracker.c @@ -556,7 +556,7 @@ meta_stack_tracker_new (MetaDisplay *display) tracker->unverified_predictions = g_queue_new (); g_signal_connect (display, - "x11-display-opened", + "x11-display-setup", G_CALLBACK (query_xserver_stack), tracker); g_signal_connect (display, -- 2.22.0