Hi,

I would like to contribute two patches against the current git master.
Both patches are related to scroll/zoom gestures and were tested on a
serial Wacom tablet in Lenovo X201t.
The first patch is described in the following tracker issue: http://goo.gl/pyhax
"
A patch fixing the delay previously required before the scroll or zoom
gestures. The patch implements the following behavior:
- two fingers enable the zoom/scroll gestures immediately without any
additional delay or lagging
- quick tap using the second finger emits right click
- right click now does not emit left click at the same time
"

The second patch fixes the bug with gestures not being rotated
properly when the orientation of the tablet is changed using the
"Rotate" xsetwacom param.

Cheers,
Andrzej
*** wcmTouchFilterOrig.c	2010-10-25 02:40:37.000000000 +0200
--- wcmTouchFilter.c	2010-12-06 00:36:40.354665306 +0100
***************
*** 128,142 ****
  	    dsLast[1].sample) <= common->wcmGestureParameters.wcmTapTime) &&
  	    !ds[1].proximity && dsLast[1].proximity)
  	{
- 		/* send left up before sending right down */
- 		wcmSendButtonClick(priv, 1, 0);
- 		common->wcmGestureMode = GESTURE_TAP_MODE;
- 
  		/* right button down */
  		wcmSendButtonClick(priv, 3, 1);
- 
  		/* right button up */
  		wcmSendButtonClick(priv, 3, 0);
  	}
  }
  
--- 128,142 ----
  	    dsLast[1].sample) <= common->wcmGestureParameters.wcmTapTime) &&
  	    !ds[1].proximity && dsLast[1].proximity)
  	{
  		/* right button down */
  		wcmSendButtonClick(priv, 3, 1);
  		/* right button up */
  		wcmSendButtonClick(priv, 3, 0);
+ 
+ 		/* send left up AFTER sending right down/up to prevent 
+ 		leftclick from being executed before rightclick */
+ 		wcmSendButtonClick(priv, 1, 0);
+ 		common->wcmGestureMode = GESTURE_TAP_MODE;
  	}
  }
  
***************
*** 194,219 ****
  	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->wcmTouchpadMode = 0;
- 		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))
- 	{
- 		if (!common->wcmGestureMode)
- 			common->wcmGestureMode = GESTURE_LAG_MODE;
- 	}
- 
- 	/* we've waited enough time */
- 	else if (common->wcmGestureMode == GESTURE_LAG_MODE)
- 		common->wcmGestureMode = 0;
  
  	if  (ds[1].proximity && !dsLast[1].proximity)
  	{
--- 194,199 ----
***************
*** 252,267 ****
  		goto ret;
  	}
  
  	if (!(common->wcmGestureMode & (GESTURE_SCROLL_MODE | GESTURE_ZOOM_MODE)))
  		wcmFingerTapToClick(priv);
  
- 	/* Change mode happens only when both fingers are out */
  	if (common->wcmGestureMode & GESTURE_TAP_MODE)
! 		goto ret;
  
! 	/* skip initial finger event for scroll and zoom */
! 	if (!dsLast[0].proximity || !dsLast[1].proximity)
  		goto ret;
  
  	/* was in zoom mode no time check needed */
  	if ((common->wcmGestureMode & GESTURE_ZOOM_MODE) &&
--- 232,255 ----
  		goto ret;
  	}
  
+ 	/** Right click */
  	if (!(common->wcmGestureMode & (GESTURE_SCROLL_MODE | GESTURE_ZOOM_MODE)))
  		wcmFingerTapToClick(priv);
  
  	if (common->wcmGestureMode & GESTURE_TAP_MODE)
! 	{
! 		/* first finger was out-prox when GestureMode was still on */
! 		if (!dsLast[0].proximity && common->wcmGestureMode)
! 			/* send first finger out prox */
! 			wcmSoftOutEvent(priv->pInfo);
  
! 		/* exit scroll/zoom */
! 		common->wcmGestureMode = GESTURE_TAP_MODE;
! 		common->wcmGestureParameters.wcmScrollDirection = 0;
! 
! 		common->wcmTouchpadMode = 0;
  		goto ret;
+ 	}
  
  	/* was in zoom mode no time check needed */
  	if ((common->wcmGestureMode & GESTURE_ZOOM_MODE) &&
***************
*** 272,291 ****
  	else if (common->wcmGestureMode & GESTURE_SCROLL_MODE)
  		    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);
  
  		if (!(common->wcmGestureMode & GESTURE_SCROLL_MODE))
  		    wcmFingerZoom(priv);
  	}
  ret:
  	if (!common->wcmGestureMode && !channel && !is_absolute(priv->pInfo))
  		wcmFirstFingerClick(common);
--- 260,284 ----
  	else if (common->wcmGestureMode & GESTURE_SCROLL_MODE)
  		    wcmFingerScroll(priv);
  
! 	/** Second button pressed while not in gesture mode. */
! 	if ( !(common->wcmGestureMode & (GESTURE_SCROLL_MODE |GESTURE_ZOOM_MODE)) && 
! 	    (ds[1].proximity && ds[0].proximity))
! 	{
! 		// Clean the gesture mode in case lag mode was used
! 		common->wcmGestureMode=0;
! 		
  		/* scroll should be considered first since it requires
  		 * a finger distance check */
  		wcmFingerScroll(priv);
  
  		if (!(common->wcmGestureMode & GESTURE_SCROLL_MODE))
  		    wcmFingerZoom(priv);
+ 		
+ 		// Prevent generation of clicks
+ 		if (!common->wcmGestureMode)
+ 		    common->wcmGestureMode=GESTURE_LAG_MODE;
  	}
+ 
  ret:
  	if (!common->wcmGestureMode && !channel && !is_absolute(priv->pInfo))
  		wcmFirstFingerClick(common);
--- wcmTouchFilterOrig2.c	2010-12-06 00:36:40.000000000 +0100
+++ wcmTouchFilter.c	2010-12-18 00:22:08.413448001 +0100
@@ -54,28 +54,29 @@ static Bool pointsInLine(WacomCommonPtr
 		WacomDeviceState ds1)
 {
 	Bool ret = FALSE;
+	Bool rotated = common->wcmRotate == ROTATE_CW || common->wcmRotate == ROTATE_CCW;
 
 	if (!common->wcmGestureParameters.wcmScrollDirection)
 	{
 		if ((abs(ds0.x - ds1.x) < WACOM_INLINE_DISTANCE) &&
 			(abs(ds0.y - ds1.y) > WACOM_INLINE_DISTANCE))
 		{
-			common->wcmGestureParameters.wcmScrollDirection = WACOM_VERT_ALLOWED;
+			common->wcmGestureParameters.wcmScrollDirection = (rotated)?WACOM_HORIZ_ALLOWED:WACOM_VERT_ALLOWED;
 			ret = TRUE;
 		}
 		if ((abs(ds0.y - ds1.y) < WACOM_INLINE_DISTANCE) &&
 			(abs(ds0.x - ds1.x) > WACOM_INLINE_DISTANCE))
 		{
-			common->wcmGestureParameters.wcmScrollDirection = WACOM_HORIZ_ALLOWED;
+			common->wcmGestureParameters.wcmScrollDirection = (rotated)?WACOM_VERT_ALLOWED:WACOM_HORIZ_ALLOWED;
 			ret = TRUE;
 		}
 	}
-	else if (common->wcmGestureParameters.wcmScrollDirection == WACOM_HORIZ_ALLOWED)
+	else if (common->wcmGestureParameters.wcmScrollDirection == (rotated)?WACOM_VERT_ALLOWED:WACOM_HORIZ_ALLOWED)
 	{
 		if (abs(ds0.y - ds1.y) < WACOM_INLINE_DISTANCE)
 			ret = TRUE;
 	}
-	else if (common->wcmGestureParameters.wcmScrollDirection == WACOM_VERT_ALLOWED)
+	else if (common->wcmGestureParameters.wcmScrollDirection == (rotated)?WACOM_HORIZ_ALLOWED:WACOM_VERT_ALLOWED)
 	{
 		if (abs(ds0.x - ds1.x) < WACOM_INLINE_DISTANCE)
 			ret = TRUE;
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to