Allow calling xwm_set_seat with a NULL seat
This commit is contained in:
parent
998267e291
commit
b3072f81fe
|
@ -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) {
|
void xwm_set_seat(struct wlr_xwm *xwm, struct wlr_seat *seat) {
|
||||||
assert(xwm);
|
if (xwm->seat != NULL) {
|
||||||
assert(seat);
|
|
||||||
if (xwm->seat) {
|
|
||||||
wl_list_remove(&xwm->seat_selection.link);
|
wl_list_remove(&xwm->seat_selection.link);
|
||||||
wl_list_remove(&xwm->seat_primary_selection.link);
|
wl_list_remove(&xwm->seat_primary_selection.link);
|
||||||
xwm->seat = NULL;
|
xwm->seat = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (seat == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
xwm->seat = seat;
|
xwm->seat = seat;
|
||||||
|
|
||||||
wl_signal_add(&seat->events.selection, &xwm->seat_selection);
|
wl_signal_add(&seat->events.selection, &xwm->seat_selection);
|
||||||
xwm->seat_selection.notify = seat_handle_selection;
|
xwm->seat_selection.notify = seat_handle_selection;
|
||||||
wl_signal_add(&seat->events.primary_selection, &xwm->seat_primary_selection);
|
wl_signal_add(&seat->events.primary_selection, &xwm->seat_primary_selection);
|
||||||
xwm->seat_primary_selection.notify = seat_handle_primary_selection;
|
xwm->seat_primary_selection.notify = seat_handle_primary_selection;
|
||||||
|
|
||||||
seat_handle_selection(&xwm->seat_selection, seat);
|
seat_handle_selection(&xwm->seat_selection, seat);
|
||||||
seat_handle_primary_selection(&xwm->seat_primary_selection, seat);
|
seat_handle_primary_selection(&xwm->seat_primary_selection, seat);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue