aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-10-18 14:52:50 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-11-18 15:35:20 +0000
commitd19191ff6bbcb9c91b1d0f2d7233c46c37d153e7 (patch)
tree7d0d011bc631cb1f2591f8d52dadeac31d128b77 /xwayland
parent3f40b0031f457da6133551f972d0a001d6141121 (diff)
xwayland/server: delay non-lazy startup
This allows users to setup event listeners before the server is actually started.
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/server.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/xwayland/server.c b/xwayland/server.c
index 175a003e..3b34bd57 100644
--- a/xwayland/server.c
+++ b/xwayland/server.c
@@ -426,11 +426,20 @@ static bool server_start_lazy(struct wlr_xwayland_server *server) {
return true;
}
+static void handle_idle(void *data) {
+ struct wlr_xwayland_server *server = data;
+ server->idle_source = NULL;
+ server_start(server);
+}
+
void wlr_xwayland_server_destroy(struct wlr_xwayland_server *server) {
if (!server) {
return;
}
+ if (server->idle_source != NULL) {
+ wl_event_source_remove(server->idle_source);
+ }
server_finish_process(server);
server_finish_display(server);
wl_signal_emit_mutable(&server->events.destroy, NULL);
@@ -475,7 +484,9 @@ struct wlr_xwayland_server *wlr_xwayland_server_create(
goto error_display;
}
} else {
- if (!server_start(server)) {
+ struct wl_event_loop *loop = wl_display_get_event_loop(wl_display);
+ server->idle_source = wl_event_loop_add_idle(loop, handle_idle, server);
+ if (server->idle_source == NULL) {
goto error_display;
}
}