summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2018-06-15 11:34:12 -0700
committerJason Gerecke <killertofu@gmail.com>2019-09-04 09:43:04 -0700
commit8cc538503cdadcf6e4801c53a6ad1badc8c7e2d4 (patch)
tree7f74bee3c661111312562692a5956496ea63501b
parent813391f78e3d0a10292b234fc103e60f42362c70 (diff)
downloadxf86-input-wacom-8cc538503cdadcf6e4801c53a6ad1badc8c7e2d4.tar.gz
Minor cleanups for wcmFingerScroll and wcmFingerZoom
Make some especially-long lines a little easier to read. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
-rw-r--r--src/wcmTouchFilter.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index 91428f1..68382c8 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -617,12 +617,14 @@ static void wcmFingerScroll(WacomDevicePtr priv)
{
WacomCommonPtr common = priv->common;
WacomDeviceState ds[2] = {};
+ WacomDeviceState *start = common->wcmGestureState;
int midPoint_new = 0;
int midPoint_old = 0;
int i = 0, dist = 0;
WacomFilterState filterd; /* borrow this struct */
int max_spread = common->wcmGestureParameters.wcmMaxScrollFingerSpread;
int gestureStart = 0;
+ int spread;
if (!common->wcmGesture)
return;
@@ -631,17 +633,17 @@ static void wcmFingerScroll(WacomDevicePtr priv)
DBG(10, priv, "\n");
+ spread = fabs(touchDistance(ds[0], ds[1]) - touchDistance(start[0], start[1]));
+
if (common->wcmGestureMode != GESTURE_SCROLL_MODE)
{
- if (fabs(touchDistance(ds[0], ds[1]) -
- touchDistance(common->wcmGestureState[0],
- common->wcmGestureState[1])) < max_spread)
+ if (spread < max_spread)
{
/* two fingers stay close to each other all the time and
* move in vertical or horizontal direction together
*/
- if (pointsInLine(common, ds[0], common->wcmGestureState[0])
- && pointsInLine(common, ds[1], common->wcmGestureState[1])
+ if (pointsInLine(common, ds[0], start[0])
+ && pointsInLine(common, ds[1], start[1])
&& common->wcmGestureParameters.wcmScrollDirection)
{
/* left button might be down. Send it up first */
@@ -727,10 +729,12 @@ static void wcmFingerZoom(WacomDevicePtr priv)
{
WacomCommonPtr common = priv->common;
WacomDeviceState ds[2] = {};
+ WacomDeviceState *start = common->wcmGestureState;
int count, button;
int dist;
int max_spread = common->wcmGestureParameters.wcmMaxScrollFingerSpread;
int gestureStart = 0;
+ int spread;
if (!common->wcmGesture)
return;
@@ -739,13 +743,12 @@ static void wcmFingerZoom(WacomDevicePtr priv)
DBG(10, priv, "\n");
+ spread = fabs(touchDistance(ds[0], ds[1]) - touchDistance(start[0], start[1]));
+
if (common->wcmGestureMode != GESTURE_ZOOM_MODE)
{
/* two fingers moved apart from each other */
- if (fabs(touchDistance(ds[0], ds[1]) -
- touchDistance(common->wcmGestureState[0],
- common->wcmGestureState[1])) >
- (3 * max_spread))
+ if (spread > (3 * max_spread))
{
/* left button might be down, send it up first */
wcmSendButtonClick(priv, 1, 0);