aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-12-29 19:00:51 +0100
committerDominique Martinet <asmadeus@codewreck.org>2017-12-29 19:00:51 +0100
commit689004ff211d4c20ad0b802af14add6a9a761362 (patch)
treeb0ab32271a9021c38c6b83842e615e889629c1a1 /rootston
parente0eafa04293496b95f29fdaf42703f1fc1e29e2e (diff)
rootston seat: implement part of roots_seat_destroy
... and have it listen to seat destroy notifier
Diffstat (limited to 'rootston')
-rw-r--r--rootston/seat.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/rootston/seat.c b/rootston/seat.c
index c2c7e3ea..b0bb87e8 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);
+
+void roots_seat_destroy(struct roots_seat *seat) {
+ struct roots_seat_view *view, *nview;
+
+ // TODO: probably more to be freed here
+
+ wl_list_for_each_safe(view, nview, &seat->views, link) {
+ seat_view_destroy(view);
+ }
+ // Can be called from seat_destroy handler, so don't destroy seat
+}
+
+static void roots_seat_handle_seat_destroy(struct wl_listener *listener,
+ void *data) {
+ struct roots_seat *seat =
+ wl_container_of(listener, seat, seat_destroy);
+
+ roots_seat_destroy(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,