aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-05-08 23:04:26 +0100
committerGitHub <noreply@github.com>2018-05-08 23:04:26 +0100
commit8e831cd416e2eb0c47bbd097422822a0c8888459 (patch)
treed4e8efe946a18a6940ecfb7471a7fa203a5f6124 /rootston
parentc5c5747060312817c025eab5cdcec8508232dde1 (diff)
parent6936be984fbeca83feae96d92bc8fd1d2b0ec4af (diff)
Merge pull request #959 from VincentVanlaer/xwayland-lazy
Add the option to start Xwayland only when a client connects
Diffstat (limited to 'rootston')
-rw-r--r--rootston/config.c4
-rw-r--r--rootston/desktop.c2
-rw-r--r--rootston/main.c31
-rw-r--r--rootston/rootston.ini.example5
4 files changed, 20 insertions, 22 deletions
diff --git a/rootston/config.c b/rootston/config.c
index 67bf83e9..9a4d77fd 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, "immediate") == 0) {
+ config->xwayland = true;
+ config->xwayland_lazy = false;
} 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 = true;
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 192c7da0..178a975a 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -822,7 +822,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, config->xwayland_lazy);
wl_signal_add(&desktop->xwayland->events.new_surface,
&desktop->xwayland_surface);
desktop->xwayland_surface.notify = handle_xwayland_surface;
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;
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.