[mutter/wip/carlosg/x11less-preparations: 13/18] wayland: Split Xwayland initialization in 2 steps
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/x11less-preparations: 13/18] wayland: Split Xwayland initialization in 2 steps
- Date: Mon, 25 Feb 2019 18:10:08 +0000 (UTC)
commit 3f0dbfab1a3d35d4465f489559d458245721e069
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Dec 10 14:24:43 2018 +0100
wayland: Split Xwayland initialization in 2 steps
It is now separated into meta_xwayland_start(), which picks an unused
display and sets up the sockets, and meta_xwayland_init_xserver(), which
does the actual exec of Xwayland and MetaX11Display initialization.
This differentiation will be useful when Mutter is able to launch Xwayland
lazily, currently the former calls into the latter.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
src/wayland/meta-wayland-private.h | 1 +
src/wayland/meta-xwayland.c | 22 +++++++++++++++-------
2 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h
index 07a71f82b..bed0edd6d 100644
--- a/src/wayland/meta-wayland-private.h
+++ b/src/wayland/meta-wayland-private.h
@@ -48,6 +48,7 @@ typedef struct
char *lock_file;
int abstract_fd;
int unix_fd;
+ struct wl_display *wayland_display;
struct wl_client *client;
struct wl_resource *xserver_resource;
char *display_name;
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index f0b95351d..22d375697 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -464,9 +464,8 @@ on_displayfd_ready (int fd,
return G_SOURCE_REMOVE;
}
-gboolean
-meta_xwayland_start (MetaXWaylandManager *manager,
- struct wl_display *wl_display)
+static gboolean
+meta_xwayland_init_xserver (MetaXWaylandManager *manager)
{
int xwayland_client_fd[2];
int displayfd[2];
@@ -475,9 +474,6 @@ meta_xwayland_start (MetaXWaylandManager *manager,
GSubprocessFlags flags;
GError *error = NULL;
- if (!choose_xdisplay (manager))
- goto out;
-
/* We want xwayland to be a wayland client so we make a socketpair to setup a
* wayland protocol connection. */
if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, xwayland_client_fd) < 0)
@@ -536,7 +532,8 @@ meta_xwayland_start (MetaXWaylandManager *manager,
g_subprocess_wait_async (manager->proc, manager->xserver_died_cancellable,
xserver_died, NULL);
g_unix_fd_add (displayfd[0], G_IO_IN, on_displayfd_ready, manager);
- manager->client = wl_client_create (wl_display, xwayland_client_fd[0]);
+ manager->client = wl_client_create (manager->wayland_display,
+ xwayland_client_fd[0]);
/* We need to run a mainloop until we know xwayland has a binding
* for our xserver interface at which point we can assume it's
@@ -555,6 +552,17 @@ out:
return started;
}
+gboolean
+meta_xwayland_start (MetaXWaylandManager *manager,
+ struct wl_display *wl_display)
+{
+ if (!choose_xdisplay (manager))
+ return FALSE;
+
+ manager->wayland_display = wl_display;
+ return meta_xwayland_init_xserver (manager);
+}
+
static void
on_x11_display_closing (MetaDisplay *display)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]