[mutter/wip/carlosg/xwayland-startup-side-channel: 1/3] xwayland: Allow setting up maintenance processes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/xwayland-startup-side-channel: 1/3] xwayland: Allow setting up maintenance processes
- Date: Mon, 18 Nov 2019 22:15:44 +0000 (UTC)
commit aba7f0d9dbf18b71c9471f1d96cbd9713c862cd6
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 X11 startup after it is returned upon.
src/core/display.c | 9 +++++++++
src/wayland/meta-xwayland.c | 29 +++++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index b18f5a558..fb797ab05 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",
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index ed11e37b0..85fa18a19 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -608,6 +608,19 @@ xserver_finished_init (MetaXWaylandManager *manager)
g_clear_pointer (&manager->init_loop, g_main_loop_unref);
}
+static void
+init_xserver_cb (MetaDisplay *display,
+ GTask *task,
+ gpointer user_data)
+{
+ if (!g_task_propagate_boolean (task, NULL))
+ g_warning ("Could not initialize Xwayland services");
+
+ /* Create the X11 display despite the Xwayland services' state */
+ if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND)
+ meta_display_init_x11 (display, NULL);
+}
+
static gboolean
on_displayfd_ready (int fd,
GIOCondition condition,
@@ -615,6 +628,8 @@ on_displayfd_ready (int fd,
{
MetaXWaylandManager *manager = user_data;
MetaDisplay *display = meta_get_display ();
+ GTask *task;
+ gboolean retval;
/* The server writes its display name to the displayfd
* socket when it's ready. We don't care about the data
@@ -622,8 +637,18 @@ on_displayfd_ready (int fd,
* that means it's ready. */
xserver_finished_init (manager);
- if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND)
- meta_display_init_x11 (display, NULL);
+ task = g_task_new (display, NULL,
+ (GAsyncReadyCallback) init_xserver_cb,
+ display);
+ g_signal_emit_by_name (display, "init-xserver", task, &retval);
+
+ if (!retval)
+ {
+ /* No handlers for this signal, proceed right away */
+ g_task_return_boolean (task, TRUE);
+ }
+
+ g_object_unref (task);
return G_SOURCE_REMOVE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]