aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-27 11:49:25 +0100
committeremersion <contact@emersion.fr>2017-12-27 11:49:25 +0100
commitb3072f81fe609913655f0c6b11f3023c45aed754 (patch)
treeace51a6ba83dfef849548b4a95d50bf9d45e5468 /xwayland
parent998267e2919ba9d41172350ca40d51ff7b700dec (diff)
Allow calling xwm_set_seat with a NULL seat
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/selection.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/xwayland/selection.c b/xwayland/selection.c
index ecc64f2d..0646dbef 100644
--- a/xwayland/selection.c
+++ b/xwayland/selection.c
@@ -854,19 +854,23 @@ static void seat_handle_primary_selection(struct wl_listener *listener,
}
void xwm_set_seat(struct wlr_xwm *xwm, struct wlr_seat *seat) {
- assert(xwm);
- assert(seat);
- if (xwm->seat) {
+ if (xwm->seat != NULL) {
wl_list_remove(&xwm->seat_selection.link);
wl_list_remove(&xwm->seat_primary_selection.link);
xwm->seat = NULL;
}
+ if (seat == NULL) {
+ return;
+ }
+
xwm->seat = seat;
+
wl_signal_add(&seat->events.selection, &xwm->seat_selection);
xwm->seat_selection.notify = seat_handle_selection;
wl_signal_add(&seat->events.primary_selection, &xwm->seat_primary_selection);
xwm->seat_primary_selection.notify = seat_handle_primary_selection;
+
seat_handle_selection(&xwm->seat_selection, seat);
seat_handle_primary_selection(&xwm->seat_primary_selection, seat);
}