aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwayland.c
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-12-29 17:55:16 +0100
committerDominique Martinet <asmadeus@codewreck.org>2017-12-29 19:00:08 +0100
commite0eafa04293496b95f29fdaf42703f1fc1e29e2e (patch)
tree06a0a71af200bfdb7e5e551d37158d50535d3404 /xwayland/xwayland.c
parent58488ec5ce9254334bf3cfef986dfd7deeb62549 (diff)
xwayland: listen to wlr_seat destroy signal
Diffstat (limited to 'xwayland/xwayland.c')
-rw-r--r--xwayland/xwayland.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c
index a0b6d1c3..e181d261 100644
--- a/xwayland/xwayland.c
+++ b/xwayland/xwayland.c
@@ -134,6 +134,7 @@ static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
free(wlr_xwayland->cursor);
}
+ wlr_xwayland_set_seat(wlr_xwayland, NULL);
xwm_destroy(wlr_xwayland->xwm);
if (wlr_xwayland->client) {
@@ -388,11 +389,30 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
wlr_xwayland->cursor->hotspot_y = hotspot_y;
}
+static void wlr_xwayland_handle_seat_destroy(struct wl_listener *listener,
+ void *data) {
+ struct wlr_xwayland *xwayland =
+ wl_container_of(listener, xwayland, seat_destroy);
+
+ wlr_xwayland_set_seat(xwayland, NULL);
+}
+
void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
struct wlr_seat *seat) {
+ if (xwayland->seat) {
+ wl_list_remove(&xwayland->seat_destroy.link);
+ }
+
xwayland->seat = seat;
if (xwayland->xwm) {
xwm_set_seat(xwayland->xwm, seat);
}
+
+ if (seat == NULL) {
+ return;
+ }
+
+ xwayland->seat_destroy.notify = wlr_xwayland_handle_seat_destroy;
+ wl_signal_add(&seat->events.destroy, &xwayland->seat_destroy);
}