On Wed, Aug 31, 2011 at 5:50 PM, Peter Hutterer <peter.hutte...@who-t.net> wrote: > On Wed, Aug 31, 2011 at 09:59:14AM -0500, Chris Bagwell wrote: >> On Wed, Aug 31, 2011 at 1:09 AM, Peter Hutterer >> <peter.hutte...@who-t.net> wrote: >> > On Sat, Aug 27, 2011 at 12:03:19PM -0500, ch...@cnpbagwell.com wrote: >> >> common->wcmGestureParameters.wcmScrollDirection = 0; >> >> - common->wcmGestureParameters.wcmScrollDistance = 20; >> >> - common->wcmGestureParameters.wcmScrollDistanceDefault = 20; >> >> + common->wcmGestureParameters.wcmScrollDistance = -1; >> >> + common->wcmGestureParameters.wcmScrollDistanceDefault = -1; >> >> + common->wcmGestureParameters.wcmInlineDistance = -1; >> >> 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 1600705..0e1e258 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 >> >> @@ -43,6 +42,20 @@ >> >> static void wcmFingerScroll(WacomDevicePtr priv); >> >> static void wcmFingerZoom(WacomDevicePtr priv); >> >> >> >> +void wcmInitGestureSizes(InputInfoPtr pInfo) >> >> +{ >> >> + WacomDevicePtr priv = (WacomDevicePtr) pInfo->private; >> >> + WacomCommonPtr common = priv->common; >> >> + WacomGesturesParameters *gp = &common->wcmGestureParameters; >> >> + >> >> + if (gp->wcmZoomDistance == -1) >> >> + gp->wcmZoomDistance = priv->maxX * (1600.0 / 14720); >> >> + if (gp->wcmScrollDistance == -1) >> >> + gp->wcmScrollDistance = priv->maxX * (640.0 / 14720); >> >> + if (gp->wcmInlineDistance == -1) >> >> + gp->wcmInlineDistance = priv->maxX * (1280.0 / 14720); >> > >> > where do these numbers come from again? >> >> Good question. :-) They come from the original wcm*Distance values >> used in init function that was deleted but scaling them up with "<< 5" >> to match how kernel driver is also scaling up reported values by "<< >> 5". The maximum value of 14720 also comes from latest Bamboo reported >> maximums. >> >> I'm not sure they are ideal values yet but work reasonably well. >> >> > shouldn't they have defines? >> >> Dunno. Your call. xf86-input-synaptics didn't do it for similar >> values. Original code in init didn't either. So I didn't bother. >> >> I can see some value in #define MAX_BAMBOO_X 14720 to let reader know >> where that came from. MAX synaptics X value is a little more defacto >> value so not as confusing. > > > I prefer to use defines wherever we use a number more than once and the > 14720 is such a case. plus, that way we can comment the defines where they > are and make the code independent of the actual value and easier to > understand. whenever magic numbers are used, comments should be there anyway > to explain that they're just that. > > Having a look at this code again I wonder: can we move the default > calculation into wcmParseOptions? no need to set it to -1, use that as a > default and then set it to 1600.0/14720 later. We could just add this magic > number to the xf86SetIntOption call.
I think I forgot to respond to this review comment. The reason I'm using the -1 work around is because wcmInitModel() is called after wcmParseOptions(). The *GetRanges function is called during Init phase and so we do not have touch resolution until after we've initialized the touch related options. There are tricks we could play on a Bamboo because it has a TOUCH+PAD devices and these "common" values get 2 chances to be init'ed (second time with good resolution). But on touchscreen, there is no PAD device and so no second chance. Chris > >> >> diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h >> >> index 60353dc..72d06bb 100644 >> >> --- a/src/xf86Wacom.h >> >> +++ b/src/xf86Wacom.h >> >> @@ -128,6 +128,8 @@ Bool wcmAreaListOverlap(WacomToolAreaPtr area, >> >> WacomToolAreaPtr list); >> >> >> >> /* calculate the proper tablet to screen mapping factor */ >> >> void wcmMappingFactor(InputInfoPtr pInfo); >> >> +/* calculate gesture sizes based on tablet sizes */ >> >> +void wcmInitGestureSizes(InputInfoPtr pInfo); >> >> >> >> /* validation */ >> >> extern Bool wcmIsAValidType(InputInfoPtr pInfo, const char* type); >> >> diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h >> >> index 94eee2e..65b7088 100644 >> >> --- a/src/xf86WacomDefs.h >> >> +++ b/src/xf86WacomDefs.h >> >> @@ -414,6 +414,7 @@ typedef struct { >> >> 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 wcmInlineDistance; /* maximum distance between fingers >> >> for scroll gesture */ >> > >> > this should probably be named something like maxScrollDistance to be more >> > explanatory. >> >> Makes sense. I'll update. Maybe wcmMaxScrollWidth is even better? >> Distance makes me think about fingers traveling. > > MaxScrollFingerGap or -Span comes to mind too. Width is a bit ambiguous > since we use that in synaptics for finger width. > > Cheers, > Peter > > ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel