Support swipe gesture
BUG=chromium-os:124830
TEST=None
Change-Id: Idac76c6dd6d1352c37dac44111efd1c806a03e5a
Reviewed-on: https://gerrit.chromium.org/gerrit/38860
Commit-Ready: Dave Moore <[email protected]>
Tested-by: Dave Moore <[email protected]>
Reviewed-by: Andrew de los Reyes <[email protected]>
diff --git a/src/cmt.c b/src/cmt.c
index 363dde1..fee2aac 100644
--- a/src/cmt.c
+++ b/src/cmt.c
@@ -33,6 +33,8 @@
#define AXIS_LABEL_PROP_ABS_DBL_START_TIME "Abs Dbl Start Timestamp"
#define AXIS_LABEL_PROP_ABS_DBL_END_TIME "Abs Dbl End Timestamp"
+
+#define AXIS_LABEL_PROP_ABS_FINGER_COUNT "Abs Finger Count"
/**
* Forward declarations
*/
@@ -356,7 +358,8 @@
AXIS_LABEL_PROP_ABS_DBL_FLING_VX,
AXIS_LABEL_PROP_ABS_DBL_FLING_VY,
AXIS_LABEL_PROP_ABS_DBL_START_TIME,
- AXIS_LABEL_PROP_ABS_DBL_END_TIME
+ AXIS_LABEL_PROP_ABS_DBL_END_TIME,
+ AXIS_LABEL_PROP_ABS_FINGER_COUNT
};
static const char* btn_names[CMT_NUM_BUTTONS] = {
BTN_LABEL_PROP_BTN_LEFT,
diff --git a/src/cmt.h b/src/cmt.h
index c1a8fcf..866f5f4 100644
--- a/src/cmt.h
+++ b/src/cmt.h
@@ -45,10 +45,11 @@
CMT_AXIS_DBL_FLING_VX,
CMT_AXIS_DBL_FLING_VY,
CMT_AXIS_DBL_START_TIME,
- CMT_AXIS_DBL_END_TIME
+ CMT_AXIS_DBL_END_TIME,
+ CMT_AXIS_FINGER_COUNT
};
-#define CMT_NUM_AXES (CMT_AXIS_DBL_END_TIME - CMT_AXIS_X + 1)
+#define CMT_NUM_AXES (CMT_AXIS_FINGER_COUNT - CMT_AXIS_X + 1)
/* Button numbers. */
enum CMT_BUTTON {
diff --git a/src/gesture.c b/src/gesture.c
index ee59693..4e6bad3 100644
--- a/src/gesture.c
+++ b/src/gesture.c
@@ -273,6 +273,7 @@
rec->mask, CMT_AXIS_SCROLL_X, gesture->details.scroll.dx);
valuator_mask_set_double(
rec->mask, CMT_AXIS_SCROLL_Y, gesture->details.scroll.dy);
+ valuator_mask_set_double(rec->mask, CMT_AXIS_FINGER_COUNT, 2.0);
SetTimeValues(rec->mask, gesture, dev, TRUE);
xf86PostMotionEventM(dev, TRUE, rec->mask);
break;
@@ -302,12 +303,16 @@
xf86PostMotionEventM(dev, TRUE, rec->mask);
break;
case kGestureTypeSwipe:
- DBG(info, "Gesture Swipe: dx=%f\n", gesture->details.swipe.dx);
+ DBG(info, "Gesture Swipe: dx=%f dy=%f\n",
+ gesture->details.swipe.dx,
+ gesture->details.swipe.dy);
+ valuator_mask_set_double(
+ rec->mask, CMT_AXIS_SCROLL_X, gesture->details.swipe.dx);
+ valuator_mask_set_double(
+ rec->mask, CMT_AXIS_SCROLL_Y, gesture->details.swipe.dy);
+ valuator_mask_set_double(rec->mask, CMT_AXIS_FINGER_COUNT, 3.0);
SetTimeValues(rec->mask, gesture, dev, TRUE);
- button = gesture->details.swipe.dx > 0.f ?
- CMT_BTN_FORWARD : CMT_BTN_BACK;
- xf86PostButtonEventM(dev, TRUE, button, 1, rec->mask);
- xf86PostButtonEventM(dev, TRUE, button, 0, rec->mask);
+ xf86PostMotionEventM(dev, TRUE, rec->mask);
break;
case kGestureTypePinch:
DBG(info, "Gesture Pinch: dz=%f\n", gesture->details.pinch.dz);