On Sun, Feb 20, 2011 at 10:49:33PM -0600, [email protected] wrote:
> From: Chris Bagwell <[email protected]>
> 
> Previous behavior required a double-tap to get a single finger
> tap to work and didn't always work for me.  Its behavior was basically
> tap-and-drag gesture instead of tap-to-click.
> 
> Converted to standard touchpad behavior of single tap based on finger
> release.  This is arguely the more important gesture to users.
> 
> Removed wcmTouchpadMode since it wasn't needed for simple tap-to-click
> gesture.  If tap-and-drag gets added back and needs a variable, it can
> be added back with a name that has "drag" in it to understand its
> intended usage.
> 
> Signed-off-by: Chris Bagwell <[email protected]>
> ---

merged, thanks. sorry about the delay.

Cheers,
  Peter

>  src/wcmCommon.c      |    3 --
>  src/wcmTouchFilter.c |   59 +++++++++++++++++++++++++++++--------------------
>  src/xf86WacomDefs.h  |    1 -
>  3 files changed, 35 insertions(+), 28 deletions(-)
> 
> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
> index 926fbc4..e469e15 100644
> --- a/src/wcmCommon.c
> +++ b/src/wcmCommon.c
> @@ -1430,9 +1430,6 @@ void wcmSoftOutEvent(InputInfoPtr pInfo)
>       out.device_id = wcmGetPhyDeviceID(priv);
>       DBG(2, priv->common, "send a soft prox-out\n");
>       wcmSendEvents(pInfo, &out);
> -
> -     if (out.device_type == TOUCH_ID)
> -             priv->common->wcmTouchpadMode = 0;
>  }
>  
>  
> /*****************************************************************************
> diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
> index 793d649..093d91f 100644
> --- a/src/wcmTouchFilter.c
> +++ b/src/wcmTouchFilter.c
> @@ -141,32 +141,45 @@ static void wcmFingerTapToClick(WacomDevicePtr priv)
>  }
>  
>  
> -/* process single finger Relative mode events
> - * if touch is not in an active gesture mode.
> +/* A single finger tap is defined as 1 finger tap that lasts less than
> + * wcmTapTime.  It results in a left button press.
> + *
> + * Some work must be done to make sure two fingers were not touching
> + * during this gesture. This is easy if first finger is released
> + * first.  To handle case of second finger released first, require
> + * second finger to have been released before first finger ever touched.
> + *
> + * Function relies on ds[0/1].sample to be updated only when entering or
> + * exiting proximity so no storage is needed when initial touch occurs.
>   */
> -static void wcmFirstFingerClick(WacomCommonPtr common)
> +static void wcmSingleFingerTap(WacomDevicePtr priv)
>  {
> -     static int tmpStamp = 0;
> -     WacomChannelPtr aChannel = common->wcmChannel;
> -     WacomDeviceState ds = aChannel->valid.states[0];
> -     WacomDeviceState dsLast = aChannel->valid.states[1];
> -     if (ds.proximity)
> +     WacomCommonPtr common = priv->common;
> +     WacomChannelPtr firstChannel = common->wcmChannel;
> +     WacomChannelPtr secondChannel = common->wcmChannel + 1;
> +     WacomDeviceState ds[2] = { firstChannel->valid.states[0],
> +                                secondChannel->valid.states[0] };
> +     WacomDeviceState dsLast[2] = { firstChannel->valid.states[1],
> +                                     secondChannel->valid.states[1] };
> +
> +     DBG(10, priv, "\n");
> +
> +     if (!ds[0].proximity && dsLast[0].proximity && !ds[1].proximity)
>       {
> -             if (common->wcmTouchpadMode)
> -                     /* continuing left button down */
> -                     aChannel->valid.states[0].buttons |= 1;
> -             else if (!dsLast.proximity &&
> -                 (abs(tmpStamp - ds.sample) <= 
> common->wcmGestureParameters.wcmTapTime))
> +             /* Single Tap must have lasted less than wcmTapTime
> +              * and second finger must not have released after
> +              * first finger touched.
> +              */
> +             if (ds[0].sample - dsLast[0].sample <=
> +                 common->wcmGestureParameters.wcmTapTime &&
> +                 ds[1].sample < dsLast[0].sample)
>               {
> -                     /* initial left button down */
> -                     aChannel->valid.states[0].buttons |= 1;
> -                     common->wcmTouchpadMode = 1;
> +                     /* left button down */
> +                     wcmSendButtonClick(priv, 1, 1);
> +
> +                     /* left button up */
> +                     wcmSendButtonClick(priv, 1, 0);
>               }
> -     } else {
> -             tmpStamp = GetTimeInMillis();
> -             if (common->wcmTouchpadMode)
> -                     aChannel->valid.states[0].buttons &= ~1;
> -             common->wcmTouchpadMode = 0;
>       }
>  }
>  
> @@ -198,7 +211,6 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel)
>        * was in in prox */
>       if (ds[1].proximity && !common->wcmGestureMode && dsLast[0].proximity)
>       {
> -             common->wcmTouchpadMode = 0;
>               common->wcmGestureMode = GESTURE_LAG_MODE;
>       }
>  
> @@ -248,7 +260,6 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel)
>               common->wcmGestureMode = 0;
>               common->wcmGestureParameters.wcmScrollDirection = 0;
>  
> -             common->wcmTouchpadMode = 0;
>               goto ret;
>       }
>  
> @@ -288,7 +299,7 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel)
>       }
>  ret:
>       if (!common->wcmGestureMode && !channel && !is_absolute(priv->pInfo))
> -             wcmFirstFingerClick(common);
> +             wcmSingleFingerTap(priv);
>  }
>  
>  static void wcmSendScrollEvent(WacomDevicePtr priv, int dist,
> diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
> index 91adf72..d72a493 100644
> --- a/src/xf86WacomDefs.h
> +++ b/src/xf86WacomDefs.h
> @@ -460,7 +460,6 @@ struct _WacomCommonRec
>       int wcmGesture;              /* disable/enable touch gesture */
>       int wcmGestureDefault;       /* default touch gesture to disable when 
> not supported */
>       int wcmGestureMode;            /* data is in Gesture Mode? */
> -     int wcmTouchpadMode;           /* in touchpad mode? */
>       WacomDeviceState wcmGestureState[MAX_FINGERS]; /* inital state when in 
> gesture mode */
>       int wcmCapacity;             /* disable/enable capacity */
>       int wcmCapacityDefault;      /* default to -1 when capacity isn't 
> supported/disabled */
> -- 
> 1.7.3.4

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to