summaryrefslogtreecommitdiff
path: root/src/wayland/meta-xwayland.c
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-04-01 20:00:59 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2014-04-02 11:41:26 -0400
commita44295599c6b2d18674a581130894a109ea205a5 (patch)
treed84c818a9dfc43e9c0bfeb8da6fb605089e07a09 /src/wayland/meta-xwayland.c
parentaf272f2685e2ef92248155d3ad3db200d956b001 (diff)
downloadmutter-a44295599c6b2d18674a581130894a109ea205a5.tar.gz
xwayland: Split out the code that creates the XWayland sockets
Diffstat (limited to 'src/wayland/meta-xwayland.c')
-rw-r--r--src/wayland/meta-xwayland.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 543e8ffbc..1c3f12df6 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -288,16 +288,11 @@ x_io_error (Display *display)
return 0;
}
-gboolean
-meta_xwayland_start (MetaXWaylandManager *manager,
- struct wl_display *wl_display)
+static gboolean
+choose_xdisplay (MetaXWaylandManager *manager)
{
int display = 0;
char *lockfile = NULL;
- int sp[2];
- pid_t pid;
- char **env;
- char *fd_string;
do
{
@@ -337,6 +332,21 @@ meta_xwayland_start (MetaXWaylandManager *manager,
manager->display_index = display;
manager->lockfile = lockfile;
+ return TRUE;
+}
+
+gboolean
+meta_xwayland_start (MetaXWaylandManager *manager,
+ struct wl_display *wl_display)
+{
+ int sp[2];
+ pid_t pid;
+ char **env;
+ char *fd_string;
+
+ if (!choose_xdisplay (manager))
+ return FALSE;
+
wl_global_create (wl_display, &xserver_interface,
META_XSERVER_VERSION,
manager, bind_xserver);
@@ -346,7 +356,7 @@ meta_xwayland_start (MetaXWaylandManager *manager,
if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sp) < 0)
{
g_warning ("socketpair failed\n");
- unlink (lockfile);
+ unlink (manager->lockfile);
return 1;
}