diff options
author | emersion <contact@emersion.fr> | 2017-12-29 21:29:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-29 21:29:56 +0100 |
commit | 80ed4d4d20807f021c473b77d44ce6b464afc0c7 (patch) | |
tree | 9842be5bb2107e638fce5e2a2f5f2318df19f453 /rootston | |
parent | c23bd2ab7a020fdbfbb3dd1ee0b3f5c8b5807253 (diff) | |
parent | 6ed1884c84f470707ed5e6b56a92d86b51034625 (diff) |
Merge pull request #541 from martinetd/xwm_fixes
Fix xwayland restart... and add wlr_seat destroy listener.
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/seat.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/rootston/seat.c b/rootston/seat.c index c2c7e3ea..2728ca96 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -220,6 +220,27 @@ static void roots_seat_init_cursor(struct roots_seat *seat) { seat->cursor->request_set_cursor.notify = handle_request_set_cursor; } +static void seat_view_destroy(struct roots_seat_view *seat_view); + +static void roots_seat_handle_seat_destroy(struct wl_listener *listener, + void *data) { + struct roots_seat *seat = + wl_container_of(listener, seat, seat_destroy); + + // TODO: probably more to be freed here + wl_list_remove(&seat->seat_destroy.link); + + struct roots_seat_view *view, *nview; + wl_list_for_each_safe(view, nview, &seat->views, link) { + seat_view_destroy(view); + } +} + +void roots_seat_destroy(struct roots_seat *seat) { + roots_seat_handle_seat_destroy(&seat->seat_destroy, seat->seat); + wlr_seat_destroy(seat->seat); +} + struct roots_seat *roots_seat_create(struct roots_input *input, char *name) { struct roots_seat *seat = calloc(1, sizeof(struct roots_seat)); if (!seat) { @@ -254,11 +275,10 @@ struct roots_seat *roots_seat_create(struct roots_input *input, char *name) { wl_list_insert(&input->seats, &seat->link); - return seat; -} + seat->seat_destroy.notify = roots_seat_handle_seat_destroy; + wl_signal_add(&seat->seat->events.destroy, &seat->seat_destroy); -void roots_seat_destroy(struct roots_seat *seat) { - // TODO + return seat; } static void seat_add_keyboard(struct roots_seat *seat, |