aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2023-11-16 14:56:46 +0100
committerLibravatar Kenny Levinsen <kl@kl.wtf>2023-11-16 16:29:07 +0100
commit7036769bea886ab1f9d627785f14cea9e25b16f7 (patch)
tree73df7ae212c8f2587abd9860bcb54be3c831a6fb /sway/input/seat.c
parentinput/seat: rename seat_apply_input_config (diff)
downloadsway-7036769bea886ab1f9d627785f14cea9e25b16f7.tar.gz
sway-7036769bea886ab1f9d627785f14cea9e25b16f7.tar.zst
sway-7036769bea886ab1f9d627785f14cea9e25b16f7.zip
Only reconfigure input mappings on output change
Fully reconfiguring all input devices on output change takes a loooong time. Let's just reconfigure what we need: only mappings depend on outputs.
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index bafdbcf3..f73946b1 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -710,6 +710,15 @@ static void seat_apply_input_mapping(struct sway_seat *seat,
710 struct input_config *ic = 710 struct input_config *ic =
711 input_device_get_config(sway_device->input_device); 711 input_device_get_config(sway_device->input_device);
712 712
713 switch (sway_device->input_device->wlr_device->type) {
714 case WLR_INPUT_DEVICE_POINTER:
715 case WLR_INPUT_DEVICE_TOUCH:
716 case WLR_INPUT_DEVICE_TABLET_TOOL:
717 break;
718 default:
719 return; // these devices don't support mappings
720 }
721
713 sway_log(SWAY_DEBUG, "Applying input mapping to %s", 722 sway_log(SWAY_DEBUG, "Applying input mapping to %s",
714 sway_device->input_device->identifier); 723 sway_device->input_device->identifier);
715 724
@@ -799,7 +808,6 @@ static void seat_configure_pointer(struct sway_seat *seat,
799 } 808 }
800 wlr_cursor_attach_input_device(seat->cursor->cursor, 809 wlr_cursor_attach_input_device(seat->cursor->cursor,
801 sway_device->input_device->wlr_device); 810 sway_device->input_device->wlr_device);
802 seat_apply_input_mapping(seat, sway_device);
803 wl_event_source_timer_update( 811 wl_event_source_timer_update(
804 seat->cursor->hide_source, cursor_get_timeout(seat->cursor)); 812 seat->cursor->hide_source, cursor_get_timeout(seat->cursor));
805} 813}
@@ -841,7 +849,6 @@ static void seat_configure_touch(struct sway_seat *seat,
841 struct sway_seat_device *sway_device) { 849 struct sway_seat_device *sway_device) {
842 wlr_cursor_attach_input_device(seat->cursor->cursor, 850 wlr_cursor_attach_input_device(seat->cursor->cursor,
843 sway_device->input_device->wlr_device); 851 sway_device->input_device->wlr_device);
844 seat_apply_input_mapping(seat, sway_device);
845} 852}
846 853
847static void seat_configure_tablet_tool(struct sway_seat *seat, 854static void seat_configure_tablet_tool(struct sway_seat *seat,
@@ -852,7 +859,6 @@ static void seat_configure_tablet_tool(struct sway_seat *seat,
852 sway_configure_tablet(sway_device->tablet); 859 sway_configure_tablet(sway_device->tablet);
853 wlr_cursor_attach_input_device(seat->cursor->cursor, 860 wlr_cursor_attach_input_device(seat->cursor->cursor,
854 sway_device->input_device->wlr_device); 861 sway_device->input_device->wlr_device);
855 seat_apply_input_mapping(seat, sway_device);
856} 862}
857 863
858static void seat_configure_tablet_pad(struct sway_seat *seat, 864static void seat_configure_tablet_pad(struct sway_seat *seat,
@@ -909,6 +915,18 @@ void seat_configure_device(struct sway_seat *seat,
909 seat_configure_tablet_pad(seat, seat_device); 915 seat_configure_tablet_pad(seat, seat_device);
910 break; 916 break;
911 } 917 }
918
919 seat_apply_input_mapping(seat, seat_device);
920}
921
922void seat_configure_device_mapping(struct sway_seat *seat,
923 struct sway_input_device *input_device) {
924 struct sway_seat_device *seat_device = seat_get_device(seat, input_device);
925 if (!seat_device) {
926 return;
927 }
928
929 seat_apply_input_mapping(seat, seat_device);
912} 930}
913 931
914void seat_reset_device(struct sway_seat *seat, 932void seat_reset_device(struct sway_seat *seat,