diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 20 | ||||
-rw-r--r-- | sway/input/seat.c | 6 | ||||
-rw-r--r-- | sway/input/tablet.c | 10 |
3 files changed, 34 insertions, 2 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 26eefc8a..634d8981 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <math.h> | 5 | #include <math.h> |
6 | #include <wlr/backend/libinput.h> | 6 | #include <wlr/config.h> |
7 | #include <wlr/types/wlr_cursor.h> | 7 | #include <wlr/types/wlr_cursor.h> |
8 | #include <wlr/types/wlr_keyboard_group.h> | 8 | #include <wlr/types/wlr_keyboard_group.h> |
9 | #include <wlr/types/wlr_input_inhibitor.h> | 9 | #include <wlr/types/wlr_input_inhibitor.h> |
@@ -22,6 +22,10 @@ | |||
22 | #include "list.h" | 22 | #include "list.h" |
23 | #include "log.h" | 23 | #include "log.h" |
24 | 24 | ||
25 | #if WLR_HAS_LIBINPUT_BACKEND | ||
26 | #include <wlr/backend/libinput.h> | ||
27 | #endif | ||
28 | |||
25 | #define DEFAULT_SEAT "seat0" | 29 | #define DEFAULT_SEAT "seat0" |
26 | 30 | ||
27 | struct input_config *current_input_config = NULL; | 31 | struct input_config *current_input_config = NULL; |
@@ -90,6 +94,7 @@ char *input_device_get_identifier(struct wlr_input_device *device) { | |||
90 | } | 94 | } |
91 | 95 | ||
92 | static bool device_is_touchpad(struct sway_input_device *device) { | 96 | static bool device_is_touchpad(struct sway_input_device *device) { |
97 | #if WLR_HAS_LIBINPUT_BACKEND | ||
93 | if (device->wlr_device->type != WLR_INPUT_DEVICE_POINTER || | 98 | if (device->wlr_device->type != WLR_INPUT_DEVICE_POINTER || |
94 | !wlr_input_device_is_libinput(device->wlr_device)) { | 99 | !wlr_input_device_is_libinput(device->wlr_device)) { |
95 | return false; | 100 | return false; |
@@ -99,6 +104,9 @@ static bool device_is_touchpad(struct sway_input_device *device) { | |||
99 | wlr_libinput_get_device_handle(device->wlr_device); | 104 | wlr_libinput_get_device_handle(device->wlr_device); |
100 | 105 | ||
101 | return libinput_device_config_tap_get_finger_count(libinput_device) > 0; | 106 | return libinput_device_config_tap_get_finger_count(libinput_device) > 0; |
107 | #else | ||
108 | return false; | ||
109 | #endif | ||
102 | } | 110 | } |
103 | 111 | ||
104 | const char *input_device_get_type(struct sway_input_device *device) { | 112 | const char *input_device_get_type(struct sway_input_device *device) { |
@@ -236,7 +244,11 @@ static void handle_new_input(struct wl_listener *listener, void *data) { | |||
236 | 244 | ||
237 | apply_input_type_config(input_device); | 245 | apply_input_type_config(input_device); |
238 | 246 | ||
247 | #if WLR_HAS_LIBINPUT_BACKEND | ||
239 | bool config_changed = sway_input_configure_libinput_device(input_device); | 248 | bool config_changed = sway_input_configure_libinput_device(input_device); |
249 | #else | ||
250 | bool config_changed = false; | ||
251 | #endif | ||
240 | 252 | ||
241 | wl_signal_add(&device->events.destroy, &input_device->device_destroy); | 253 | wl_signal_add(&device->events.destroy, &input_device->device_destroy); |
242 | input_device->device_destroy.notify = handle_device_destroy; | 254 | input_device->device_destroy.notify = handle_device_destroy; |
@@ -532,7 +544,11 @@ static void retranslate_keysyms(struct input_config *input_config) { | |||
532 | 544 | ||
533 | static void input_manager_configure_input( | 545 | static void input_manager_configure_input( |
534 | struct sway_input_device *input_device) { | 546 | struct sway_input_device *input_device) { |
547 | #if WLR_HAS_LIBINPUT_BACKEND | ||
535 | bool config_changed = sway_input_configure_libinput_device(input_device); | 548 | bool config_changed = sway_input_configure_libinput_device(input_device); |
549 | #else | ||
550 | bool config_changed = false; | ||
551 | #endif | ||
536 | struct sway_seat *seat = NULL; | 552 | struct sway_seat *seat = NULL; |
537 | wl_list_for_each(seat, &server.input->seats, link) { | 553 | wl_list_for_each(seat, &server.input->seats, link) { |
538 | seat_configure_device(seat, input_device); | 554 | seat_configure_device(seat, input_device); |
@@ -567,7 +583,9 @@ void input_manager_apply_input_config(struct input_config *input_config) { | |||
567 | } | 583 | } |
568 | 584 | ||
569 | void input_manager_reset_input(struct sway_input_device *input_device) { | 585 | void input_manager_reset_input(struct sway_input_device *input_device) { |
586 | #if WLR_HAS_LIBINPUT_BACKEND | ||
570 | sway_input_reset_libinput_device(input_device); | 587 | sway_input_reset_libinput_device(input_device); |
588 | #endif | ||
571 | struct sway_seat *seat = NULL; | 589 | struct sway_seat *seat = NULL; |
572 | wl_list_for_each(seat, &server.input->seats, link) { | 590 | wl_list_for_each(seat, &server.input->seats, link) { |
573 | seat_reset_device(seat, input_device); | 591 | seat_reset_device(seat, input_device); |
diff --git a/sway/input/seat.c b/sway/input/seat.c index c263eb82..4919bed0 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <strings.h> | 5 | #include <strings.h> |
6 | #include <time.h> | 6 | #include <time.h> |
7 | #include <wlr/config.h> | ||
7 | #include <wlr/types/wlr_cursor.h> | 8 | #include <wlr/types/wlr_cursor.h> |
8 | #include <wlr/types/wlr_data_device.h> | 9 | #include <wlr/types/wlr_data_device.h> |
9 | #include <wlr/types/wlr_idle.h> | 10 | #include <wlr/types/wlr_idle.h> |
@@ -750,6 +751,7 @@ static void seat_apply_input_config(struct sway_seat *seat, | |||
750 | mapped_to_output = NULL; | 751 | mapped_to_output = NULL; |
751 | break; | 752 | break; |
752 | } | 753 | } |
754 | #if WLR_HAS_LIBINPUT_BACKEND | ||
753 | if (mapped_to_output == NULL && is_touch_or_tablet_tool(sway_device) && | 755 | if (mapped_to_output == NULL && is_touch_or_tablet_tool(sway_device) && |
754 | sway_libinput_device_is_builtin(sway_device->input_device)) { | 756 | sway_libinput_device_is_builtin(sway_device->input_device)) { |
755 | mapped_to_output = get_builtin_output_name(); | 757 | mapped_to_output = get_builtin_output_name(); |
@@ -758,6 +760,10 @@ static void seat_apply_input_config(struct sway_seat *seat, | |||
758 | mapped_to_output, sway_device->input_device->identifier); | 760 | mapped_to_output, sway_device->input_device->identifier); |
759 | } | 761 | } |
760 | } | 762 | } |
763 | #else | ||
764 | (void)is_touch_or_tablet_tool; | ||
765 | (void)get_builtin_output_name; | ||
766 | #endif | ||
761 | if (mapped_to_output == NULL) { | 767 | if (mapped_to_output == NULL) { |
762 | return; | 768 | return; |
763 | } | 769 | } |
diff --git a/sway/input/tablet.c b/sway/input/tablet.c index 92ede3fa..a62e77ec 100644 --- a/sway/input/tablet.c +++ b/sway/input/tablet.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | 1 | #define _POSIX_C_SOURCE 200809L |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <wlr/backend/libinput.h> | 3 | #include <wlr/config.h> |
4 | #include <wlr/types/wlr_tablet_v2.h> | 4 | #include <wlr/types/wlr_tablet_v2.h> |
5 | #include <wlr/types/wlr_tablet_tool.h> | 5 | #include <wlr/types/wlr_tablet_tool.h> |
6 | #include <wlr/types/wlr_tablet_pad.h> | 6 | #include <wlr/types/wlr_tablet_pad.h> |
@@ -9,6 +9,10 @@ | |||
9 | #include "sway/input/seat.h" | 9 | #include "sway/input/seat.h" |
10 | #include "sway/input/tablet.h" | 10 | #include "sway/input/tablet.h" |
11 | 11 | ||
12 | #if WLR_HAS_LIBINPUT_BACKEND | ||
13 | #include <wlr/backend/libinput.h> | ||
14 | #endif | ||
15 | |||
12 | static void handle_pad_tablet_destroy(struct wl_listener *listener, void *data) { | 16 | static void handle_pad_tablet_destroy(struct wl_listener *listener, void *data) { |
13 | struct sway_tablet_pad *pad = | 17 | struct sway_tablet_pad *pad = |
14 | wl_container_of(listener, pad, tablet_destroy); | 18 | wl_container_of(listener, pad, tablet_destroy); |
@@ -63,6 +67,7 @@ void sway_configure_tablet(struct sway_tablet *tablet) { | |||
63 | wlr_tablet_create(server.tablet_v2, seat->wlr_seat, device); | 67 | wlr_tablet_create(server.tablet_v2, seat->wlr_seat, device); |
64 | } | 68 | } |
65 | 69 | ||
70 | #if WLR_HAS_LIBINPUT_BACKEND | ||
66 | /* Search for a sibling tablet pad */ | 71 | /* Search for a sibling tablet pad */ |
67 | if (!wlr_input_device_is_libinput(device)) { | 72 | if (!wlr_input_device_is_libinput(device)) { |
68 | /* We can only do this on libinput devices */ | 73 | /* We can only do this on libinput devices */ |
@@ -87,6 +92,7 @@ void sway_configure_tablet(struct sway_tablet *tablet) { | |||
87 | break; | 92 | break; |
88 | } | 93 | } |
89 | } | 94 | } |
95 | #endif | ||
90 | } | 96 | } |
91 | 97 | ||
92 | void sway_tablet_destroy(struct sway_tablet *tablet) { | 98 | void sway_tablet_destroy(struct sway_tablet *tablet) { |
@@ -287,6 +293,7 @@ void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad) { | |||
287 | tablet_pad->ring.notify = handle_tablet_pad_ring; | 293 | tablet_pad->ring.notify = handle_tablet_pad_ring; |
288 | wl_signal_add(&tablet_pad->wlr->events.ring, &tablet_pad->ring); | 294 | wl_signal_add(&tablet_pad->wlr->events.ring, &tablet_pad->ring); |
289 | 295 | ||
296 | #if WLR_HAS_LIBINPUT_BACKEND | ||
290 | /* Search for a sibling tablet */ | 297 | /* Search for a sibling tablet */ |
291 | if (!wlr_input_device_is_libinput(wlr_device)) { | 298 | if (!wlr_input_device_is_libinput(wlr_device)) { |
292 | /* We can only do this on libinput devices */ | 299 | /* We can only do this on libinput devices */ |
@@ -311,6 +318,7 @@ void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad) { | |||
311 | break; | 318 | break; |
312 | } | 319 | } |
313 | } | 320 | } |
321 | #endif | ||
314 | } | 322 | } |
315 | 323 | ||
316 | void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad) { | 324 | void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad) { |