Permalink
Browse files

Sanitize condition to check for complex gestures.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <pinglinux@gmail.com>
Acked-by: Chris Bagwell <chris@cnpbagwell.com>
  • Loading branch information...
whot committed Aug 23, 2011
1 parent 992738f commit cf5986b7e546443f16cd86dbb46c8ba334382081
Showing with 14 additions and 11 deletions.
  1. +14 −11 src/wcmTouchFilter.c
View
@@ -290,18 +290,21 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel)
wcmFingerScroll(priv);
/* process complex two finger gestures */
- else if ((2*common->wcmGestureParameters.wcmTapTime <
- (GetTimeInMillis() - ds[0].sample)) &&
- (2*common->wcmGestureParameters.wcmTapTime <
- (GetTimeInMillis() - ds[1].sample))
- && ds[0].proximity && ds[1].proximity)
- {
- /* scroll should be considered first since it requires
- * a finger distance check */
- wcmFingerScroll(priv);
+ else {
+ CARD32 ms = GetTimeInMillis();
+ int taptime = 2 * common->wcmGestureParameters.wcmTapTime;
+
+ if (ds[0].proximity && ds[1].proximity &&
+ (taptime < (ms - ds[0].sample)) &&
+ (taptime < (ms - ds[1].sample)))
+ {
+ /* scroll should be considered first since it requires
+ * a finger distance check */
+ wcmFingerScroll(priv);
- if (!(common->wcmGestureMode & GESTURE_SCROLL_MODE))
- wcmFingerZoom(priv);
+ if (!(common->wcmGestureMode & GESTURE_SCROLL_MODE))
+ wcmFingerZoom(priv);
+ }
}
ret:
if (!common->wcmGestureMode && !channel && !is_absolute(priv->pInfo))

0 comments on commit cf5986b

Please sign in to comment.