Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/evdev.c | 42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 0687de0..a7b77c8 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);
+               evdev_extract_abs_axes(device);
 
-               if (evdev_is_fake_mt_device(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
-- 
2.7.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to