diff options
author | 2018-12-29 21:50:03 -0500 | |
---|---|---|
committer | 2018-12-30 14:12:36 +0100 | |
commit | 09bb71f6507d86d98b5b9825f28b91ddd4b9a09b (patch) | |
tree | de570ea01b3262c46441afb1f75570a4d44210e8 /sway/input | |
parent | Revamp seat configs (diff) | |
download | sway-09bb71f6507d86d98b5b9825f28b91ddd4b9a09b.tar.gz sway-09bb71f6507d86d98b5b9825f28b91ddd4b9a09b.tar.zst sway-09bb71f6507d86d98b5b9825f28b91ddd4b9a09b.zip |
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.
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 21 |
1 files changed, 13 insertions, 8 deletions
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) { | |||
95 | return false; | 95 | return false; |
96 | } | 96 | } |
97 | 97 | ||
98 | void input_manager_verify_fallback_seat(void) { | ||
99 | struct sway_seat *seat = NULL; | ||
100 | if (!input_has_seat_fallback_configuration()) { | ||
101 | wlr_log(WLR_DEBUG, "no fallback seat config - creating default"); | ||
102 | seat = input_manager_get_default_seat(); | ||
103 | struct seat_config *sc = new_seat_config(seat->wlr_seat->name); | ||
104 | sc->fallback = true; | ||
105 | store_seat_config(sc); | ||
106 | } | ||
107 | } | ||
108 | |||
98 | static void input_manager_libinput_config_keyboard( | 109 | static void input_manager_libinput_config_keyboard( |
99 | struct sway_input_device *input_device) { | 110 | struct sway_input_device *input_device) { |
100 | struct wlr_input_device *wlr_device = input_device->wlr_device; | 111 | 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) { | |||
296 | wl_signal_add(&device->events.destroy, &input_device->device_destroy); | 307 | wl_signal_add(&device->events.destroy, &input_device->device_destroy); |
297 | input_device->device_destroy.notify = handle_device_destroy; | 308 | input_device->device_destroy.notify = handle_device_destroy; |
298 | 309 | ||
299 | struct sway_seat *seat = NULL; | 310 | input_manager_verify_fallback_seat(); |
300 | if (!input_has_seat_fallback_configuration()) { | ||
301 | wlr_log(WLR_DEBUG, "no seat config - creating default seat config"); | ||
302 | seat = input_manager_get_default_seat(); | ||
303 | struct seat_config *sc = new_seat_config(seat->wlr_seat->name); | ||
304 | sc->fallback = true; | ||
305 | store_seat_config(sc); | ||
306 | } | ||
307 | 311 | ||
308 | bool added = false; | 312 | bool added = false; |
313 | struct sway_seat *seat = NULL; | ||
309 | wl_list_for_each(seat, &input->seats, link) { | 314 | wl_list_for_each(seat, &input->seats, link) { |
310 | struct seat_config *seat_config = seat_get_config(seat); | 315 | struct seat_config *seat_config = seat_get_config(seat); |
311 | bool has_attachment = seat_config && | 316 | bool has_attachment = seat_config && |