UPSTREAM: Four finger swipes in multitouch

I think four finger swipes are useful, attached is a very
simple patch enabling that.

Signed-off-by: Daniel Landau <daniel.landau@helsinki.fi>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
(cherry picked from commit 4d87c041f6a232aa30528d70d4b9946d1824b4ed)

Change-Id: I8ebd875cb2ef7171c5d8be311d09ca6603dc9933
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/1361
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
diff --git a/driver/multitouch.c b/driver/multitouch.c
index c7554a6..0678e9b 100644
--- a/driver/multitouch.c
+++ b/driver/multitouch.c
@@ -261,6 +261,14 @@
 		foreach_bit(i, gs->tapmask)
 			tickle_button(local, i + 1);
 	}
+	if (GETBIT(gs->type, GS_VSWIPE4)) {
+		int step = 1 + vswipe_fraction * get_cap_ysize(caps);
+		button_scroll(local, 16, 17, &vswipe, step, gs->dy);
+	}
+	if (GETBIT(gs->type, GS_HSWIPE4)) {
+		int step = 1 + hswipe_fraction * get_cap_xsize(caps);
+		button_scroll(local, 18, 19, &hswipe, step, gs->dx);
+	}
 }
 
 /* called for each full received packet from the touchpad */
diff --git a/include/gestures.h b/include/gestures.h
index 6bc92cd..b512121 100644
--- a/include/gestures.h
+++ b/include/gestures.h
@@ -33,6 +33,8 @@
 #define GS_SCALE 6
 #define GS_ROTATE 7
 #define GS_TAP 8
+#define GS_VSWIPE4 9
+#define GS_HSWIPE4 10
 
 struct Gestures {
 	bitmask_t type, btmask, btdata;
diff --git a/src/gestures.c b/src/gestures.c
index 735e77c..cc95e9b 100644
--- a/src/gestures.c
+++ b/src/gestures.c
@@ -157,12 +157,16 @@
 				SETBIT(gs->type, GS_HSCROLL);
 			if (nmove == 3)
 				SETBIT(gs->type, GS_HSWIPE);
+			if (nmove == 4)
+				SETBIT(gs->type, GS_HSWIPE4);
 		}
 		if (abs(gs->dy) > abs(gs->dx)) {
 			if (nmove == 2)
 				SETBIT(gs->type, GS_VSCROLL);
 			if (nmove == 3)
 				SETBIT(gs->type, GS_VSWIPE);
+			if (nmove == 4)
+				SETBIT(gs->type, GS_VSWIPE4);
 		}
 	}
 }