aboutsummaryrefslogtreecommitdiff
path: root/rootston/seat.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-03-13 12:31:45 +0100
committeremersion <contact@emersion.fr>2018-03-13 12:31:45 +0100
commitc1c88bfe5d88b7f6330f5ce5be04ef6951123c3d (patch)
treedf3b329786c17d1f9b74618459179950ea13a59a /rootston/seat.c
parent42637a52cf2779ec05f0fdb97df416e21438a77b (diff)
rootston: destroy seat view on unmap
Diffstat (limited to 'rootston/seat.c')
-rw-r--r--rootston/seat.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/rootston/seat.c b/rootston/seat.c
index 9acbb737..c4535c7c 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -645,6 +645,7 @@ static void seat_view_destroy(struct roots_seat_view *seat_view) {
seat->cursor->pointer_view = NULL;
}
+ wl_list_remove(&seat_view->view_unmap.link);
wl_list_remove(&seat_view->view_destroy.link);
wl_list_remove(&seat_view->link);
free(seat_view);
@@ -657,6 +658,12 @@ static void seat_view_destroy(struct roots_seat_view *seat_view) {
}
}
+static void seat_view_handle_unmap(struct wl_listener *listener, void *data) {
+ struct roots_seat_view *seat_view =
+ wl_container_of(listener, seat_view, view_unmap);
+ seat_view_destroy(seat_view);
+}
+
static void seat_view_handle_destroy(struct wl_listener *listener, void *data) {
struct roots_seat_view *seat_view =
wl_container_of(listener, seat_view, view_destroy);
@@ -675,6 +682,8 @@ static struct roots_seat_view *seat_add_view(struct roots_seat *seat,
wl_list_insert(seat->views.prev, &seat_view->link);
+ seat_view->view_unmap.notify = seat_view_handle_unmap;
+ wl_signal_add(&view->events.unmap, &seat_view->view_unmap);
seat_view->view_destroy.notify = seat_view_handle_destroy;
wl_signal_add(&view->events.destroy, &seat_view->view_destroy);