diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 10 | ||||
-rw-r--r-- | sway/input/seat.c | 24 |
2 files changed, 31 insertions, 3 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index db82bb4c..5300919a 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -571,6 +571,16 @@ void input_manager_configure_all_inputs(void) { | |||
571 | } | 571 | } |
572 | } | 572 | } |
573 | 573 | ||
574 | void input_manager_configure_all_input_mappings(void) { | ||
575 | struct sway_input_device *input_device; | ||
576 | wl_list_for_each(input_device, &server.input->devices, link) { | ||
577 | struct sway_seat *seat; | ||
578 | wl_list_for_each(seat, &server.input->seats, link) { | ||
579 | seat_configure_device_mapping(seat, input_device); | ||
580 | } | ||
581 | } | ||
582 | } | ||
583 | |||
574 | void input_manager_apply_input_config(struct input_config *input_config) { | 584 | void input_manager_apply_input_config(struct input_config *input_config) { |
575 | struct sway_input_device *input_device = NULL; | 585 | struct sway_input_device *input_device = NULL; |
576 | bool wildcard = strcmp(input_config->identifier, "*") == 0; | 586 | bool wildcard = strcmp(input_config->identifier, "*") == 0; |
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 | ||
847 | static void seat_configure_tablet_tool(struct sway_seat *seat, | 854 | static 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 | ||
858 | static void seat_configure_tablet_pad(struct sway_seat *seat, | 864 | static 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 | |||
922 | void 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 | ||
914 | void seat_reset_device(struct sway_seat *seat, | 932 | void seat_reset_device(struct sway_seat *seat, |