[mutter/wip/carlosg/xwayland-startup-side-channel: 6/6] xwayland: Allow setting up maintenance processes



commit 6560130136c30879293cca84a5b4e73d74f5e9f6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Jul 20 00:22:13 2019 +0200

    xwayland: Allow setting up maintenance processes
    
    This is made a signal, so the upper layers (read: gnome-shell) may
    decide what services to spawn. The signal argument contains a task
    that will resume MetaX11Display startup after it is returned upon.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/945

 src/core/display.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 0ab806ea1..9a431dd24 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -157,6 +157,7 @@ enum
   RESTACKED,
   WORKAREAS_CHANGED,
   CLOSING,
+  INIT_XSERVER,
   LAST_SIGNAL
 };
 
@@ -501,6 +502,14 @@ meta_display_class_init (MetaDisplayClass *klass)
                   0, NULL, NULL, NULL,
                   G_TYPE_NONE, 0);
 
+  display_signals[INIT_XSERVER] =
+    g_signal_new ("init-xserver",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0, g_signal_accumulator_first_wins,
+                  NULL, NULL,
+                  G_TYPE_BOOLEAN, 1, G_TYPE_TASK);
+
   g_object_class_install_property (object_class,
                                    PROP_FOCUS_WINDOW,
                                    g_param_spec_object ("focus-window",
@@ -722,15 +731,27 @@ on_xserver_started (MetaXWaylandManager *manager,
                     gpointer             user_data)
 {
   g_autoptr (GTask) task = user_data;
+  MetaDisplay *display = g_task_get_source_object (task);
   GError *error = NULL;
-  gboolean retval;
+  gboolean retval = FALSE;
 
-  retval = meta_xwayland_start_xserver_finish (manager, result, &error);
+  if (!meta_xwayland_start_xserver_finish (manager, result, &error))
+    {
+      if (error)
+        g_task_return_error (task, error);
+      else
+        g_task_return_boolean (task, FALSE);
 
-  if (error)
-    g_task_return_error (task, error);
-  else
-    g_task_return_boolean (task, retval);
+      return;
+    }
+
+  g_signal_emit (display, display_signals[INIT_XSERVER], 0, task, &retval);
+
+  if (!retval)
+    {
+      /* No handlers for this signal, proceed right away */
+      g_task_return_boolean (task, TRUE);
+    }
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]