diff options
author | Jason Gerecke <jason.gerecke@wacom.com> | 2022-01-04 11:54:43 -0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2022-02-22 10:41:51 +1000 |
commit | 846c6f51f7c959f984e60064306610f2408a5ffa (patch) | |
tree | 921e0c11bc3c1683cd3898c6f1b66e767870ad5c | |
parent | e981a1c1c70b4ed6a34cfac2cde872905e89f4ed (diff) | |
download | xf86-input-wacom-846c6f51f7c959f984e60064306610f2408a5ffa.tar.gz |
gesture: Make gesture distances and counts unsigned
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
-rw-r--r-- | src/wcmTouchFilter.c | 14 | ||||
-rw-r--r-- | src/xf86WacomDefs.h | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c index 88a2eee..35d45cf 100644 --- a/src/wcmTouchFilter.c +++ b/src/wcmTouchFilter.c @@ -191,11 +191,11 @@ static Bool pointsInLine(WacomCommonPtr common, WacomDeviceState ds0, Bool ret = FALSE; Bool rotated = common->wcmRotate == ROTATE_CW || common->wcmRotate == ROTATE_CCW; - int horizon_rotated = (rotated) ? + unsigned int horizon_rotated = (rotated) ? WACOM_HORIZ_ALLOWED : WACOM_VERT_ALLOWED; - int vertical_rotated = (rotated) ? + unsigned int vertical_rotated = (rotated) ? WACOM_VERT_ALLOWED : WACOM_HORIZ_ALLOWED; - int scroll_threshold = common->wcmGestureParameters.wcmScrollDistance; + unsigned int scroll_threshold = common->wcmGestureParameters.wcmScrollDistance; if (!common->wcmGestureParameters.wcmScrollDirection) { @@ -583,7 +583,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)/ + unsigned int count = (unsigned int)((1.0 * abs(dist)/ common->wcmGestureParameters.wcmScrollDistance)); WacomDeviceState ds[2] = {}; @@ -604,7 +604,7 @@ static void wcmSendScrollEvent(WacomDevicePtr priv, int dist, { wcmSendButtonClick(priv, button, 1); wcmSendButtonClick(priv, button, 0); - DBG(10, priv, "loop count = %d \n", count); + DBG(10, priv, "loop count = %u \n", count); } } @@ -718,7 +718,7 @@ static void wcmFingerZoom(WacomDevicePtr priv) WacomCommonPtr common = priv->common; WacomDeviceState ds[2] = {}; WacomDeviceState *start = common->wcmGestureState; - int count, button; + unsigned int count, button; int dist = touchDistance(common->wcmGestureState[0], common->wcmGestureState[1]); int max_spread = common->wcmGestureParameters.wcmZoomDistance; @@ -748,7 +748,7 @@ static void wcmFingerZoom(WacomDevicePtr priv) return; dist = touchDistance(ds[0], ds[1]) - dist; - count = (int)((1.0 * abs(dist)/common->wcmGestureParameters.wcmZoomDistance)); + count = (unsigned 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/xf86WacomDefs.h b/src/xf86WacomDefs.h index f73edf9..11cf244 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -363,10 +363,10 @@ extern WacomHWClass *WacomGetClassUSB(void); #define PAD_CHANNEL (MAX_CHANNELS-1) 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 wcmGestureUsed; /* retain used gesture count within one in-prox event */ + unsigned int wcmZoomDistance; /* minimum distance for a zoom touch gesture */ + unsigned int wcmScrollDistance; /* minimum motion before sending a scroll gesture */ + unsigned int wcmScrollDirection; /* store the vertical or horizontal bit in use */ + unsigned int wcmGestureUsed; /* retain used gesture count within one in-prox event */ int wcmTapTime; /* minimum time between taps for a right click */ } WacomGesturesParameters; |