[mutter/wip/lantw/xwayland-Don't-use-abstract-socket-on-non-Linux-systems] xwayland: Don't use abstract socket on non-Linux systems
- From: Ting-Wei Lan <lantw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/lantw/xwayland-Don't-use-abstract-socket-on-non-Linux-systems] xwayland: Don't use abstract socket on non-Linux systems
- Date: Mon, 2 Dec 2019 15:35:48 +0000 (UTC)
commit ddcd775876af00259ecbbe30cac2709d9e3ebd89
Author: Ting-Wei Lan <lantw src gnome org>
Date: Mon Dec 2 23:27:55 2019 +0800
xwayland: Don't use abstract socket on non-Linux systems
Abstract socket is a Linux-only feature. On operating systems other than
Linux, we can only use the normal UNIX socket.
This patch allows mutter to run as a nested Wayland compositor under
Xorg on FreeBSD.
src/wayland/meta-wayland-private.h | 2 ++
src/wayland/meta-xwayland.c | 28 +++++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h
index 9b99674e0..d04df5c5a 100644
--- a/src/wayland/meta-wayland-private.h
+++ b/src/wayland/meta-wayland-private.h
@@ -46,7 +46,9 @@ typedef struct
{
int display_index;
char *lock_file;
+#ifdef __linux__
int abstract_fd;
+#endif
int unix_fd;
guint xserver_grace_period_id;
struct wl_display *wayland_display;
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 4f68bc6d7..264ee0eb2 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -283,6 +283,7 @@ create_lock_file (int display, int *display_out)
return filename;
}
+#ifdef __linux__
static int
bind_to_abstract_socket (int display,
gboolean *fatal)
@@ -322,6 +323,7 @@ bind_to_abstract_socket (int display,
return fd;
}
+#endif
static int
bind_to_unix_socket (int display)
@@ -431,22 +433,31 @@ open_display_sockets (MetaXWaylandManager *manager,
int display_index,
gboolean *fatal)
{
- int abstract_fd, unix_fd;
+#ifdef __linux__
+ int abstract_fd;
+#endif
+ int unix_fd;
+#ifdef __linux__
abstract_fd = bind_to_abstract_socket (display_index,
fatal);
if (abstract_fd < 0)
return FALSE;
+#endif
unix_fd = bind_to_unix_socket (display_index);
if (unix_fd < 0)
{
*fatal = FALSE;
+#ifdef __linux__
close (abstract_fd);
+#endif
return FALSE;
}
+#ifdef __linux__
manager->abstract_fd = abstract_fd;
+#endif
manager->unix_fd = unix_fd;
return TRUE;
@@ -648,9 +659,14 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager)
launcher = g_subprocess_launcher_new (flags);
g_subprocess_launcher_take_fd (launcher, xwayland_client_fd[1], 3);
+#ifdef __linux__
g_subprocess_launcher_take_fd (launcher, manager->abstract_fd, 4);
g_subprocess_launcher_take_fd (launcher, manager->unix_fd, 5);
g_subprocess_launcher_take_fd (launcher, displayfd[1], 6);
+#else
+ g_subprocess_launcher_take_fd (launcher, manager->unix_fd, 4);
+ g_subprocess_launcher_take_fd (launcher, displayfd[1], 5);
+#endif
g_subprocess_launcher_setenv (launcher, "WAYLAND_SOCKET", "3", TRUE);
@@ -661,9 +677,14 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager)
"-accessx",
"-core",
"-auth", manager->auth_file,
+#ifdef __linux__
"-listen", "4",
"-listen", "5",
"-displayfd", "6",
+#else
+ "-listen", "4",
+ "-displayfd", "5",
+#endif
NULL);
if (!manager->proc)
{
@@ -784,8 +805,13 @@ meta_xwayland_init (MetaXWaylandManager *manager,
}
else if (policy == META_DISPLAY_POLICY_ON_DEMAND)
{
+#ifdef __linux__
g_unix_fd_add (manager->abstract_fd, G_IO_IN,
xdisplay_connection_activity_cb, manager);
+#else
+ g_unix_fd_add (manager->unix_fd, G_IO_IN,
+ xdisplay_connection_activity_cb, manager);
+#endif
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]