evdev: remove direct checks for INPUT_PROP_POINTING_STICK
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>
Tue, 2 Jun 2015 21:22:42 +0000 (17:22 -0400)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 2 Jun 2015 23:30:32 +0000 (09:30 +1000)
If we need to temporary override a device with ID_INPUT_POINTINGSTICK,
evdev sets the tag EVDEV_TAG_TRACKPOINT to the device. Rely on the tag
to behave properly for scroll emulation.

The dpi information should be retrieved after the device has been
configured or the tag EVDEV_TAG_TRACKPOINT was not set.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev.c

index df46bb9..d6a2fff 100644 (file)
@@ -1060,7 +1060,7 @@ evdev_scroll_get_default_method(struct libinput_device *device)
 {
        struct evdev_device *evdev = (struct evdev_device *)device;
 
-       if (libevdev_has_property(evdev->evdev, INPUT_PROP_POINTING_STICK))
+       if (evdev->tags & EVDEV_TAG_TRACKPOINT)
                return LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
 
        /* Mice without a scroll wheel but with middle button have on-button
@@ -1480,7 +1480,7 @@ evdev_read_dpi_prop(struct evdev_device *device)
         * POINTINGSTICK_CONST_ACCEL value to compensate for sensitivity
         * differences between models, we translate this to a fake dpi.
         */
-       if (libevdev_has_property(device->evdev, INPUT_PROP_POINTING_STICK))
+       if (device->tags & EVDEV_TAG_TRACKPOINT)
                return evdev_get_trackpoint_dpi(device);
 
        mouse_dpi = udev_device_get_property_value(device->udev_device,
@@ -2078,7 +2078,6 @@ evdev_device_create(struct libinput_seat *seat,
        device->scroll.direction = 0;
        device->scroll.wheel_click_angle =
                evdev_read_wheel_click_prop(device);
-       device->dpi = evdev_read_dpi_prop(device);
        device->model = evdev_read_model(device);
        /* at most 5 SYN_DROPPED log-messages per 30s */
        ratelimit_init(&device->syn_drop_limit, 30ULL * 1000, 5);
@@ -2090,6 +2089,8 @@ evdev_device_create(struct libinput_seat *seat,
        if (evdev_configure_device(device) == -1)
                goto err;
 
+       device->dpi = evdev_read_dpi_prop(device);
+
        if (device->seat_caps == 0) {
                unhandled_device = 1;
                goto err;