aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/input-manager.c20
-rw-r--r--sway/input/seat.c6
-rw-r--r--sway/input/tablet.c10
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 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
-#include <wlr/backend/libinput.h>
+#include <wlr/config.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_keyboard_group.h>
#include <wlr/types/wlr_input_inhibitor.h>
@@ -22,6 +22,10 @@
#include "list.h"
#include "log.h"
+#if WLR_HAS_LIBINPUT_BACKEND
+#include <wlr/backend/libinput.h>
+#endif
+
#define DEFAULT_SEAT "seat0"
struct input_config *current_input_config = NULL;
@@ -90,6 +94,7 @@ char *input_device_get_identifier(struct wlr_input_device *device) {
}
static bool device_is_touchpad(struct sway_input_device *device) {
+#if WLR_HAS_LIBINPUT_BACKEND
if (device->wlr_device->type != WLR_INPUT_DEVICE_POINTER ||
!wlr_input_device_is_libinput(device->wlr_device)) {
return false;
@@ -99,6 +104,9 @@ static bool device_is_touchpad(struct sway_input_device *device) {
wlr_libinput_get_device_handle(device->wlr_device);
return libinput_device_config_tap_get_finger_count(libinput_device) > 0;
+#else
+ return false;
+#endif
}
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) {
apply_input_type_config(input_device);
+#if WLR_HAS_LIBINPUT_BACKEND
bool config_changed = sway_input_configure_libinput_device(input_device);
+#else
+ bool config_changed = false;
+#endif
wl_signal_add(&device->events.destroy, &input_device->device_destroy);
input_device->device_destroy.notify = handle_device_destroy;
@@ -532,7 +544,11 @@ static void retranslate_keysyms(struct input_config *input_config) {
static void input_manager_configure_input(
struct sway_input_device *input_device) {
+#if WLR_HAS_LIBINPUT_BACKEND
bool config_changed = sway_input_configure_libinput_device(input_device);
+#else
+ bool config_changed = false;
+#endif
struct sway_seat *seat = NULL;
wl_list_for_each(seat, &server.input->seats, link) {
seat_configure_device(seat, input_device);
@@ -567,7 +583,9 @@ void input_manager_apply_input_config(struct input_config *input_config) {
}
void input_manager_reset_input(struct sway_input_device *input_device) {
+#if WLR_HAS_LIBINPUT_BACKEND
sway_input_reset_libinput_device(input_device);
+#endif
struct sway_seat *seat = NULL;
wl_list_for_each(seat, &server.input->seats, link) {
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 @@
#include <string.h>
#include <strings.h>
#include <time.h>
+#include <wlr/config.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_idle.h>
@@ -750,6 +751,7 @@ static void seat_apply_input_config(struct sway_seat *seat,
mapped_to_output = NULL;
break;
}
+#if WLR_HAS_LIBINPUT_BACKEND
if (mapped_to_output == NULL && is_touch_or_tablet_tool(sway_device) &&
sway_libinput_device_is_builtin(sway_device->input_device)) {
mapped_to_output = get_builtin_output_name();
@@ -758,6 +760,10 @@ static void seat_apply_input_config(struct sway_seat *seat,
mapped_to_output, sway_device->input_device->identifier);
}
}
+#else
+ (void)is_touch_or_tablet_tool;
+ (void)get_builtin_output_name;
+#endif
if (mapped_to_output == NULL) {
return;
}
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 @@
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
-#include <wlr/backend/libinput.h>
+#include <wlr/config.h>
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_tablet_pad.h>
@@ -9,6 +9,10 @@
#include "sway/input/seat.h"
#include "sway/input/tablet.h"
+#if WLR_HAS_LIBINPUT_BACKEND
+#include <wlr/backend/libinput.h>
+#endif
+
static void handle_pad_tablet_destroy(struct wl_listener *listener, void *data) {
struct sway_tablet_pad *pad =
wl_container_of(listener, pad, tablet_destroy);
@@ -63,6 +67,7 @@ void sway_configure_tablet(struct sway_tablet *tablet) {
wlr_tablet_create(server.tablet_v2, seat->wlr_seat, device);
}
+#if WLR_HAS_LIBINPUT_BACKEND
/* Search for a sibling tablet pad */
if (!wlr_input_device_is_libinput(device)) {
/* We can only do this on libinput devices */
@@ -87,6 +92,7 @@ void sway_configure_tablet(struct sway_tablet *tablet) {
break;
}
}
+#endif
}
void sway_tablet_destroy(struct sway_tablet *tablet) {
@@ -287,6 +293,7 @@ void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad) {
tablet_pad->ring.notify = handle_tablet_pad_ring;
wl_signal_add(&tablet_pad->wlr->events.ring, &tablet_pad->ring);
+#if WLR_HAS_LIBINPUT_BACKEND
/* Search for a sibling tablet */
if (!wlr_input_device_is_libinput(wlr_device)) {
/* We can only do this on libinput devices */
@@ -311,6 +318,7 @@ void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad) {
break;
}
}
+#endif
}
void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad) {