totem: separate X/Y resolution from touch size in discriminator

Ref: bf4277623f (note_793589)
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
This commit is contained in:
наб 2021-02-09 13:52:20 +01:00
parent 0dd8b9725f
commit e51be40905
No known key found for this signature in database
GPG key ID: BCFD0B018D2658F1

View file

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