From e51be409059abbae5aa0c037b85456236c19e932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 9 Feb 2021 13:52:20 +0100 Subject: [PATCH] totem: separate X/Y resolution from touch size in discriminator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref: https://gitlab.freedesktop.org/libinput/libinput/-/commit/bf4277623f7c24286b9f1e4b3ace51fbb5bb6a98#note_793589 Signed-off-by: Ahelenia ZiemiaƄska --- src/evdev-totem.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/evdev-totem.c b/src/evdev-totem.c index d26fc33d..4dd9eb40 100644 --- a/src/evdev-totem.c +++ b/src/evdev-totem.c @@ -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; }