xwayland: Do not block on Xwayland initialization
We artificially made Xwayland initialization synchronous, as we used to rely on MetaX11Display and other bits during meta_display_open(). With support for Xwayland on demand and --no-x11, this is certainly not the case. So drop the main loop surrounding Xwayland initialization, and turn it into an async operation called from meta_display_init_x11(). This function is turned then into the high-level entry point that will get you from no X server to having a MetaX11Display. The role of meta_init() in Xwayland initialization is thus reduced to setting up the sockets. Notably no processes are spawned from here, deferring that till there is a MetaDisplay to poke. https://gitlab.gnome.org/GNOME/mutter/merge_requests/944
This commit is contained in:

committed by
Jonas Ådahl

parent
649911b6b3
commit
25c9e66c73
@ -716,19 +716,40 @@ meta_display_init_x11_finish (MetaDisplay *display,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_xserver_started (MetaXWaylandManager *manager,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_autoptr (GTask) task = user_data;
|
||||
GError *error = NULL;
|
||||
gboolean retval;
|
||||
|
||||
retval = meta_xwayland_start_xserver_finish (manager, result, &error);
|
||||
|
||||
if (error)
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_task_return_boolean (task, retval);
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_init_x11 (MetaDisplay *display,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
|
||||
g_autoptr (GTask) task = NULL;
|
||||
|
||||
task = g_task_new (display, cancellable, callback, user_data);
|
||||
g_task_set_source_tag (task, meta_display_init_x11);
|
||||
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
meta_xwayland_start_xserver (&compositor->xwayland_manager,
|
||||
cancellable,
|
||||
(GAsyncReadyCallback) on_xserver_started,
|
||||
g_steal_pointer (&task));
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user