diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 25 | ||||
-rw-r--r-- | sway/input/libinput.c | 18 |
2 files changed, 35 insertions, 8 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index b900f666..69342c73 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -521,6 +521,22 @@ static void retranslate_keysyms(struct input_config *input_config) { | |||
521 | } | 521 | } |
522 | } | 522 | } |
523 | 523 | ||
524 | static void input_manager_configure_input( | ||
525 | struct sway_input_device *input_device) { | ||
526 | sway_input_configure_libinput_device(input_device); | ||
527 | struct sway_seat *seat = NULL; | ||
528 | wl_list_for_each(seat, &server.input->seats, link) { | ||
529 | seat_configure_device(seat, input_device); | ||
530 | } | ||
531 | } | ||
532 | |||
533 | void input_manager_configure_all_inputs(void) { | ||
534 | struct sway_input_device *input_device = NULL; | ||
535 | wl_list_for_each(input_device, &server.input->devices, link) { | ||
536 | input_manager_configure_input(input_device); | ||
537 | } | ||
538 | } | ||
539 | |||
524 | void input_manager_apply_input_config(struct input_config *input_config) { | 540 | void input_manager_apply_input_config(struct input_config *input_config) { |
525 | struct sway_input_device *input_device = NULL; | 541 | struct sway_input_device *input_device = NULL; |
526 | bool wildcard = strcmp(input_config->identifier, "*") == 0; | 542 | bool wildcard = strcmp(input_config->identifier, "*") == 0; |
@@ -531,11 +547,7 @@ void input_manager_apply_input_config(struct input_config *input_config) { | |||
531 | if (strcmp(input_device->identifier, input_config->identifier) == 0 | 547 | if (strcmp(input_device->identifier, input_config->identifier) == 0 |
532 | || wildcard | 548 | || wildcard |
533 | || type_matches) { | 549 | || type_matches) { |
534 | sway_input_configure_libinput_device(input_device); | 550 | input_manager_configure_input(input_device); |
535 | struct sway_seat *seat = NULL; | ||
536 | wl_list_for_each(seat, &server.input->seats, link) { | ||
537 | seat_configure_device(seat, input_device); | ||
538 | } | ||
539 | } | 551 | } |
540 | } | 552 | } |
541 | 553 | ||
@@ -550,7 +562,7 @@ void input_manager_reset_input(struct sway_input_device *input_device) { | |||
550 | } | 562 | } |
551 | } | 563 | } |
552 | 564 | ||
553 | void input_manager_reset_all_inputs() { | 565 | void input_manager_reset_all_inputs(void) { |
554 | struct sway_input_device *input_device = NULL; | 566 | struct sway_input_device *input_device = NULL; |
555 | wl_list_for_each(input_device, &server.input->devices, link) { | 567 | wl_list_for_each(input_device, &server.input->devices, link) { |
556 | input_manager_reset_input(input_device); | 568 | input_manager_reset_input(input_device); |
@@ -568,7 +580,6 @@ void input_manager_reset_all_inputs() { | |||
568 | } | 580 | } |
569 | } | 581 | } |
570 | 582 | ||
571 | |||
572 | void input_manager_apply_seat_config(struct seat_config *seat_config) { | 583 | void input_manager_apply_seat_config(struct seat_config *seat_config) { |
573 | sway_log(SWAY_DEBUG, "applying seat config for seat %s", seat_config->name); | 584 | sway_log(SWAY_DEBUG, "applying seat config for seat %s", seat_config->name); |
574 | if (strcmp(seat_config->name, "*") == 0) { | 585 | if (strcmp(seat_config->name, "*") == 0) { |
diff --git a/sway/input/libinput.c b/sway/input/libinput.c index caaba5a1..4ec72882 100644 --- a/sway/input/libinput.c +++ b/sway/input/libinput.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <wlr/backend/libinput.h> | 4 | #include <wlr/backend/libinput.h> |
5 | #include "log.h" | 5 | #include "log.h" |
6 | #include "sway/config.h" | 6 | #include "sway/config.h" |
7 | #include "sway/output.h" | ||
7 | #include "sway/input/input-manager.h" | 8 | #include "sway/input/input-manager.h" |
8 | #include "sway/ipc-server.h" | 9 | #include "sway/ipc-server.h" |
9 | 10 | ||
@@ -190,9 +191,24 @@ static bool config_libinput_pointer(struct libinput_device *device, | |||
190 | sway_log(SWAY_DEBUG, "config_libinput_pointer('%s' on '%s')", | 191 | sway_log(SWAY_DEBUG, "config_libinput_pointer('%s' on '%s')", |
191 | ic->identifier, device_id); | 192 | ic->identifier, device_id); |
192 | bool changed = false; | 193 | bool changed = false; |
193 | if (ic->send_events != INT_MIN) { | 194 | |
195 | if (ic->mapped_to_output && | ||
196 | !output_by_name_or_id(ic->mapped_to_output)) { | ||
197 | sway_log(SWAY_DEBUG, | ||
198 | "Pointer '%s' is mapped to offline output '%s'; disabling input", | ||
199 | ic->identifier, ic->mapped_to_output); | ||
200 | changed |= set_send_events(device, | ||
201 | LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); | ||
202 | } else if (ic->send_events != INT_MIN) { | ||
194 | changed |= set_send_events(device, ic->send_events); | 203 | changed |= set_send_events(device, ic->send_events); |
204 | } else { | ||
205 | // Have to reset to the default mode here, otherwise if ic->send_events | ||
206 | // is unset and a mapped output just came online after being disabled, | ||
207 | // we'd remain stuck sending no events. | ||
208 | changed |= set_send_events(device, | ||
209 | libinput_device_config_send_events_get_default_mode(device)); | ||
195 | } | 210 | } |
211 | |||
196 | if (ic->tap != INT_MIN) { | 212 | if (ic->tap != INT_MIN) { |
197 | changed |= set_tap(device, ic->tap); | 213 | changed |= set_tap(device, ic->tap); |
198 | } | 214 | } |