On Wednesday, November 23, 2011, Jason Gerecke <killert...@gmail.com> wrote:
> Only question I have is where the value of WCM_BAMBOO3_MAXX comes
> from. I understand its use, but the name indicates to me that its the
> X resolution of a 3rd generation Bamboo... Except that, from what I
> can tell, none of the Bamboos (of any generation) have an X resolution
> of 4096.
>

Its not resolution but max reported by 3rd Gen on touch interface (hid spec
calls it logical Max).

I'll take any suggested name improvement.

> That aside, for all three patches:
>
> Reviewed-by: Jason Gerecke <killert...@gmail.com>

Thanks. I'm away from real computers until Friday so will upload it to
github then.

>
> Jason
>
> ---
> Day xee-nee-svsh duu-'ushtlh-ts'it;
> nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
> Huu-chan xuu naa~-gha.
>
>
>
> On Tue, Nov 22, 2011 at 7:39 PM,  <ch...@cnpbagwell.com> wrote:
>> From: Chris Bagwell <ch...@cnpbagwell.com>
>>
>> 2 finger Gestures will start working on a wider range of
>> hardware with different resolutions now.
>>
>> Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com>
>> ---
>>  src/wcmCommon.c         |    4 ----
>>  src/wcmTouchFilter.c    |   22 ++++++++++++----------
>>  src/wcmValidateDevice.c |   20 +++++++++++++++++---
>>  src/xf86WacomDefs.h     |    3 +--
>>  4 files changed, 30 insertions(+), 19 deletions(-)
>>
>> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
>> index 600991e..f1ef677 100644
>> --- a/src/wcmCommon.c
>> +++ b/src/wcmCommon.c
>> @@ -1395,11 +1395,7 @@ WacomCommonPtr wcmNewCommon(void)
>>        common->wcmFlags = 0;               /* various flags */
>>        common->wcmProtocolLevel = WCM_PROTOCOL_4; /* protocol level */
>>        common->wcmTPCButton = 0;          /* set Tablet PC button on/off
*/
>> -       common->wcmGestureParameters.wcmZoomDistance = 50;
>> -       common->wcmGestureParameters.wcmZoomDistanceDefault = 50;
>>        common->wcmGestureParameters.wcmScrollDirection = 0;
>> -       common->wcmGestureParameters.wcmScrollDistance = 20;
>> -       common->wcmGestureParameters.wcmScrollDistanceDefault = 20;
>>        common->wcmGestureParameters.wcmTapTime = 250;
>>        common->wcmGestureParameters.wcmTapTimeDefault = 250;
>>        common->wcmRotate = ROTATE_NONE;   /* default tablet rotation to
off */
>> diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
>> index b788e34..7fa2975 100644
>> --- a/src/wcmTouchFilter.c
>> +++ b/src/wcmTouchFilter.c
>> @@ -24,7 +24,6 @@
>>  #include <math.h>
>>
>>  /* Defines for 2FC Gesture */
>> -#define WACOM_INLINE_DISTANCE        40
>>  #define WACOM_HORIZ_ALLOWED           1
>>  #define WACOM_VERT_ALLOWED            2
>>  #define WACOM_GESTURE_LAG_TIME       10
>> @@ -61,17 +60,18 @@ static Bool pointsInLine(WacomCommonPtr common,
WacomDeviceState ds0,
>>                        WACOM_HORIZ_ALLOWED : WACOM_VERT_ALLOWED;
>>        int vertical_rotated = (rotated) ?
>>                        WACOM_VERT_ALLOWED : WACOM_HORIZ_ALLOWED;
>> +       int max_spread =
common->wcmGestureParameters.wcmMaxScrollFingerSpread;
>>
>>        if (!common->wcmGestureParameters.wcmScrollDirection)
>>        {
>> -               if ((abs(ds0.x - ds1.x) < WACOM_INLINE_DISTANCE) &&
>> -                       (abs(ds0.y - ds1.y) > WACOM_INLINE_DISTANCE))
>> +               if ((abs(ds0.x - ds1.x) < max_spread) &&
>> +                       (abs(ds0.y - ds1.y) > max_spread))
>>                {
>>                        common->wcmGestureParameters.wcmScrollDirection =
horizon_rotated;
>>                        ret = TRUE;
>>                }
>> -               if ((abs(ds0.y - ds1.y) < WACOM_INLINE_DISTANCE) &&
>> -                       (abs(ds0.x - ds1.x) > WACOM_INLINE_DISTANCE))
>> +               if ((abs(ds0.y - ds1.y) < max_spread) &&
>> +                       (abs(ds0.x - ds1.x) > max_spread))
>>                {
>>                        common->wcmGestureParameters.wcmScrollDirection =
vertical_rotated;
>>                        ret = TRUE;
>> @@ -79,12 +79,12 @@ static Bool pointsInLine(WacomCommonPtr common,
WacomDeviceState ds0,
>>        }
>>        else if (common->wcmGestureParameters.wcmScrollDirection ==
vertical_rotated)
>>        {
>> -               if (abs(ds0.y - ds1.y) < WACOM_INLINE_DISTANCE)
>> +               if (abs(ds0.y - ds1.y) < max_spread)
>>                        ret = TRUE;
>>        }
>>        else if (common->wcmGestureParameters.wcmScrollDirection ==
horizon_rotated)
>>        {
>> -               if (abs(ds0.x - ds1.x) < WACOM_INLINE_DISTANCE)
>> +               if (abs(ds0.x - ds1.x) < max_spread)
>>                        ret = TRUE;
>>        }
>>        return ret;
>> @@ -413,6 +413,7 @@ static void wcmFingerScroll(WacomDevicePtr priv)
>>        int midPoint_old = 0;
>>        int i = 0, dist = 0;
>>        WacomFilterState filterd;  /* borrow this struct */
>> +       int max_spread =
common->wcmGestureParameters.wcmMaxScrollFingerSpread;
>>
>>        DBG(10, priv, "\n");
>>
>> @@ -420,7 +421,7 @@ static void wcmFingerScroll(WacomDevicePtr priv)
>>        {
>>                if (abs(touchDistance(ds[0], ds[1]) -
>>                        touchDistance(common->wcmGestureState[0],
>> -                       common->wcmGestureState[1])) <
WACOM_INLINE_DISTANCE)
>> +                       common->wcmGestureState[1])) < max_spread)
>>                {
>>                        /* two fingers stay close to each other all the
time and
>>                         * move in vertical or horizontal direction
together
>> @@ -510,6 +511,7 @@ static void wcmFingerZoom(WacomDevicePtr priv)
>>        int count, button;
>>        int dist = touchDistance(common->wcmGestureState[0],
>>                        common->wcmGestureState[1]);
>> +       int max_spread =
common->wcmGestureParameters.wcmMaxScrollFingerSpread;
>>
>>        DBG(10, priv, "\n");
>>
>> @@ -519,13 +521,13 @@ static void wcmFingerZoom(WacomDevicePtr priv)
>>                if (abs(touchDistance(ds[0], ds[1]) -
>>                        touchDistance(common->wcmGestureState[0],
>>                                      common->wcmGestureState[1])) >
>> -                       (3 * WACOM_INLINE_DISTANCE))
>> +                       (3 * max_spread))
>>                {
>>                        /* left button might be down, send it up first */
>>                        wcmSendButtonClick(priv, 1, 0);
>>
>>                        /* fingers moved apart more than 3 times
>> -                        * WACOM_INLINE_DISTANCE, zoom mode is entered */
>> +                        * wcmMaxScrollFingerSpread, zoom mode is
entered */
>>                        common->wcmGestureMode = GESTURE_ZOOM_MODE;
>>                }
>>        }
>> diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
>> index e947fbe..d2cf636 100644
>> --- a/src/wcmValidateDevice.c
>> +++ b/src/wcmValidateDevice.c
>> @@ -927,6 +927,12 @@ error:
>>        return FALSE;
>>  }
>>
>> +/* The values were based on trail and error. */
>> +#define WCM_BAMBOO3_MAXX 4096.0
>> +#define WCM_BAMBOO3_ZOOM_DISTANCE 180.0
>> +#define WCM_BAMBOO3_SCROLL_DISTANCE 80.0
>> +#define WCM_BAMBOO3_SCROLL_SPREAD_DISTANCE 350.0
>> +
>>  /**
>>  * Parse post-init options for this device. Useful for overriding HW
>>  * specific options computed during init phase (HW distances for
example).
>> @@ -950,16 +956,24 @@ Bool wcmPostInitParseOptions(InputInfoPtr pInfo,
Bool is_primary,
>>                                           common->wcmMaxZ);
>>
>>        /* 2FG touch device */
>> -       if (TabletHasFeature(common, WCM_2FGT))
>> +       if (TabletHasFeature(common, WCM_2FGT) && IsTouch(priv))
>>        {
>> +               int zoom_distance = common->wcmMaxTouchX *
>> +                       (WCM_BAMBOO3_ZOOM_DISTANCE / WCM_BAMBOO3_MAXX);
>> +               int scroll_distance = common->wcmMaxTouchX *
>> +                       (WCM_BAMBOO3_SCROLL_DISTANCE / WCM_BAMBOO3_MAXX);
>>
>>                common->wcmGestureParameters.wcmZoomDistance =
>>                        xf86SetIntOption(pInfo->options, "ZoomDistance",
>> -
common->wcmGestureParameters.wcmZoomDistanceDefault);
>> +                                        zoom_distance);
>>
>>                common->wcmGestureParameters.wcmScrollDistance =
>>                        xf86SetIntOption(pInfo->options, "ScrollDistance",
>> -
common->wcmGestureParameters.wcmScrollDistanceDefault);
>> +                                        scroll_distance);
>> +
>> +               common->wcmGestureParameters.wcmMaxScrollFingerSpread =
>> +                       common->wcmMaxTouchX *
>> +                       (WCM_BAMBOO3_SCROLL_SPREAD_DISTANCE /
WCM_BAMBOO3_MAXX);
>>        }
>>
>>
>> diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
>> index a95e5d3..417fe1d 100644
>> --- a/src/xf86WacomDefs.h
>> +++ b/src/xf86WacomDefs.h
>> @@ -388,10 +388,9 @@ extern WacomDeviceClass gWacomISDV4Device;
>>
>>  typedef struct {
>>        int wcmZoomDistance;           /* minimum distance for a zoom
touch gesture */
>> -       int wcmZoomDistanceDefault;    /* default minimum distance for a
zoom touch gesture */
>>        int wcmScrollDistance;         /* minimum motion before sending a
scroll gesture */
>>        int wcmScrollDirection;        /* store the vertical or
horizontal bit in use */
>> -       int wcmScrollDistanceDefault;  /* default minimum motion before
sending a scroll gesture */
>> +       int wcmMaxScrollFingerSpread; /* maximum distance between
fingers for scroll gesture */
>>        int wcmGestureUsed;            /* retain used gesture count
within one in-prox event */
>>        int wcmTapTime;                /* minimum time between taps for a
right click */
>>        int wcmTapTimeDefault;         /* default minimum time between
taps for a right click */
>> --
>> 1.7.7.3
>>
>>
>>
------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure
>> contains a definitive record of customers, application performance,
>> security threats, fraudulent activity, and more. Splunk takes this
>> data and makes sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-novd2d
>> _______________________________________________
>> Linuxwacom-devel mailing list
>> Linuxwacom-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>>
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to