Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/evdev-mt-touchpad.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 src/evdev-mt-touchpad.h |  1 +
 2 files changed, 44 insertions(+)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 26d5f7d..c1c994a 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -737,8 +737,51 @@ tp_init_accel(struct tp_dispatch *touchpad, double 
diagonal)
 }
 
 static int
+tp_config_scroll_methods(struct libinput_device *device)
+{
+       struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)->dispatch;
+       struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+       return LIBINPUT_SCROLL_METHOD_TWOFINGER;
+}
+
+static enum libinput_config_status
+tp_config_scroll_set(struct libinput_device *device,
+                    enum libinput_scroll_method method)
+{
+       struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)->dispatch;
+       struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+       if (method != LIBINPUT_SCROLL_METHOD_TWOFINGER)
+               return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+       return LIBINPUT_CONFIG_STATUS_SUCCESS;
+}
+
+static enum libinput_scroll_method
+tp_config_scroll_get(struct libinput_device *device)
+{
+       struct evdev_dispatch *dispatch = ((struct evdev_device 
*)device)->dispatch;
+       struct tp_dispatch *tp = container_of(dispatch, tp, base);
+
+       return LIBINPUT_SCROLL_METHOD_TWOFINGER;
+}
+
+static void
+tp_config_scroll_reset(struct libinput_device *device)
+{
+       /* two-finger scrolling is hardcoded, nothing to do */
+}
+
+static int
 tp_init_scroll(struct tp_dispatch *tp)
 {
+       tp->scroll.config.methods = tp_config_scroll_methods;
+       tp->scroll.config.set = tp_config_scroll_set;
+       tp->scroll.config.get = tp_config_scroll_get;
+       tp->scroll.config.reset = tp_config_scroll_reset;
+       tp->device->base.config.scroll = &tp->scroll.config;
+
        tp->scroll.direction = 0;
        tp->scroll.state = SCROLL_STATE_NONE;
 
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 0b31e9a..d89d74c 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -195,6 +195,7 @@ struct tp_dispatch {
        } buttons;                              /* physical buttons */
 
        struct {
+               struct libinput_device_config_scroll config;
                enum scroll_state state;
                enum libinput_pointer_axis direction;
        } scroll;
-- 
1.9.0

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to