The new GESTURE_CANCEL_MODE is used to short-circuit the gesture recognition logic until all touches have been removed from the device. By using the wcmCancelGesture function, any in-progress gesture will be canceled and cause the driver to ignore further touch input until a new gesture is started.
This is used by the arbitration logic to ensure that touches which accumulate in the valid.state list while a pen is in proximity do not suddenly trigger a gesture at the moment the pen leaves prox. Signed-off-by: Jason Gerecke <killert...@gmail.com> --- src/wcmCommon.c | 1 + src/wcmTouchFilter.c | 32 ++++++++++++++++++++++++++++++++ src/xf86Wacom.h | 1 + 3 files changed, 34 insertions(+) diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 4e7098a..61c42b5 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -970,6 +970,7 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel, if (check_arbitrated_control(pInfo, &ds)) { if (WACOM_DRIVER.active != NULL && priv != WACOM_DRIVER.active) { wcmSoftOutEvent(WACOM_DRIVER.active->pInfo); + wcmCancelGesture(WACOM_DRIVER.active->pInfo); } if (ds.proximity) WACOM_DRIVER.active = priv; diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c index 166d2a0..e4316e8 100644 --- a/src/wcmTouchFilter.c +++ b/src/wcmTouchFilter.c @@ -37,6 +37,7 @@ #define GESTURE_LAG_MODE 8 #define GESTURE_PREDRAG_MODE 16 #define GESTURE_DRAG_MODE 32 +#define GESTURE_CANCEL_MODE 64 #define WCM_SCROLL_UP 5 /* vertical up */ #define WCM_SCROLL_DOWN 4 /* vertical down */ @@ -327,6 +328,26 @@ static void wcmSingleFingerPress(WacomDevicePtr priv) } } + +/** + * Cancel any in-progress gesture, returning to GESTURE_NONE_MODE until new + * fingers enter proximity. + * + * @param priv + */ +void wcmCancelGesture(InputInfoPtr pInfo) +{ + WacomDevicePtr priv = pInfo->private; + WacomCommonPtr common = priv->common; + + if (!IsTouch(priv)) + return; + + if (common->wcmGestureMode == GESTURE_DRAG_MODE) + wcmSendButtonClick(priv, 1, 0); + common->wcmGestureMode = GESTURE_CANCEL_MODE; +} + /* parsing gesture mode according to 2FGT data */ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) { @@ -355,6 +376,17 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) return; } + /* Do not process gestures while in CANCEL mode. Only reset back to + * NONE mode once all fingers have left the screen. + */ + if (common->wcmGestureMode == GESTURE_CANCEL_MODE) + { + if (ds[0].proximity || ds[1].proximity) + return; + else + common->wcmGestureMode = GESTURE_NONE_MODE; + } + /* 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 diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h index 514a5c2..63a8623 100644 --- a/src/xf86Wacom.h +++ b/src/xf86Wacom.h @@ -146,6 +146,7 @@ extern int wcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode); extern int wcmTilt2R(int x, int y, double offset); extern void wcmEmitKeycode(DeviceIntPtr keydev, int keycode, int state); extern void wcmSoftOutEvent(InputInfoPtr pInfo); +extern void wcmCancelGesture(InputInfoPtr pInfo); extern void wcmRotateTablet(InputInfoPtr pInfo, int value); extern void wcmRotateAndScaleCoordinates(InputInfoPtr pInfo, int* x, int* y); -- 2.0.2 ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel