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

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 18 22:44:33 PDT 2014


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 0b51809..5637774 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -801,6 +801,45 @@ tp_init_slots(struct tp_dispatch *tp,
 }
 
 static int
+tp_accel_config_available(struct libinput_device *device)
+{
+	return 1;
+}
+
+static enum libinput_config_status
+tp_accel_config_set_speed(struct libinput_device *device, double speed)
+{
+	struct evdev_dispatch *dispatch;
+	struct tp_dispatch *tp;
+
+	dispatch = ((struct evdev_device *) device)->dispatch;
+	tp = container_of(dispatch, tp, base);
+
+	if (!filter_set_speed(tp->filter, speed))
+		return LIBINPUT_CONFIG_STATUS_INVALID;
+
+	return LIBINPUT_CONFIG_STATUS_SUCCESS;
+}
+
+static double
+tp_accel_config_get_speed(struct libinput_device *device)
+{
+	struct evdev_dispatch *dispatch;
+	struct tp_dispatch *tp;
+
+	dispatch = ((struct evdev_device *) device)->dispatch;
+	tp = container_of(dispatch, tp, base);
+
+	return filter_get_speed(tp->filter);
+}
+
+static double
+tp_accel_config_get_default_speed(struct libinput_device *device)
+{
+	return 0;
+}
+
+static int
 tp_init_accel(struct tp_dispatch *tp, double diagonal)
 {
 	struct motion_filter *accel;
@@ -847,6 +886,12 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
 
 	tp->filter = accel;
 
+	tp->device->pointer.config.available = tp_accel_config_available;
+	tp->device->pointer.config.set_speed = tp_accel_config_set_speed;
+	tp->device->pointer.config.get_speed = tp_accel_config_get_speed;
+	tp->device->pointer.config.get_default_speed = tp_accel_config_get_default_speed;
+	tp->device->base.config.accel = &tp->device->pointer.config;
+
 	return 0;
 }
 
-- 
1.9.3



More information about the wayland-devel mailing list