From: Chris Bagwell <[email protected]>

When trying to do a 2 finger scroll, the cursor was previously
moving around until taptime because wcmGestureMode was mistakenly
being set back to zero.  It was falling into 1 finger else {}
case once past WACOM_GESTURE_LAG_TIME.

To see issue, try scrolling in a web browser or terminal window on a Tablet
PC and you'll see lots of unwanted text selection because of cursor
movement + button press.

Rearrange code so that coming out of LAG will never happen in two finger
case.  Changed from using dsLast[0] to ds[0] to stop an additional packet
worth of movement up front.

Also, rearrange related logic to be more obvious for 1 finger vs 2 finger
case.

Signed-off-by: Chris Bagwell <[email protected]>
---
 src/wcmTouchFilter.c |   49 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index 72cc937..d2b2cf2 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -213,25 +213,46 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel)
        if (!common->wcmGesture)
                goto ret;
 
-       /* second finger in prox. wait for gesture event if first finger
-        * was in in prox */
-       if (ds[1].proximity && !common->wcmGestureMode && dsLast[0].proximity)
-       {
-               common->wcmGestureMode = GESTURE_LAG_MODE;
-       }
-
-       /* first finger recently came in prox. But not the first time
-        * wait for the second one for a certain time */
-       else if (dsLast[0].proximity &&
-           ((GetTimeInMillis() - ds[0].sample) < WACOM_GESTURE_LAG_TIME))
+       /* 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
+        * prevents cursor movement.  Force to LAG mode if ever in NONE
+        * mode to stop cursor movement.
+        */
+       if (ds[0].proximity && ds[1].proximity)
        {
                if (!common->wcmGestureMode)
                        common->wcmGestureMode = GESTURE_LAG_MODE;
        }
+       /* When only 1 finger is in proximity, it can be in either LAG mode
+        * or NONE mode.
+        * 1 finger LAG mode is a very short time period mainly to debounce
+        * initial touch.
+        * NONE mode means cursor is allowed to move around.
+        * TODO: This has to use dsLast[0] because of later logic that
+        * whats mode to be NONE still when 1st entering proximity.
+        * That could use some re-arranging/cleanup.
+        *
+        */
+       else if (dsLast[0].proximity)
+       {
+               CARD32 ms = GetTimeInMillis();
 
-       /* we've waited enough time */
-       else if (common->wcmGestureMode == GESTURE_LAG_MODE)
-               common->wcmGestureMode = 0;
+               if ((ms - ds[0].sample) < WACOM_GESTURE_LAG_TIME)
+               {
+                       /* Must have recently come into proximity.  Change
+                        * into LAG mode.
+                        */
+                       if (!common->wcmGestureMode)
+                               common->wcmGestureMode = GESTURE_LAG_MODE;
+               }
+               else
+               {
+                       /* Been in LAG mode long enough.  Go to NONE mode. */
+                       if (common->wcmGestureMode == GESTURE_LAG_MODE)
+                               common->wcmGestureMode = 0;
+               }
+       }
 
        if  (ds[1].proximity && !dsLast[1].proximity)
        {
-- 
1.7.6


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to