[PATCH libinput 11/11] touchpad: Add support for swipe gestures

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 23 21:09:25 PST 2015


On Mon, Feb 23, 2015 at 10:24:59AM +0100, Hans de Goede wrote:
> Hi,
> 
> On 23-02-15 04:25, Peter Hutterer wrote:
> >On Wed, Feb 18, 2015 at 01:26:54PM +0100, Hans de Goede wrote:
> >>Add support for swipe gestures.
> >>
> >>Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> >
> >unless noted otherwise, series
> >Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
> 
> Thanks for the review, I've addressed all your comments and rebased
> on the 0.11 release. As discussed earlier I've also reordered the patches
> to put the preparation patches before the patches adding new API, so that
> we can push those while holding back on the API additions for now.
> 
> The end result can be found here:
> http://cgit.freedesktop.org/~jwrdegoede/libinput/log/
> 
> If it is ok with you I would like to push all the patches there upto
> the "touchpad: Refactor tp_get_*_touches_delta" patch to the official
> master branch, so is that ok with you ?

pushed, thanks

Cheers,
   Peter

> 
> >
> >Cheers,
> >    Peter
> >
> >>---
> >>  src/evdev-mt-touchpad-gestures.c | 36 ++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 36 insertions(+)
> >>
> >>diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
> >>index e429efe..faf5824 100644
> >>--- a/src/evdev-mt-touchpad-gestures.c
> >>+++ b/src/evdev-mt-touchpad-gestures.c
> >>@@ -25,6 +25,7 @@
> >>  #include <assert.h>
> >>  #include <math.h>
> >>  #include <stdbool.h>
> >>+#include <stdio.h>
> >>  #include <limits.h>
> >>
> >>  #include "evdev-mt-touchpad.h"
> >>@@ -70,6 +71,13 @@ tp_gesture_start(struct tp_dispatch *tp, uint64_t time)
> >>  	case 2:
> >>  		/* NOP */
> >>  		break;
> >>+	case 3:
> >>+	case 4:
> >>+		gesture_notify_swipe(&tp->device->base, time,
> >>+				     LIBINPUT_EVENT_GESTURE_SWIPE_START,
> >>+				     tp->gesture.finger_mode,
> >>+				     0, 0, 0, 0);
> >>+		break;
> >>  	}
> >>  	tp->gesture.started = true;
> >>  }
> >>@@ -112,6 +120,23 @@ tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
> >>  			  dx, dy);
> >>  }
> >>
> >>+static void
> >>+tp_gesture_post_swipe(struct tp_dispatch *tp, uint64_t time)
> >>+{
> >>+	double dx, dy, dx_unaccel, dy_unaccel;
> >>+
> >>+	tp_get_touches_delta(tp, &dx, &dy, true);
> >>+	tp_filter_motion(tp, &dx, &dy, &dx_unaccel, &dy_unaccel, time);
> >>+
> >>+	if (dx != 0.0 || dy != 0.0 || dx_unaccel != 0.0 || dy_unaccel != 0.0) {
> >>+		tp_gesture_start(tp, time);
> >>+		gesture_notify_swipe(&tp->device->base, time,
> >>+				     LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
> >>+				     tp->gesture.finger_mode,
> >>+				     dx, dy, dx_unaccel, dy_unaccel);
> >>+	}
> >>+}
> >>+
> >>  void
> >>  tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time)
> >>  {
> >>@@ -136,6 +161,10 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time)
> >>  	case 2:
> >>  		tp_gesture_post_twofinger_scroll(tp, time);
> >>  		break;
> >>+	case 3:
> >>+	case 4:
> >>+		tp_gesture_post_swipe(tp, time);
> >>+		break;
> >>  	}
> >>  }
> >>
> >>@@ -157,6 +186,13 @@ tp_gesture_stop(struct tp_dispatch *tp, uint64_t time)
> >>  	case 2:
> >>  		tp_gesture_stop_twofinger_scroll(tp, time);
> >>  		break;
> >>+	case 3:
> >>+	case 4:
> >>+		gesture_notify_swipe(&tp->device->base, time,
> >>+				     LIBINPUT_EVENT_GESTURE_SWIPE_END,
> >>+				     tp->gesture.finger_mode,
> >>+				     0, 0, 0, 0);
> >>+		break;
> >>  	}
> >>  	tp->gesture.started = false;
> >>  }
> >>--
> >>2.1.0
> >>
> >>_______________________________________________
> >>wayland-devel mailing list
> >>wayland-devel at lists.freedesktop.org
> >>http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >>


More information about the wayland-devel mailing list