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
This commit is contained in:
Carlos Garnacho 2019-07-20 00:22:13 +02:00 committed by Carlos Garnacho
parent e3149e6021
commit 64eaf70279

View File

@ -157,6 +157,7 @@ enum
RESTACKED, RESTACKED,
WORKAREAS_CHANGED, WORKAREAS_CHANGED,
CLOSING, CLOSING,
INIT_XSERVER,
LAST_SIGNAL LAST_SIGNAL
}; };
@ -501,6 +502,14 @@ meta_display_class_init (MetaDisplayClass *klass)
0, NULL, NULL, NULL, 0, NULL, NULL, NULL,
G_TYPE_NONE, 0); 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, g_object_class_install_property (object_class,
PROP_FOCUS_WINDOW, PROP_FOCUS_WINDOW,
g_param_spec_object ("focus-window", g_param_spec_object ("focus-window",
@ -722,15 +731,27 @@ on_xserver_started (MetaXWaylandManager *manager,
gpointer user_data) gpointer user_data)
{ {
g_autoptr (GTask) task = user_data; g_autoptr (GTask) task = user_data;
MetaDisplay *display = g_task_get_source_object (task);
GError *error = NULL; 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) if (error)
g_task_return_error (task, error); g_task_return_error (task, error);
else else
g_task_return_boolean (task, retval); g_task_return_boolean (task, FALSE);
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 void