summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2024-01-03 11:47:53 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2024-01-03 12:20:16 +1000
commit11a7de7640e2f461719c3aa5b88648fba4931f92 (patch)
tree00ea11e99e6a35b64bfd9856767876853fc86021
parentd5ff9d75a80fdc4fcba5d1fcead50c9002e2cb67 (diff)
evdev: default tablets to allow for rotation
If libwacom is disabled or there is no .tablet file in libwacom for this device yet, default to enabling a left-handed setting. Otherwise the tablet may not be usable. See https://github.com/linuxwacom/libwacom/issues/616
-rw-r--r--src/evdev.c5
-rw-r--r--test/test-pad.c7
-rw-r--r--test/test-tablet.c5
3 files changed, 14 insertions, 3 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 99595967..f3b4f9f1 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -3120,7 +3120,7 @@ evdev_device_destroy(struct evdev_device *device)
bool
evdev_tablet_has_left_handed(struct evdev_device *device)
{
- bool has_left_handed = false;
+ bool has_left_handed = true;
#if HAVE_LIBWACOM
struct libinput *li = evdev_libinput_context(device);
WacomDeviceDatabase *db = NULL;
@@ -3141,8 +3141,7 @@ evdev_tablet_has_left_handed(struct evdev_device *device)
error);
if (d) {
- if (libwacom_is_reversible(d))
- has_left_handed = true;
+ has_left_handed = !!libwacom_is_reversible(d);
} else if (libwacom_error_get_code(error) == WERROR_UNKNOWN_MODEL) {
evdev_log_info(device,
"tablet '%s' unknown to libwacom\n",
diff --git a/test/test-pad.c b/test/test-pad.c
index 334558ed..23ff8d0f 100644
--- a/test/test-pad.c
+++ b/test/test-pad.c
@@ -618,13 +618,19 @@ START_TEST(pad_no_left_handed)
struct libinput_device *device = dev->libinput_device;
enum libinput_config_status status;
+ /* Without libwacom we default to left-handed being available */
+#if HAVE_LIBWACOM
ck_assert(!libinput_device_config_left_handed_is_available(device));
+#else
+ ck_assert(libinput_device_config_left_handed_is_available(device));
+#endif
ck_assert_int_eq(libinput_device_config_left_handed_get_default(device),
0);
ck_assert_int_eq(libinput_device_config_left_handed_get(device),
0);
+#if HAVE_LIBWACOM
status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
@@ -640,6 +646,7 @@ START_TEST(pad_no_left_handed)
0);
ck_assert_int_eq(libinput_device_config_left_handed_get_default(device),
0);
+#endif
}
END_TEST
diff --git a/test/test-tablet.c b/test/test-tablet.c
index 5e0711a7..743b9e9b 100644
--- a/test/test-tablet.c
+++ b/test/test-tablet.c
@@ -1943,7 +1943,12 @@ START_TEST(no_left_handed)
{
struct litest_device *dev = litest_current_device();
+ /* Without libwacom we default to left-handed being available */
+#if HAVE_LIBWACOM
ck_assert(!libinput_device_config_left_handed_is_available(dev->libinput_device));
+#else
+ ck_assert(libinput_device_config_left_handed_is_available(dev->libinput_device));
+#endif
}
END_TEST