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
This commit is contained in:
Peter Hutterer 2024-01-03 11:47:53 +10:00
parent d5ff9d75a8
commit 11a7de7640
3 changed files with 14 additions and 3 deletions

View file

@ -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",

View file

@ -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

View file

@ -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