From 5766f426aac11bf39234dcca4c479ee865081dad Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Tue, 16 Jan 2018 21:16:04 +0100 Subject: config reload: destroy old seat when removed from config This adds new sway_seat_destroy and sway_cursor_destroy helpers and compare new and old config on free --- sway/input/seat.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sway/input/seat.c') diff --git a/sway/input/seat.c b/sway/input/seat.c index e9b375e0..9ea08eec 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -21,6 +21,16 @@ static void seat_device_destroy(struct sway_seat_device *seat_device) { free(seat_device); } +void sway_seat_destroy(struct sway_seat *seat) { + struct sway_seat_device *seat_device, *next; + wl_list_for_each_safe(seat_device, next, &seat->devices, link) { + seat_device_destroy(seat_device); + } + sway_cursor_destroy(seat->cursor); + wl_list_remove(&seat->link); + wlr_seat_destroy(seat->wlr_seat); +} + struct sway_seat *sway_seat_create(struct sway_input_manager *input, const char *seat_name) { struct sway_seat *seat = calloc(1, sizeof(struct sway_seat)); -- cgit v1.2.3-54-g00ecf