diff options
author | Jason Gerecke <killertofu@gmail.com> | 2018-06-25 10:41:56 -0700 |
---|---|---|
committer | Jason Gerecke <killertofu@gmail.com> | 2019-09-04 09:43:04 -0700 |
commit | 1f52ad54c1ae66e25a28c2ca1178921118f9d9c1 (patch) | |
tree | 5b99aff293f7d04f26a9557476de28f72830b60b | |
parent | 65b7c37f0fac5cdd03ff7f977124148d0bdf4be8 (diff) | |
download | xf86-input-wacom-1f52ad54c1ae66e25a28c2ca1178921118f9d9c1.tar.gz |
Overhaul calculation of default scroll, zoom, and spread distances
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
three 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 available), and specifically scale scroll distances with respect
to the Y axis.
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
-rw-r--r-- | src/wcmValidateDevice.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index dda2fff..3434dec 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -1064,11 +1064,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) +#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 @@ -1095,10 +1096,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", @@ -1109,8 +1111,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; } |