If you perform a two-finger scroll/zoom gesture that takes less than
wcmTapTime milliseconds to complete and has the second touch going up
before the first, the wcmFingerTapToClick function may trigger a right-
click event as you complete the scroll/zoom. The reason for this is
that we call wcmFingerTapToClick for any non-scroll/zoom gesture state.
This isn't technically correct: we should really only be calling the
function when in the LAG state (i.e., while waiting for a two-finger
gesture to occur).

The logic which moves single-finger non-DRAG states into LAG or NONE
modes can conflict with simply checking for the LAG state before calling
wcmFingerTapToClick because very short drags can also be less than
WACOM_GESTURE_LAG_TIME, which will move the ZOOM and SCROLL states to
(single-finger) LAG mode and trigger the right-click gesture anyway.
To ensure this doesn't happen, we add a check for single-finger SCROLL
and ZOOM states just before this block and have it move the mode to
CANCEL which will only be reset once both fingers have gone up.

Ref: https://github.com/linuxwacom/input-wacom/issues/33
Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
---
 src/wcmTouchFilter.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index 3846c88..e355544 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -435,6 +435,14 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
                if (common->wcmGestureMode == GESTURE_NONE_MODE)
                        common->wcmGestureMode = GESTURE_LAG_MODE;
        }
+       /* If we're in a multitouch mode but two fingers aren't in proximity
+        * we should directly head to CANCEL mode and wait for both fingers
+        * to leave the screen.
+        */
+       else if (common->wcmGestureMode & (GESTURE_SCROLL_MODE | 
GESTURE_ZOOM_MODE))
+       {
+               common->wcmGestureMode = GESTURE_CANCEL_MODE;
+       }
        /* When only 1 finger is in proximity, it can be in either LAG mode,
         * NONE mode or DRAG mode.
         * 1 finger LAG mode is a very short time period mainly to debounce
@@ -517,7 +525,7 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
                goto ret;
        }
 
-       if (!(common->wcmGestureMode & (GESTURE_SCROLL_MODE | 
GESTURE_ZOOM_MODE)) && touch_id == 1)
+       if ((common->wcmGestureMode & GESTURE_LAG_MODE) && touch_id == 1)
                wcmFingerTapToClick(priv);
 
        /* Change mode happens only when both fingers are out */
-- 
2.18.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to