summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2019-09-04 10:27:08 -0700
committerJason Gerecke <killertofu@gmail.com>2019-09-19 13:53:55 -0700
commitaf2fafdff96ba4f087fcbe4ce4ddc57916614e84 (patch)
tree67a65ff24bd0ef97c8d3d70f19037510099580a3
parent009f7424a21cd56404c9827d69e6920551bf43c8 (diff)
downloadxf86-input-wacom-af2fafdff96ba4f087fcbe4ce4ddc57916614e84.tar.gz
Handle multitouch mode up at the very start wcmGestureFilter
Moving the code which handles multitouch mode to the start of the function both makes the code more obvious and ensures that we don't accidentally recognize an unwanted gesture. Doing so much partial-processing before eventually hitting a "goto ret" and handling multitouch mode was tricky to understand and hard to verify. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
-rw-r--r--src/wcmTouchFilter.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index d759d23..dbd3c01 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -418,6 +418,30 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
return;
}
+ /* Send multitouch data to X if appropriate */
+ if (!common->wcmGesture) {
+ switch (common->wcmGestureMode) {
+ case GESTURE_CANCEL_MODE:
+ break;
+ case GESTURE_NONE_MODE:
+ if (TabletHasFeature(common, WCM_LCD))
+ common->wcmGestureMode = GESTURE_MULTITOUCH_MODE;
+ else if (ds[1].proximity)
+ common->wcmGestureMode = GESTURE_LAG_MODE;
+ /* fall through */
+ case GESTURE_LAG_MODE:
+ case GESTURE_MULTITOUCH_MODE:
+ if (common->wcmGestureMode != GESTURE_NONE_MODE)
+ wcmFingerMultitouch(priv, touch_id);
+ break;
+ default:
+ wcmCancelGesture(priv->pInfo);
+ break;
+ }
+ }
+ if (common->wcmGestureMode == GESTURE_MULTITOUCH_MODE)
+ return;
+
/* Do not process gestures while in CANCEL mode. Only reset back to
* NONE mode once all fingers have left the screen.
*/
@@ -429,9 +453,6 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
common->wcmGestureMode = GESTURE_NONE_MODE;
}
- if (common->wcmGestureMode == GESTURE_MULTITOUCH_MODE)
- goto ret;
-
/* When 2 fingers are in proximity, it must always be in one of
* the valid 2 fingers modes: LAG, SCROLL, or ZOOM.
* LAG mode is used while deciding between SCROLL and ZOOM and
@@ -561,21 +582,6 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
}
}
ret:
-
- /* Send multitouch data to X if appropriate */
- if (!common->wcmGesture) {
- if (common->wcmGestureMode == GESTURE_NONE_MODE) {
- if (TabletHasFeature(common, WCM_LCD))
- common->wcmGestureMode = GESTURE_MULTITOUCH_MODE;
- else if (ds[1].proximity)
- common->wcmGestureMode = GESTURE_LAG_MODE;
- }
-
- if (common->wcmGestureMode == GESTURE_LAG_MODE ||
- common->wcmGestureMode == GESTURE_MULTITOUCH_MODE)
- wcmFingerMultitouch(priv, touch_id);
- }
-
if ((common->wcmGestureMode == GESTURE_NONE_MODE || common->wcmGestureMode == GESTURE_DRAG_MODE) &&
touch_id == 0)
{