]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwayland: (Re)set seat when xwayland is ready
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 21 Jul 2022 00:47:20 +0000 (02:47 +0200)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 21 Jul 2022 01:57:42 +0000 (03:57 +0200)
For some reason wlroots will reset the seat assigned to xwayland
to NULL whenever Xwayland terminates. This patch restores the seat
whenever Xwayland is ready again.

Fixes #166
Fixes #444

Thanks @droc12345 for figuring out the actual issue.

include/labwc.h
src/server.c

index cae25f31901764791f9edd1779e4e5aa489a1746..fd738c150fd80b31fb8d294ab263516d494862fd 100644 (file)
@@ -165,6 +165,7 @@ struct server {
        struct wl_listener xdg_toplevel_decoration;
 #if HAVE_XWAYLAND
        struct wlr_xwayland *xwayland;
+       struct wl_listener xwayland_ready;
        struct wl_listener new_xwayland_surface;
 #endif
 
index 857d3e49235b26f0c44458ccea312925f826c302..f2f684982f4ca07f69a4168d1ba6937824b44e20 100644 (file)
@@ -174,6 +174,16 @@ handle_drm_lease_request(struct wl_listener *listener, void *data)
        }
 }
 
+#if HAVE_XWAYLAND
+static void
+handle_xwayland_ready(struct wl_listener *listener, void *data)
+{
+       struct server *server =
+               wl_container_of(listener, server, xwayland_ready);
+       wlr_xwayland_set_seat(server->xwayland, server->seat.seat);
+}
+#endif
+
 void
 server_init(struct server *server)
 {
@@ -403,6 +413,10 @@ server_init(struct server *server)
        wl_signal_add(&server->xwayland->events.new_surface,
                      &server->new_xwayland_surface);
 
+       server->xwayland_ready.notify = handle_xwayland_ready;
+       wl_signal_add(&server->xwayland->events.ready,
+               &server->xwayland_ready);
+
        if (setenv("DISPLAY", server->xwayland->display_name, true) < 0) {
                wlr_log_errno(WLR_ERROR, "unable to set DISPLAY for xwayland");
        } else {
@@ -457,10 +471,6 @@ server_start(struct server *server)
        } else {
                wlr_log(WLR_DEBUG, "WAYLAND_DISPLAY=%s", socket);
        }
-
-#if HAVE_XWAYLAND
-       wlr_xwayland_set_seat(server->xwayland, server->seat.seat);
-#endif
 }
 
 void