totem: separate X/Y resolution from touch size in discriminator
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Tue, 9 Feb 2021 12:52:20 +0000 (13:52 +0100)
committerнаб <nabijaczleweli@nabijaczleweli.xyz>
Tue, 9 Feb 2021 12:52:20 +0000 (13:52 +0100)
Ref: https://gitlab.freedesktop.org/libinput/libinput/-/commit/bf4277623f7c24286b9f1e4b3ace51fbb5bb6a98#note_793589
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
src/evdev-totem.c

index d26fc33d6dbbf70ea1f06709e9ed72c454e13961..4dd9eb4038a39aa3869ed1148d9afa4fcc65254f 100644 (file)
@@ -717,7 +717,7 @@ static bool
 totem_reject_device(struct evdev_device *device)
 {
        struct libevdev *evdev = device->evdev;
-       bool has_xy, has_slot, has_tool_dial, has_size;
+       bool has_xy, has_slot, has_tool_dial, has_size, has_touch_size;
        double w, h;
 
        has_xy = libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) &&
@@ -726,19 +726,21 @@ totem_reject_device(struct evdev_device *device)
        has_tool_dial = libevdev_has_event_code(evdev, EV_ABS, ABS_MT_TOOL_TYPE) &&
                        libevdev_get_abs_maximum(evdev, ABS_MT_TOOL_TYPE) >= MT_TOOL_DIAL;
        has_size = evdev_device_get_size(device, &w, &h) == 0;
-       has_size |= libevdev_get_abs_resolution(device->evdev, ABS_MT_TOUCH_MAJOR) > 0;
-       has_size |= libevdev_get_abs_resolution(device->evdev, ABS_MT_TOUCH_MINOR) > 0;
+       has_touch_size =
+               libevdev_get_abs_resolution(device->evdev, ABS_MT_TOUCH_MAJOR) > 0 ||
+               libevdev_get_abs_resolution(device->evdev, ABS_MT_TOUCH_MINOR) > 0;
 
-       if (has_xy && has_slot && has_tool_dial && has_size)
+       if (has_xy && has_slot && has_tool_dial && has_size && has_touch_size)
                return false;
 
        evdev_log_bug_libinput(device,
-                              "missing totem capabilities:%s%s%s%s. "
+                              "missing totem capabilities:%s%s%s%s%s. "
                               "Ignoring this device.\n",
                               has_xy ? "" : " xy",
                               has_slot ? "" : " slot",
                               has_tool_dial ? "" : " dial",
-                              has_size ? "" : " resolutions");
+                              has_size ? "" : " resolutions",
+                              has_touch_size ? "" : " touch-size");
        return true;
 }