From c80bf1591e5cea26bd29e1b4b4680d4ef3693833 Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Sun, 6 May 2018 20:23:10 +0200 Subject: Allow xwayland to start lazily Makes the xwayland startup process two phased. The first phase just initialises the X11 sockets. The second phase starts the Xwayland server itself. When starting xwayland lazily the second phase will be postponed until a client has connected to the X11 socket. Changes in behaviour: The DISPLAY environment is now set immediately after the X11 sockets are created. When the Xwayland server is killed or crashes, the sockets will not be recreated, but reused. Fixes #849: Start up Xwayland lazily --- rootston/desktop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rootston') diff --git a/rootston/desktop.c b/rootston/desktop.c index 6ac665bc..06c188d8 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -835,7 +835,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, if (config->xwayland) { desktop->xwayland = wlr_xwayland_create(server->wl_display, - desktop->compositor); + desktop->compositor, false); wl_signal_add(&desktop->xwayland->events.new_surface, &desktop->xwayland_surface); desktop->xwayland_surface.notify = handle_xwayland_surface; -- cgit v1.2.3 From 31861b3a7a2a4f3dc278278dadec60a70138c74e Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Sun, 6 May 2018 22:22:39 +0200 Subject: Add option to rootston to start xwayland lazy --- include/rootston/config.h | 1 + rootston/config.c | 4 ++++ rootston/desktop.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'rootston') diff --git a/include/rootston/config.h b/include/rootston/config.h index 0a67ac1e..97a8baab 100644 --- a/include/rootston/config.h +++ b/include/rootston/config.h @@ -60,6 +60,7 @@ struct roots_cursor_config { struct roots_config { bool xwayland; + bool xwayland_lazy; struct wl_list outputs; struct wl_list devices; diff --git a/rootston/config.c b/rootston/config.c index 67bf83e9..bbdb7990 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -240,6 +240,9 @@ static int config_ini_handler(void *user, const char *section, const char *name, if (strcmp(name, "xwayland") == 0) { if (strcasecmp(value, "true") == 0) { config->xwayland = true; + } else if (strcasecmp(value, "lazy") == 0) { + config->xwayland = true; + config->xwayland_lazy = true; } else if (strcasecmp(value, "false") == 0) { config->xwayland = false; } else { @@ -389,6 +392,7 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) { } config->xwayland = true; + config->xwayland_lazy = false; wl_list_init(&config->outputs); wl_list_init(&config->devices); wl_list_init(&config->keyboards); diff --git a/rootston/desktop.c b/rootston/desktop.c index 06c188d8..7be1c64a 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -835,7 +835,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, if (config->xwayland) { desktop->xwayland = wlr_xwayland_create(server->wl_display, - desktop->compositor, false); + desktop->compositor, config->xwayland_lazy); wl_signal_add(&desktop->xwayland->events.new_surface, &desktop->xwayland_surface); desktop->xwayland_surface.notify = handle_xwayland_surface; -- cgit v1.2.3 From dbf4f9a2312c378b855db68f18b922e73c746887 Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Sun, 6 May 2018 22:51:32 +0200 Subject: Make startup command no longer wait for xwayland --- include/rootston/desktop.h | 1 - rootston/main.c | 31 +++++++++++-------------------- 2 files changed, 11 insertions(+), 21 deletions(-) (limited to 'rootston') diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index f150147b..83ff2ea8 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -65,7 +65,6 @@ struct roots_desktop { #ifdef WLR_HAS_XWAYLAND struct wlr_xwayland *xwayland; struct wl_listener xwayland_surface; - struct wl_listener xwayland_ready; #endif }; diff --git a/rootston/main.c b/rootston/main.c index a61d65c9..18d27a8a 100644 --- a/rootston/main.c +++ b/rootston/main.c @@ -14,18 +14,6 @@ struct roots_server server = { 0 }; -static void ready(struct wl_listener *listener, void *data) { - if (server.config->startup_cmd != NULL) { - const char *cmd = server.config->startup_cmd; - pid_t pid = fork(); - if (pid < 0) { - wlr_log(L_ERROR, "cannot execute binding command: fork() failed"); - } else if (pid == 0) { - execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL); - } - } -} - int main(int argc, char **argv) { wlr_log_init(L_DEBUG, NULL); server.config = roots_config_create_from_args(argc, argv); @@ -65,21 +53,24 @@ int main(int argc, char **argv) { } setenv("WAYLAND_DISPLAY", socket, true); -#ifndef WLR_HAS_XWAYLAND - ready(NULL, NULL); -#else +#ifdef WLR_HAS_XWAYLAND if (server.desktop->xwayland != NULL) { struct roots_seat *xwayland_seat = input_get_seat(server.input, ROOTS_CONFIG_DEFAULT_SEAT_NAME); wlr_xwayland_set_seat(server.desktop->xwayland, xwayland_seat->seat); - wl_signal_add(&server.desktop->xwayland->events.ready, - &server.desktop->xwayland_ready); - server.desktop->xwayland_ready.notify = ready; - } else { - ready(NULL, NULL); } #endif + if (server.config->startup_cmd != NULL) { + const char *cmd = server.config->startup_cmd; + pid_t pid = fork(); + if (pid < 0) { + wlr_log(L_ERROR, "cannot execute binding command: fork() failed"); + } else if (pid == 0) { + execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL); + } + } + wl_display_run(server.wl_display); wl_display_destroy(server.wl_display); return 0; -- cgit v1.2.3 From ef1a24430a5f6d1d3d60c1d506288e3e14f5e077 Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Tue, 8 May 2018 22:43:31 +0200 Subject: Make lazy xwayland start default in rootston --- rootston/config.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rootston') diff --git a/rootston/config.c b/rootston/config.c index bbdb7990..9a4d77fd 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -240,9 +240,9 @@ static int config_ini_handler(void *user, const char *section, const char *name, if (strcmp(name, "xwayland") == 0) { if (strcasecmp(value, "true") == 0) { config->xwayland = true; - } else if (strcasecmp(value, "lazy") == 0) { + } else if (strcasecmp(value, "immediate") == 0) { config->xwayland = true; - config->xwayland_lazy = true; + config->xwayland_lazy = false; } else if (strcasecmp(value, "false") == 0) { config->xwayland = false; } else { @@ -392,7 +392,7 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) { } config->xwayland = true; - config->xwayland_lazy = false; + config->xwayland_lazy = true; wl_list_init(&config->outputs); wl_list_init(&config->devices); wl_list_init(&config->keyboards); -- cgit v1.2.3 From 6936be984fbeca83feae96d92bc8fd1d2b0ec4af Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Tue, 8 May 2018 22:54:45 +0200 Subject: Document xwayland rootston config changes --- rootston/rootston.ini.example | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'rootston') diff --git a/rootston/rootston.ini.example b/rootston/rootston.ini.example index 6f29a35d..556cbefb 100644 --- a/rootston/rootston.ini.example +++ b/rootston/rootston.ini.example @@ -1,5 +1,8 @@ [core] -# Disable X11 support. Enabled by default. +# X11 support +# - true: enables X11, xwayland is started only when an X11 client connects +# - immediate: enables X11, xwayland is started immediately +# - false: disables xwayland xwayland=false # Single output configuration. String after colon must match output's name. -- cgit v1.2.3