[PATCH v2 libinput 08/10] touchpad: hook up pointer acceleration configuration

Peter Hutterer peter.hutterer at who-t.net
Sun Sep 21 17:02:11 PDT 2014


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v1:
- don't duplicate the accel config code, just re-use it for touchpad


 src/evdev-mt-touchpad.c | 7 +------
 src/evdev.c             | 6 +++---
 src/evdev.h             | 3 +++
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 79f5357..167cea9 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -802,7 +802,6 @@ tp_init_slots(struct tp_dispatch *tp,
 static int
 tp_init_accel(struct tp_dispatch *tp, double diagonal)
 {
-	struct motion_filter *accel;
 	int res_x, res_y;
 
 	if (tp->has_mt) {
@@ -839,13 +838,9 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
 		tp->accel.y_scale_coeff = DEFAULT_ACCEL_NUMERATOR / diagonal;
 	}
 
-	accel = create_pointer_accelator_filter(
-			pointer_accel_profile_linear);
-	if (accel == NULL)
+	if (evdev_device_init_pointer_acceleration(tp->device) == -1)
 		return -1;
 
-	tp->device->pointer.filter = accel;
-
 	return 0;
 }
 
diff --git a/src/evdev.c b/src/evdev.c
index a5a8372..4c0669c 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -893,8 +893,8 @@ evdev_accel_config_get_default_speed(struct libinput_device *device)
 	return 0.0;
 }
 
-static int
-configure_pointer_acceleration(struct evdev_device *device)
+int
+evdev_device_init_pointer_acceleration(struct evdev_device *device)
 {
 	device->pointer.filter =
 		create_pointer_accelator_filter(
@@ -1090,7 +1090,7 @@ evdev_configure_device(struct evdev_device *device)
 		has_keyboard = 1;
 
 	if ((has_abs || has_rel) && has_button) {
-		if (configure_pointer_acceleration(device) == -1)
+		if (evdev_device_init_pointer_acceleration(device) == -1)
 			return -1;
 
 		device->seat_caps |= EVDEV_DEVICE_POINTER;
diff --git a/src/evdev.h b/src/evdev.h
index 301903a..23615f9 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -177,6 +177,9 @@ evdev_device_create(struct libinput_seat *seat,
 		    const char *sysname,
 		    const char *syspath);
 
+int
+evdev_device_init_pointer_acceleration(struct evdev_device *device);
+
 struct evdev_dispatch *
 evdev_touchpad_create(struct evdev_device *device);
 
-- 
1.9.3



More information about the wayland-devel mailing list