diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/cursor.c | 10 | ||||
-rw-r--r-- | sway/input/input-manager.c | 2 | ||||
-rw-r--r-- | sway/input/seat.c | 10 |
3 files changed, 21 insertions, 1 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index e6a4eca8..73a8ec5c 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -149,6 +149,16 @@ static void handle_request_set_cursor(struct wl_listener *listener, wlr_log(L_DEBUG, "TODO: handle request set cursor event: %p", event); } +void sway_cursor_destroy(struct sway_cursor *cursor) { + if (!cursor) { + return; + } + + wlr_xcursor_manager_destroy(cursor->xcursor_manager); + wlr_cursor_destroy(cursor->cursor); + free(cursor); +} + struct sway_cursor *sway_cursor_create(struct sway_seat *seat) { struct sway_cursor *cursor = calloc(1, sizeof(struct sway_cursor)); if (!sway_assert(cursor, "could not allocate sway cursor")) { diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 2d119cf2..12b3a430 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -23,7 +23,7 @@ struct sway_input_manager *input_manager; struct input_config *current_input_config = NULL; struct seat_config *current_seat_config = NULL; -static struct sway_seat *input_manager_get_seat( +struct sway_seat *input_manager_get_seat( struct sway_input_manager *input, const char *seat_name) { struct sway_seat *seat = NULL; wl_list_for_each(seat, &input->seats, link) { 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)); |