On Tue, Aug 21, 2018 at 10:34:03AM -0700, Jason Gerecke wrote: > The default values for zoom, scroll, and spread distances were originally > fine-tuned for use with a 3rd-gen Bamboo small tablet (e.g. CTH-470). The > code tries to scale these values to work with other sensors, but there are > a couple of problems with the actual logic: > > 1. The scaling is done based on the logical size of the tablet. This is > problematic for some generations of tablet (including the 3rd-gen Bamboos) > which use sensors with an identical logical size despite different physical > size. This means that larger tablets in these generations require larger > gestures to accomplish the same task. > > 2. The scale factor for the scroll distance is calculated with respect to > the X axis, even though it is far more common to scroll vertically than > horizontally. For devices with a different resolution in the X and Y axes, > this means that calculated default won't be consistent with devices that > have the same resolution in both the X and Y axes. > > This patch makes several modifications to simultaneously address all > of the issues. We replace the logical Bamboo-referenced numbers with > equivalent millimeters, calculate the logical distances based on the > kernel-reported resolution (using the resolution of the Bamboo if not > not available), and specifically scale scroll distances with respect > to the Y axis. > > The end result is a scroll and zoom feel that is consistent across many > more devices. No longer do you have to make physically-larger gestures > on physically-larger tablets, or physically-smaller gestures on tablets > with higher logical resolution. > > Ref: https://github.com/linuxwacom/input-wacom/issues/33 > Signed-off-by: Jason Gerecke <jason.gere...@wacom.com> > --- > src/wcmValidateDevice.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c > index 95c8a2c..7b7bff2 100644 > --- a/src/wcmValidateDevice.c > +++ b/src/wcmValidateDevice.c > @@ -1044,11 +1044,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 > +/* The values were based on trial and error with a 3rd-gen Bamboo */ > +#define WCM_DEFAULT_MM_XRES (27.8 * 1000) > +#define WCM_DEFAULT_MM_YRES (44.5 * 1000)
tbh I got confused by the naming here. Call it just xres with a units/mm comment or something? otherwise series Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> Cheers, Peter > +#define WCM_ZOOM_DISTANCE_MM 6.5 > +#define WCM_SCROLL_DISTANCE_MM 1.8 > +#define WCM_SCROLL_SPREAD_DISTANCE_MM 12.6 > > /** > * Parse post-init options for this device. Useful for overriding HW > @@ -1075,10 +1076,11 @@ Bool wcmPostInitParseOptions(InputInfoPtr pInfo, Bool > is_primary, > /* 2FG touch device */ > 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); > + int x_res = common->wcmTouchResolX ? common->wcmTouchResolX : > WCM_DEFAULT_MM_XRES; > + int y_res = common->wcmTouchResolY ? common->wcmTouchResolY : > WCM_DEFAULT_MM_YRES; > + int zoom_distance = WCM_ZOOM_DISTANCE_MM * x_res / 1000; > + int scroll_distance = WCM_SCROLL_DISTANCE_MM * y_res / 1000; > + int spread_distance = WCM_SCROLL_SPREAD_DISTANCE_MM * x_res / > 1000; > > common->wcmGestureParameters.wcmZoomDistance = > xf86SetIntOption(pInfo->options, "ZoomDistance", > @@ -1089,8 +1091,7 @@ Bool wcmPostInitParseOptions(InputInfoPtr pInfo, Bool > is_primary, > scroll_distance); > > common->wcmGestureParameters.wcmMaxScrollFingerSpread = > - common->wcmMaxTouchX * > - (WCM_BAMBOO3_SCROLL_SPREAD_DISTANCE / WCM_BAMBOO3_MAXX); > + spread_distance; > } > > > -- > 2.18.0 > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Linuxwacom-devel mailing list > Linuxwacom-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel