From 09bb71f6507d86d98b5b9825f28b91ddd4b9a09b Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Sat, 29 Dec 2018 21:50:03 -0500 Subject: Verify seat fallback settings on reload This fixes an issue where on reload, all input devices that were added via an implicit fallback to the default seat would be removed from the default seat and applications would crash due to the seat having no capabilities. On reload, there is a query for a seat config with the fallback setting set (it can either be true or false). If no such seat config exists, the default seat is created (if needed) and has the implicit fallback true applied to its seat config. This is the same procedure that occurs when a new input is detected. --- sway/input/input-manager.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'sway/input/input-manager.c') diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 055f6752..9aaeb4d6 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -95,6 +95,17 @@ static bool input_has_seat_fallback_configuration(void) { return false; } +void input_manager_verify_fallback_seat(void) { + struct sway_seat *seat = NULL; + if (!input_has_seat_fallback_configuration()) { + wlr_log(WLR_DEBUG, "no fallback seat config - creating default"); + seat = input_manager_get_default_seat(); + struct seat_config *sc = new_seat_config(seat->wlr_seat->name); + sc->fallback = true; + store_seat_config(sc); + } +} + static void input_manager_libinput_config_keyboard( struct sway_input_device *input_device) { struct wlr_input_device *wlr_device = input_device->wlr_device; @@ -296,16 +307,10 @@ static void handle_new_input(struct wl_listener *listener, void *data) { wl_signal_add(&device->events.destroy, &input_device->device_destroy); input_device->device_destroy.notify = handle_device_destroy; - struct sway_seat *seat = NULL; - if (!input_has_seat_fallback_configuration()) { - wlr_log(WLR_DEBUG, "no seat config - creating default seat config"); - seat = input_manager_get_default_seat(); - struct seat_config *sc = new_seat_config(seat->wlr_seat->name); - sc->fallback = true; - store_seat_config(sc); - } + input_manager_verify_fallback_seat(); bool added = false; + struct sway_seat *seat = NULL; wl_list_for_each(seat, &input->seats, link) { struct seat_config *seat_config = seat_get_config(seat); bool has_attachment = seat_config && -- cgit v1.2.3-54-g00ecf