diff options
-rw-r--r-- | include/sway/input/input-manager.h | 4 | ||||
-rw-r--r-- | sway/config/output.c | 9 | ||||
-rw-r--r-- | sway/input/input-manager.c | 25 | ||||
-rw-r--r-- | sway/input/libinput.c | 18 | ||||
-rw-r--r-- | sway/tree/output.c | 5 |
5 files changed, 44 insertions, 17 deletions
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index 5107647d..c9bd08f0 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -44,9 +44,11 @@ void input_manager_configure_xcursor(void); | |||
44 | 44 | ||
45 | void input_manager_apply_input_config(struct input_config *input_config); | 45 | void input_manager_apply_input_config(struct input_config *input_config); |
46 | 46 | ||
47 | void input_manager_configure_all_inputs(void); | ||
48 | |||
47 | void input_manager_reset_input(struct sway_input_device *input_device); | 49 | void input_manager_reset_input(struct sway_input_device *input_device); |
48 | 50 | ||
49 | void input_manager_reset_all_inputs(); | 51 | void input_manager_reset_all_inputs(void); |
50 | 52 | ||
51 | void input_manager_apply_seat_config(struct seat_config *seat_config); | 53 | void input_manager_apply_seat_config(struct seat_config *seat_config); |
52 | 54 | ||
diff --git a/sway/config/output.c b/sway/config/output.c index 713cd219..68aafbe1 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -481,14 +481,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
481 | // Reconfigure all devices, since input config may have been applied before | 481 | // Reconfigure all devices, since input config may have been applied before |
482 | // this output came online, and some config items (like map_to_output) are | 482 | // this output came online, and some config items (like map_to_output) are |
483 | // dependent on an output being present. | 483 | // dependent on an output being present. |
484 | struct sway_input_device *input_device = NULL; | 484 | input_manager_configure_all_inputs(); |
485 | wl_list_for_each(input_device, &server.input->devices, link) { | ||
486 | struct sway_seat *seat = NULL; | ||
487 | wl_list_for_each(seat, &server.input->seats, link) { | ||
488 | seat_configure_device(seat, input_device); | ||
489 | } | ||
490 | } | ||
491 | |||
492 | return true; | 485 | return true; |
493 | } | 486 | } |
494 | 487 | ||
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 | } |
diff --git a/sway/tree/output.c b/sway/tree/output.c index c96c3187..9a10c6a8 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c | |||
@@ -266,6 +266,11 @@ void output_disable(struct sway_output *output) { | |||
266 | output->current_mode = NULL; | 266 | output->current_mode = NULL; |
267 | 267 | ||
268 | arrange_root(); | 268 | arrange_root(); |
269 | |||
270 | // Reconfigure all devices, since devices with map_to_output directives for | ||
271 | // an output that goes offline should stop sending events as long as the | ||
272 | // output remains offline. | ||
273 | input_manager_configure_all_inputs(); | ||
269 | } | 274 | } |
270 | 275 | ||
271 | void output_begin_destroy(struct sway_output *output) { | 276 | void output_begin_destroy(struct sway_output *output) { |