Commit 967c60dd authored by Carlos Garnacho's avatar Carlos Garnacho

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
connection.

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 <carlosg@gnome.org>
parent a0269727
Pipeline #51498 passed with stages
in 5 minutes and 52 seconds
...@@ -98,11 +98,13 @@ ddxUseMsg(void) ...@@ -98,11 +98,13 @@ ddxUseMsg(void)
{ {
ErrorF("-rootless run rootless, requires wm support\n"); ErrorF("-rootless run rootless, requires wm support\n");
ErrorF("-wm fd create X client for wm on given fd\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("-listen fd deprecated, use \"-listenfd\" instead\n");
ErrorF("-eglstream use eglstream backend for nvidia GPUs\n"); ErrorF("-eglstream use eglstream backend for nvidia GPUs\n");
} }
static int init_fd = -1;
static int wm_fd = -1; static int wm_fd = -1;
static int listen_fds[5] = { -1, -1, -1, -1, -1 }; static int listen_fds[5] = { -1, -1, -1, -1, -1 };
static int listen_fd_count = 0; static int listen_fd_count = 0;
...@@ -148,6 +150,11 @@ ddxProcessArgument(int argc, char *argv[], int i) ...@@ -148,6 +150,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
wm_fd = atoi(argv[i + 1]); wm_fd = atoi(argv[i + 1]);
return 2; return 2;
} }
else if (strcmp(argv[i], "-initfd") == 0) {
CHECK_FOR_REQUIRED_ARGUMENTS(1);
init_fd = atoi(argv[i + 1]);
return 2;
}
else if (strcmp(argv[i], "-shm") == 0) { else if (strcmp(argv[i], "-shm") == 0) {
return 1; return 1;
} }
...@@ -1194,10 +1201,14 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv) ...@@ -1194,10 +1201,14 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv)
LocalAccessScopeUser(); LocalAccessScopeUser();
if (wm_fd >= 0) { if (wm_fd >= 0 || init_fd >= 0) {
TimerSet(NULL, 0, 1, add_client_fd, NULL); 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); AddCallback(&SelectionCallback, wm_selection_callback, NULL);
} else if (listen_fd_count > 0) { }
else if (listen_fd_count > 0) {
listen_on_fds(); listen_on_fds();
} }
} }
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