diff options
-rw-r--r-- | include/sway/input/input-manager.h | 6 | ||||
-rw-r--r-- | sway/config.c | 1 | ||||
-rw-r--r-- | sway/input/input-manager.c | 21 |
3 files changed, 20 insertions, 8 deletions
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index 219aa9ba..08e749dc 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -44,6 +44,12 @@ struct sway_seat *input_manager_get_default_seat(void); | |||
44 | struct sway_seat *input_manager_get_seat(const char *seat_name); | 44 | struct sway_seat *input_manager_get_seat(const char *seat_name); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * If none of the seat configs have a fallback setting (either true or false), | ||
48 | * create the default seat (if needed) and set it as the fallback | ||
49 | */ | ||
50 | void input_manager_verify_fallback_seat(void); | ||
51 | |||
52 | /** | ||
47 | * Gets the last seat the user interacted with | 53 | * Gets the last seat the user interacted with |
48 | */ | 54 | */ |
49 | struct sway_seat *input_manager_current_seat(void); | 55 | struct sway_seat *input_manager_current_seat(void); |
diff --git a/sway/config.c b/sway/config.c index bb18c739..303774b4 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -465,6 +465,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
465 | if (config->swaynag_config_errors.pid > 0) { | 465 | if (config->swaynag_config_errors.pid > 0) { |
466 | swaynag_show(&config->swaynag_config_errors); | 466 | swaynag_show(&config->swaynag_config_errors); |
467 | } | 467 | } |
468 | input_manager_verify_fallback_seat(); | ||
468 | } | 469 | } |
469 | 470 | ||
470 | if (old_config) { | 471 | if (old_config) { |
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 && |