aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2020-04-20 17:52:52 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2020-04-24 18:51:22 +0200
commit3de1a3958eb43521fe5d8e3773b9a1141efb18cb (patch)
tree03d229aea457c85ef6940939489d6ab6488ce40c
parentTake window borders into account when resizing floating windows (diff)
downloadsway-3de1a3958eb43521fe5d8e3773b9a1141efb18cb.tar.gz
sway-3de1a3958eb43521fe5d8e3773b9a1141efb18cb.tar.zst
sway-3de1a3958eb43521fe5d8e3773b9a1141efb18cb.zip
config/output: reconfigure input devices on new output
Some input rules, like `map_to_output`, are dependent on a specific screen being present. This currently does not work for hotplugged outputs, or outputs that are processed after the input device is initially probed. This commit fixes both cases, by reconfiguring inputs on each output addition. Fixes #5231.
-rw-r--r--sway/config/output.c11
-rw-r--r--sway/input/seat.c4
2 files changed, 14 insertions, 1 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index 19b9989a..9720bbf3 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -388,6 +388,17 @@ static void queue_output_config(struct output_config *oc,
388 oc->adaptive_sync); 388 oc->adaptive_sync);
389 wlr_output_enable_adaptive_sync(wlr_output, oc->adaptive_sync == 1); 389 wlr_output_enable_adaptive_sync(wlr_output, oc->adaptive_sync == 1);
390 } 390 }
391
392 // Reconfigure all devices, since input config may have been applied before
393 // this output came online, and some config items (like map_to_output) are
394 // dependent on an output being present.
395 struct sway_input_device *input_device = NULL;
396 wl_list_for_each(input_device, &server.input->devices, link) {
397 struct sway_seat *seat = NULL;
398 wl_list_for_each(seat, &server.input->seats, link) {
399 seat_configure_device(seat, input_device);
400 }
401 }
391} 402}
392 403
393bool apply_output_config(struct output_config *oc, struct sway_output *output) { 404bool apply_output_config(struct output_config *oc, struct sway_output *output) {
diff --git a/sway/input/seat.c b/sway/input/seat.c
index b0e39612..36593806 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -652,6 +652,8 @@ static void seat_apply_input_config(struct sway_seat *seat,
652 } 652 }
653 struct sway_output *output = output_by_name_or_id(mapped_to_output); 653 struct sway_output *output = output_by_name_or_id(mapped_to_output);
654 if (!output) { 654 if (!output) {
655 sway_log(SWAY_DEBUG, "Requested output %s for device %s isn't present",
656 mapped_to_output, sway_device->input_device->identifier);
655 return; 657 return;
656 } 658 }
657 wlr_cursor_map_input_to_output(seat->cursor->cursor, 659 wlr_cursor_map_input_to_output(seat->cursor->cursor,
@@ -701,7 +703,7 @@ static void seat_configure_keyboard(struct sway_seat *seat,
701} 703}
702 704
703static void seat_configure_switch(struct sway_seat *seat, 705static void seat_configure_switch(struct sway_seat *seat,
704 struct sway_seat_device *seat_device) { 706 struct sway_seat_device *seat_device) {
705 if (!seat_device->switch_device) { 707 if (!seat_device->switch_device) {
706 sway_switch_create(seat, seat_device); 708 sway_switch_create(seat, seat_device);
707 } 709 }