[PATCH v2 libinput 2/2] evdev: remove direct checks for INPUT_PROP_POINTING_STICK

Benjamin Tissoires benjamin.tissoires at gmail.com
Tue Jun 2 14:22:42 PDT 2015


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 at gmail.com>
---

Changes in v2:
- moved device->dpi to be sure the device is tagged first
- thanks to 1/2, now we are sure to have the device tagged before the 2 uses
  below.

 src/evdev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index df46bb9..d6a2fff 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -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;
-- 
2.4.0



More information about the wayland-devel mailing list