From 11a7de7640e2f461719c3aa5b88648fba4931f92 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 3 Jan 2024 11:47:53 +1000 Subject: 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 --- src/evdev.c | 5 ++--- test/test-pad.c | 7 +++++++ test/test-tablet.c | 5 +++++ 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 -- cgit v1.2.3