libinput/0004-evdev-init-pointer-acceleration-for-any-device-with-.patch

61 lines
2.0 KiB
Diff

From 64ec0dc79619c1d9cdd772abfdbcb87b6b94d71f Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 28 Oct 2015 09:13:24 +1000
Subject: [PATCH libinput 4/5] evdev: init pointer acceleration for any device
with pointer cap and rel x/y
The Asus RoG Gladius exposes two event nodes, one mouse, one keyboard. The
keyboard node has REL_X/Y and REL_HWHEEL on top of the various key bits and
ABS_VOLUME.
The keyboard node does not have BTN_* set, udev tags this device as a
keyboard only, not as a pointer but we still initialize the pointer caps for
it because of the wheel.
When moving this mouse, the deltas are sent through the keyboard node, causing
a crash because we never initialized pointer acceleration.
https://bugzilla.redhat.com/show_bug.cgi?id=1275407
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/evdev.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/evdev.c b/src/evdev.c
index ba1b568..ec3abc6 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2062,11 +2062,6 @@ evdev_configure_device(struct evdev_device *device)
evdev_tag_trackpoint(device, device->udev_device);
device->dpi = evdev_read_dpi_prop(device);
- if (libevdev_has_event_code(evdev, EV_REL, REL_X) &&
- libevdev_has_event_code(evdev, EV_REL, REL_Y) &&
- evdev_init_accel(device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) == -1)
- return -1;
-
device->seat_caps |= EVDEV_DEVICE_POINTER;
log_info(libinput,
@@ -2104,6 +2099,16 @@ evdev_configure_device(struct evdev_device *device)
device->devname, devnode);
}
+ if (device->seat_caps & EVDEV_DEVICE_POINTER &&
+ libevdev_has_event_code(evdev, EV_REL, REL_X) &&
+ libevdev_has_event_code(evdev, EV_REL, REL_Y) &&
+ evdev_init_accel(device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) == -1) {
+ log_error(libinput,
+ "failed to initialize pointer acceleration for %s\n",
+ device->devname);
+ return -1;
+ }
+
return 0;
}
--
2.4.3