Commit 7ad1d0d3 authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Adam Jackson
Browse files

xwayland: Allow passing a fd for set up clients

This FD also triggers the "wait for WM_S0" paths, so that the
compositor may set up a "maintenance line" for Xwayland, for
services that are essential to run before any client (eg. xrdb).
Those services would use this FD, disguised as an extra display

This -initfd can be seen as a generalization of -wm, a Wayland
compositor may use -initfd to launch its WM and any other clients
that should start up, or it may use -wm as a dedicated connection for
the WM and optionally use -initfd for the misc. startup clients.

If either of -wm or -initfd is passed, Xwayland will expect a selection
notification on WM_S0 before incorporating the FDs in -listen to the
poll list.

Also, correct a minor typo in the listenfd argument output,
give → given.
Signed-off-by: Carlos Garnacho's avatarCarlos Garnacho <>
parent 78cc8b6f
......@@ -98,11 +98,13 @@ ddxUseMsg(void)
ErrorF("-rootless run rootless, requires wm support\n");
ErrorF("-wm fd create X client for wm on given fd\n");
ErrorF("-listenfd fd add give fd as a listen socket\n");
ErrorF("-initfd fd add given fd as a listen socket for initialization clients\n");
ErrorF("-listenfd fd add given fd as a listen socket\n");
ErrorF("-listen fd deprecated, use \"-listenfd\" instead\n");
ErrorF("-eglstream use eglstream backend for nvidia GPUs\n");
static int init_fd = -1;
static int wm_fd = -1;
static int listen_fds[5] = { -1, -1, -1, -1, -1 };
static int listen_fd_count = 0;
......@@ -148,6 +150,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
wm_fd = atoi(argv[i + 1]);
return 2;
else if (strcmp(argv[i], "-initfd") == 0) {
init_fd = atoi(argv[i + 1]);
return 2;
else if (strcmp(argv[i], "-shm") == 0) {
return 1;
......@@ -1287,10 +1294,14 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv)
if (wm_fd >= 0) {
TimerSet(NULL, 0, 1, add_client_fd, NULL);
if (wm_fd >= 0 || init_fd >= 0) {
if (wm_fd >= 0)
TimerSet(NULL, 0, 1, add_client_fd, NULL);
if (init_fd >= 0)
ListenOnOpenFD(init_fd, FALSE);
AddCallback(&SelectionCallback, wm_selection_callback, NULL);
} else if (listen_fd_count > 0) {
else if (listen_fd_count > 0) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment