diff options
Diffstat (limited to 'src/evdev.c')
-rw-r--r-- | src/evdev.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/evdev.c b/src/evdev.c index 59dbde3..409799d 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2116,14 +2116,30 @@ evdev_reject_device(struct evdev_device *device) return false; } -static bool -evdev_configure_mt_device(struct evdev_device *device) +static void +evdev_extract_abs_axes(struct evdev_device *device) { struct libevdev *evdev = device->evdev; - if (!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) || + if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X) || + !libevdev_has_event_code(evdev, EV_ABS, ABS_Y)) + return; + + if (evdev_fix_abs_resolution(device, ABS_X, ABS_Y)) + device->abs.fake_resolution = 1; + device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X); + device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y); + device->abs.point.x = device->abs.absinfo_x->value; + device->abs.point.y = device->abs.absinfo_y->value; + device->abs.dimensions.x = abs(device->abs.absinfo_x->maximum - + device->abs.absinfo_x->minimum); + device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum - + device->abs.absinfo_y->minimum); + + if (evdev_is_fake_mt_device(device) || + !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) || !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) - return true; + return; if (evdev_fix_abs_resolution(device, ABS_MT_POSITION_X, @@ -2137,8 +2153,6 @@ evdev_configure_mt_device(struct evdev_device *device) device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum - device->abs.absinfo_y->minimum); device->is_mt = 1; - - return true; } static struct evdev_dispatch * @@ -2201,22 +2215,10 @@ evdev_configure_device(struct evdev_device *device) evdev_fix_android_mt(device); if (libevdev_has_event_code(evdev, EV_ABS, ABS_X)) { - if (evdev_fix_abs_resolution(device, ABS_X, ABS_Y)) - device->abs.fake_resolution = 1; - device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X); - device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y); - device->abs.point.x = device->abs.absinfo_x->value; - device->abs.point.y = device->abs.absinfo_y->value; - device->abs.dimensions.x = abs(device->abs.absinfo_x->maximum - - device->abs.absinfo_x->minimum); - device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum - - device->abs.absinfo_y->minimum); - - if (evdev_is_fake_mt_device(device)) { + evdev_extract_abs_axes(device); + + if (evdev_is_fake_mt_device(device)) udev_tags &= ~EVDEV_UDEV_TAG_TOUCHSCREEN; - } else if (!evdev_configure_mt_device(device)) { - return NULL; - } } /* libwacom assigns touchpad (or touchscreen) _and_ tablet to the |