diff options
author | Jason Gerecke <jason.gerecke@wacom.com> | 2019-10-09 14:04:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-09 14:04:22 -0700 |
commit | 76878df9a7bbcead2375a19fd1683f830e6941bb (patch) | |
tree | 67a65ff24bd0ef97c8d3d70f19037510099580a3 | |
parent | 3a4b96139e27a593c869fe28999211d6c90142eb (diff) | |
parent | af2fafdff96ba4f087fcbe4ce4ddc57916614e84 (diff) | |
download | xf86-input-wacom-76878df9a7bbcead2375a19fd1683f830e6941bb.tar.gz |
Merge pull request #84 from jigpu/gesture-mods
Gesture mode default change
Reviewed-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
-rw-r--r-- | src/wcmTouchFilter.c | 67 | ||||
-rw-r--r-- | src/wcmValidateDevice.c | 7 | ||||
-rw-r--r-- | src/xf86WacomDefs.h | 1 |
3 files changed, 31 insertions, 44 deletions
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c index 41baa12..dbd3c01 100644 --- a/src/wcmTouchFilter.c +++ b/src/wcmTouchFilter.c @@ -154,14 +154,6 @@ wcmFingerMultitouch(WacomDevicePtr priv, int contact_id) { Bool prox = FALSE; int i; - if (lag_mode && TabletHasFeature(priv->common, WCM_LCD)) { - /* wcmSingleFingerPress triggers a button press as - * soon as a single finger appears. ensure we release - * that button before getting too far along - */ - wcmSendButtonClick(priv, 1, 0); - } - for (i = 0; i < MAX_CHANNELS; i++) { WacomChannelPtr channel = priv->common->wcmChannel+i; WacomDeviceState state = channel->valid.state; @@ -426,6 +418,30 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) return; } + /* Send multitouch data to X if appropriate */ + if (!common->wcmGesture) { + switch (common->wcmGestureMode) { + case GESTURE_CANCEL_MODE: + break; + case GESTURE_NONE_MODE: + if (TabletHasFeature(common, WCM_LCD)) + common->wcmGestureMode = GESTURE_MULTITOUCH_MODE; + else if (ds[1].proximity) + common->wcmGestureMode = GESTURE_LAG_MODE; + /* fall through */ + case GESTURE_LAG_MODE: + case GESTURE_MULTITOUCH_MODE: + if (common->wcmGestureMode != GESTURE_NONE_MODE) + wcmFingerMultitouch(priv, touch_id); + break; + default: + wcmCancelGesture(priv->pInfo); + break; + } + } + if (common->wcmGestureMode == GESTURE_MULTITOUCH_MODE) + return; + /* Do not process gestures while in CANCEL mode. Only reset back to * NONE mode once all fingers have left the screen. */ @@ -437,9 +453,6 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) common->wcmGestureMode = GESTURE_NONE_MODE; } - if (common->wcmGestureMode == GESTURE_MULTITOUCH_MODE) - goto ret; - /* When 2 fingers are in proximity, it must always be in one of * the valid 2 fingers modes: LAG, SCROLL, or ZOOM. * LAG mode is used while deciding between SCROLL and ZOOM and @@ -548,23 +561,18 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) if (common->wcmGestureMode & GESTURE_TAP_MODE) goto ret; - /* skip initial finger event for scroll and zoom */ - if (!dsLast[0].proximity || !dsLast[1].proximity) - goto ret; - /* continue zooming if already in zoom mode */ - if ((common->wcmGestureMode & GESTURE_ZOOM_MODE) && - ds[0].proximity && ds[1].proximity) + if ((common->wcmGestureMode & GESTURE_ZOOM_MODE)) wcmFingerZoom(priv); /* continue scrollling if already in scroll mode */ else if (common->wcmGestureMode & GESTURE_SCROLL_MODE) - wcmFingerScroll(priv); + wcmFingerScroll(priv); /* process complex two finger gestures */ - else { - if (ds[0].proximity && ds[1].proximity) - { + else if (ds[0].proximity && ds[1].proximity) + { + if (dsLast[0].proximity && dsLast[1].proximity) { /* scroll should be considered first since it requires * a finger distance check */ wcmFingerScroll(priv); @@ -574,23 +582,6 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) } } ret: - -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16 - /* Send multitouch data to X if appropriate */ - if (!common->wcmGesture) { - if (common->wcmGestureMode == GESTURE_NONE_MODE) { - if (TabletHasFeature(common, WCM_LCD)) - common->wcmGestureMode = GESTURE_MULTITOUCH_MODE; - else if (ds[1].proximity) - common->wcmGestureMode = GESTURE_LAG_MODE; - } - - if (common->wcmGestureMode == GESTURE_LAG_MODE || - common->wcmGestureMode == GESTURE_MULTITOUCH_MODE) - wcmFingerMultitouch(priv, touch_id); - } -#endif - if ((common->wcmGestureMode == GESTURE_NONE_MODE || common->wcmGestureMode == GESTURE_DRAG_MODE) && touch_id == 0) { diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index 0b20bd7..6176139 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -1019,13 +1019,10 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary, if (TabletHasFeature(common, WCM_2FGT)) { int gesture_is_on; - - /* GestureDefault was off for all devices - * except when multi-touch is supported */ - common->wcmGestureDefault = 1; + Bool gesture_default = TabletHasFeature(priv->common, WCM_LCD) ? FALSE : TRUE; gesture_is_on = xf86SetBoolOption(pInfo->options, "Gesture", - common->wcmGestureDefault); + gesture_default); if (is_primary || IsTouch(priv)) common->wcmGesture = gesture_is_on; diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h index 566211e..3305740 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -459,7 +459,6 @@ struct _WacomCommonRec int wcmTouch; /* disable/enable touch event */ int wcmTouchDefault; /* default to disable when not supported */ int wcmGesture; /* disable/enable touch gesture */ - int wcmGestureDefault; /* default touch gesture to disable when not supported */ int wcmGestureMode; /* data is in Gesture Mode? */ WacomDeviceState wcmGestureState[MAX_FINGERS]; /* inital state when in gesture mode */ WacomGesturesParameters wcmGestureParameters; |