summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <jason.gerecke@wacom.com>2019-07-24 13:48:08 -0700
committerJason Gerecke <killertofu@gmail.com>2019-09-04 09:43:04 -0700
commita38074dcfb2350c0253ae4ac3c3745c4977596e5 (patch)
tree577948e9c90b55b271ee6e69fb7dbf9337320114
parent3cf2348aa5b3cb169a0b9d5ce06a243dcd009e0c (diff)
downloadxf86-input-wacom-a38074dcfb2350c0253ae4ac3c3745c4977596e5.tar.gz
Trigger scroll and zoom gestures immediately after they are detected
The amount you have to move your fingers to start a gesture is quite a larger than the amount you have to move them to continue to gesture. This makes the smooth use of gestures difficult since it can be a little unpredictable exactly when they finally kick in. By triggering the zoom and scroll gestures at the same distance as it takes to continue them, the gestures feel much more smooth to execute. This commit removes the various delays that prevent gestures from being executed the moment the configured scroll or zoom distance is achieved. Ref: https://github.com/linuxwacom/xf86-input-wacom/issues/43 Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
-rw-r--r--src/wcmTouchFilter.c13
-rw-r--r--src/wcmValidateDevice.c5
-rw-r--r--src/xf86WacomDefs.h1
3 files changed, 5 insertions, 14 deletions
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index bbbcfcf..41baa12 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -605,7 +605,7 @@ static void wcmSendScrollEvent(WacomDevicePtr priv, int dist,
int button = (dist > 0) ? buttonUp : buttonDn;
WacomCommonPtr common = priv->common;
int count = (int)((1.0 * abs(dist)/
- common->wcmGestureParameters.wcmScrollDistance) + 0.5);
+ common->wcmGestureParameters.wcmScrollDistance));
WacomDeviceState ds[2] = {};
getStateHistory(common, ds, ARRAY_SIZE(ds), 0);
@@ -638,7 +638,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;
+ int max_spread = common->wcmGestureParameters.wcmZoomDistance;
int spread;
if (!common->wcmGesture)
@@ -741,7 +741,7 @@ static void wcmFingerZoom(WacomDevicePtr priv)
int count, button;
int dist = touchDistance(common->wcmGestureState[0],
common->wcmGestureState[1]);
- int max_spread = common->wcmGestureParameters.wcmMaxScrollFingerSpread;
+ int max_spread = common->wcmGestureParameters.wcmZoomDistance;
int spread;
if (!common->wcmGesture)
@@ -756,13 +756,10 @@ static void wcmFingerZoom(WacomDevicePtr priv)
if (common->wcmGestureMode != GESTURE_ZOOM_MODE)
{
/* two fingers moved apart from each other */
- if (spread > (3 * max_spread))
+ if (spread > max_spread)
{
/* left button might be down, send it up first */
wcmSendButtonClick(priv, 1, 0);
-
- /* fingers moved apart more than 3 times
- * wcmMaxScrollFingerSpread, zoom mode is entered */
common->wcmGestureMode = GESTURE_ZOOM_MODE;
}
}
@@ -771,7 +768,7 @@ static void wcmFingerZoom(WacomDevicePtr priv)
return;
dist = touchDistance(ds[0], ds[1]) - dist;
- count = (int)((1.0 * abs(dist)/common->wcmGestureParameters.wcmZoomDistance) + 0.5);
+ count = (int)((1.0 * abs(dist)/common->wcmGestureParameters.wcmZoomDistance));
/* user might have changed from left to right or vice versa */
if (count < common->wcmGestureParameters.wcmGestureUsed)
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 3434dec..a389c81 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -1069,7 +1069,6 @@ error:
#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
@@ -1100,7 +1099,6 @@ Bool wcmPostInitParseOptions(InputInfoPtr pInfo, Bool is_primary,
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,9 +1107,6 @@ Bool wcmPostInitParseOptions(InputInfoPtr pInfo, Bool is_primary,
common->wcmGestureParameters.wcmScrollDistance =
xf86SetIntOption(pInfo->options, "ScrollDistance",
scroll_distance);
-
- common->wcmGestureParameters.wcmMaxScrollFingerSpread =
- spread_distance;
}
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index cab3abf..566211e 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -375,7 +375,6 @@ typedef struct {
int wcmZoomDistance; /* 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 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 */
} WacomGesturesParameters;