aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/input-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/input-manager.c')
-rw-r--r--sway/input/input-manager.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 89146d5b..055f6752 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -82,11 +82,12 @@ static struct sway_input_device *input_sway_device_from_wlr(
82 return NULL; 82 return NULL;
83} 83}
84 84
85static bool input_has_seat_configuration(void) { 85static bool input_has_seat_fallback_configuration(void) {
86 struct sway_seat *seat = NULL; 86 struct sway_seat *seat = NULL;
87 wl_list_for_each(seat, &server.input->seats, link) { 87 wl_list_for_each(seat, &server.input->seats, link) {
88 struct seat_config *seat_config = seat_get_config(seat); 88 struct seat_config *seat_config = seat_get_config(seat);
89 if (seat_config) { 89 if (seat_config && strcmp(seat_config->name, "*") != 0
90 && seat_config->fallback != -1) {
90 return true; 91 return true;
91 } 92 }
92 } 93 }
@@ -296,11 +297,12 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
296 input_device->device_destroy.notify = handle_device_destroy; 297 input_device->device_destroy.notify = handle_device_destroy;
297 298
298 struct sway_seat *seat = NULL; 299 struct sway_seat *seat = NULL;
299 if (!input_has_seat_configuration()) { 300 if (!input_has_seat_fallback_configuration()) {
300 wlr_log(WLR_DEBUG, "no seat configuration, using default seat"); 301 wlr_log(WLR_DEBUG, "no seat config - creating default seat config");
301 seat = input_manager_get_default_seat(); 302 seat = input_manager_get_default_seat();
302 seat_add_device(seat, input_device); 303 struct seat_config *sc = new_seat_config(seat->wlr_seat->name);
303 return; 304 sc->fallback = true;
305 store_seat_config(sc);
304 } 306 }
305 307
306 bool added = false; 308 bool added = false;
@@ -459,15 +461,26 @@ void input_manager_apply_input_config(struct input_config *input_config) {
459} 461}
460 462
461void input_manager_apply_seat_config(struct seat_config *seat_config) { 463void input_manager_apply_seat_config(struct seat_config *seat_config) {
462 wlr_log(WLR_DEBUG, "applying new seat config for seat %s", 464 wlr_log(WLR_DEBUG, "applying seat config for seat %s", seat_config->name);
463 seat_config->name); 465 if (strcmp(seat_config->name, "*") == 0) {
464 struct sway_seat *seat = input_manager_get_seat(seat_config->name); 466 struct sway_seat *seat = NULL;
465 if (!seat) { 467 wl_list_for_each(seat, &server.input->seats, link) {
466 return; 468 // Only apply the wildcard config directly if there is no seat
469 // specific config
470 struct seat_config *sc = seat_get_config(seat);
471 if (!sc) {
472 sc = seat_config;
473 }
474 seat_apply_config(seat, sc);
475 }
476 } else {
477 struct sway_seat *seat = input_manager_get_seat(seat_config->name);
478 if (!seat) {
479 return;
480 }
481 seat_apply_config(seat, seat_config);
467 } 482 }
468 483
469 seat_apply_config(seat, seat_config);
470
471 // for every device, try to add it to a seat and if no seat has it 484 // for every device, try to add it to a seat and if no seat has it
472 // attached, add it to the fallback seats. 485 // attached, add it to the fallback seats.
473 struct sway_input_device *input_device = NULL; 486 struct sway_input_device *input_device = NULL;