aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-12-29 20:32:01 +0100
committerDominique Martinet <asmadeus@codewreck.org>2017-12-29 20:32:01 +0100
commita477e5d302120805f1d6341c60d218ab9f77fc27 (patch)
tree7ba2556cbae6a80c4ed45f7e052af568b3fe8c5c /rootston
parenta6fb4b007b4cd1abb406acb57efc041fba3d78f7 (diff)
roots_seat_destroy: also destroy seat in public function
Rework the functions a bit so that the handler does the bulk of the work except for destroying the seat itself, and the main public function just explicitely calls the handler and destroys the seat
Diffstat (limited to 'rootston')
-rw-r--r--rootston/seat.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/rootston/seat.c b/rootston/seat.c
index b0bb87e8..2728ca96 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -222,23 +222,23 @@ static void roots_seat_init_cursor(struct roots_seat *seat) {
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;
+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);
}
- // 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);
+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) {