mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
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. https://gitlab.gnome.org/GNOME/mutter/merge_requests/954
This commit is contained in:
parent
aedf692e0c
commit
af0478ae1e
@ -46,7 +46,9 @@ typedef struct
|
|||||||
{
|
{
|
||||||
int display_index;
|
int display_index;
|
||||||
char *lock_file;
|
char *lock_file;
|
||||||
|
#ifdef __linux__
|
||||||
int abstract_fd;
|
int abstract_fd;
|
||||||
|
#endif
|
||||||
int unix_fd;
|
int unix_fd;
|
||||||
char *name;
|
char *name;
|
||||||
} MetaXWaylandConnection;
|
} MetaXWaylandConnection;
|
||||||
|
@ -235,6 +235,7 @@ create_lock_file (int display, int *display_out)
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
static int
|
static int
|
||||||
bind_to_abstract_socket (int display,
|
bind_to_abstract_socket (int display,
|
||||||
gboolean *fatal)
|
gboolean *fatal)
|
||||||
@ -274,6 +275,7 @@ bind_to_abstract_socket (int display,
|
|||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bind_to_unix_socket (int display)
|
bind_to_unix_socket (int display)
|
||||||
@ -381,26 +383,37 @@ meta_xwayland_override_display_number (int number)
|
|||||||
static gboolean
|
static gboolean
|
||||||
open_display_sockets (MetaXWaylandManager *manager,
|
open_display_sockets (MetaXWaylandManager *manager,
|
||||||
int display_index,
|
int display_index,
|
||||||
|
#ifdef __linux__
|
||||||
int *abstract_fd_out,
|
int *abstract_fd_out,
|
||||||
|
#endif
|
||||||
int *unix_fd_out,
|
int *unix_fd_out,
|
||||||
gboolean *fatal)
|
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,
|
abstract_fd = bind_to_abstract_socket (display_index,
|
||||||
fatal);
|
fatal);
|
||||||
if (abstract_fd < 0)
|
if (abstract_fd < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
unix_fd = bind_to_unix_socket (display_index);
|
unix_fd = bind_to_unix_socket (display_index);
|
||||||
if (unix_fd < 0)
|
if (unix_fd < 0)
|
||||||
{
|
{
|
||||||
*fatal = FALSE;
|
*fatal = FALSE;
|
||||||
|
#ifdef __linux__
|
||||||
close (abstract_fd);
|
close (abstract_fd);
|
||||||
|
#endif
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
*abstract_fd_out = abstract_fd;
|
*abstract_fd_out = abstract_fd;
|
||||||
|
#endif
|
||||||
*unix_fd_out = unix_fd;
|
*unix_fd_out = unix_fd;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -429,7 +442,9 @@ choose_xdisplay (MetaXWaylandManager *manager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!open_display_sockets (manager, display,
|
if (!open_display_sockets (manager, display,
|
||||||
|
#ifdef __linux__
|
||||||
&connection->abstract_fd,
|
&connection->abstract_fd,
|
||||||
|
#endif
|
||||||
&connection->unix_fd,
|
&connection->unix_fd,
|
||||||
&fatal))
|
&fatal))
|
||||||
{
|
{
|
||||||
@ -617,10 +632,14 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
|
|||||||
launcher = g_subprocess_launcher_new (flags);
|
launcher = g_subprocess_launcher_new (flags);
|
||||||
|
|
||||||
g_subprocess_launcher_take_fd (launcher, xwayland_client_fd[1], 3);
|
g_subprocess_launcher_take_fd (launcher, xwayland_client_fd[1], 3);
|
||||||
g_subprocess_launcher_take_fd (launcher, manager->public_connection.abstract_fd, 4);
|
g_subprocess_launcher_take_fd (launcher, displayfd[1], 4);
|
||||||
g_subprocess_launcher_take_fd (launcher, manager->public_connection.unix_fd, 5);
|
g_subprocess_launcher_take_fd (launcher, manager->public_connection.unix_fd, 5);
|
||||||
g_subprocess_launcher_take_fd (launcher, displayfd[1], 6);
|
#ifdef __linux__
|
||||||
g_subprocess_launcher_take_fd (launcher, manager->private_connection.abstract_fd, 7);
|
g_subprocess_launcher_take_fd (launcher, manager->private_connection.abstract_fd, 6);
|
||||||
|
g_subprocess_launcher_take_fd (launcher, manager->public_connection.abstract_fd, 7);
|
||||||
|
#else
|
||||||
|
g_subprocess_launcher_take_fd (launcher, manager->private_connection.unix_fd, 6);
|
||||||
|
#endif
|
||||||
|
|
||||||
g_subprocess_launcher_setenv (launcher, "WAYLAND_SOCKET", "3", TRUE);
|
g_subprocess_launcher_setenv (launcher, "WAYLAND_SOCKET", "3", TRUE);
|
||||||
|
|
||||||
@ -632,12 +651,14 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
|
|||||||
"-accessx",
|
"-accessx",
|
||||||
"-core",
|
"-core",
|
||||||
"-auth", manager->auth_file,
|
"-auth", manager->auth_file,
|
||||||
"-listen", "4",
|
"-displayfd", "4",
|
||||||
"-listen", "5",
|
"-listen", "5",
|
||||||
"-displayfd", "6",
|
|
||||||
#ifdef HAVE_XWAYLAND_INITFD
|
#ifdef HAVE_XWAYLAND_INITFD
|
||||||
"-initfd", "7",
|
"-initfd", "6",
|
||||||
#else
|
#else
|
||||||
|
"-listen", "6",
|
||||||
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
"-listen", "7",
|
"-listen", "7",
|
||||||
#endif
|
#endif
|
||||||
NULL);
|
NULL);
|
||||||
@ -756,14 +777,18 @@ meta_xwayland_init (MetaXWaylandManager *manager,
|
|||||||
{
|
{
|
||||||
if (!open_display_sockets (manager,
|
if (!open_display_sockets (manager,
|
||||||
manager->public_connection.display_index,
|
manager->public_connection.display_index,
|
||||||
|
#ifdef __linux__
|
||||||
&manager->public_connection.abstract_fd,
|
&manager->public_connection.abstract_fd,
|
||||||
|
#endif
|
||||||
&manager->public_connection.unix_fd,
|
&manager->public_connection.unix_fd,
|
||||||
&fatal))
|
&fatal))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!open_display_sockets (manager,
|
if (!open_display_sockets (manager,
|
||||||
manager->private_connection.display_index,
|
manager->private_connection.display_index,
|
||||||
|
#ifdef __linux__
|
||||||
&manager->private_connection.abstract_fd,
|
&manager->private_connection.abstract_fd,
|
||||||
|
#endif
|
||||||
&manager->private_connection.unix_fd,
|
&manager->private_connection.unix_fd,
|
||||||
&fatal))
|
&fatal))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -774,8 +799,13 @@ meta_xwayland_init (MetaXWaylandManager *manager,
|
|||||||
|
|
||||||
if (policy == META_DISPLAY_POLICY_ON_DEMAND)
|
if (policy == META_DISPLAY_POLICY_ON_DEMAND)
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
g_unix_fd_add (manager->public_connection.abstract_fd, G_IO_IN,
|
g_unix_fd_add (manager->public_connection.abstract_fd, G_IO_IN,
|
||||||
xdisplay_connection_activity_cb, manager);
|
xdisplay_connection_activity_cb, manager);
|
||||||
|
#else
|
||||||
|
g_unix_fd_add (manager->public_connection.unix_fd, G_IO_IN,
|
||||||
|
xdisplay_connection_activity_cb, manager);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user