tablet: default to a built-in tablet
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 29 Oct 2024 10:17:00 +0000 (20:17 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 31 Oct 2024 05:58:31 +0000 (15:58 +1000)
The vast majority of devices that libwacom doesn't know about are the
various built-in ones. Since the only effect in our code here is that we
enable the calibration matrix, let's default to built-in if we don't
know any better - better to have the matrix and not use it than to not
be able to calibrate a tablet.

Note that libwacom 2.11 and later also now default to a built-in tablet.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1074>

src/evdev-tablet.c
test/test-tablet.c

index be91c9e65d318ae116d37822c961609e20bfba02..5a458582fed5d1e79b78c97e74541b3535720a18 100644 (file)
@@ -2594,10 +2594,10 @@ static inline bool
 tablet_is_display_tablet(WacomDevice *wacom)
 {
 #if HAVE_LIBWACOM
-       return wacom &&
-               !!(libwacom_get_integration_flags(wacom) & (WACOM_DEVICE_INTEGRATED_SYSTEM|WACOM_DEVICE_INTEGRATED_DISPLAY));
+       return !wacom ||
+               (libwacom_get_integration_flags(wacom) & (WACOM_DEVICE_INTEGRATED_SYSTEM|WACOM_DEVICE_INTEGRATED_DISPLAY));
 #else
-       return false;
+       return true;
 #endif
 }
 
index 07a14dc46c1fcb9911e5172c8e3a0181efead40b..f33dc4066852ce7fdc4a0a11f04314b1579ff91b 100644 (file)
@@ -3683,10 +3683,14 @@ END_TEST
 static bool
 device_has_calibration(struct litest_device *dev)
 {
-       bool has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT);
 
-       if (has_calibration)
+       if (libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT))
                return true;
+
+       bool has_calibration =
+               libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_PEN) ||
+               libevdev_has_event_code(dev->evdev, EV_KEY, BTN_STYLUS);
+
 #if HAVE_LIBWACOM
        WacomDeviceDatabase *db = libwacom_database_new();
        if (db) {