diff options
author | Jason Gerecke <jason.gerecke@wacom.com> | 2019-06-19 09:05:46 -0700 |
---|---|---|
committer | Jason Gerecke <jason.gerecke@wacom.com> | 2019-08-12 14:48:59 -0700 |
commit | 2cf46016810056d3fd08c6b7dec3b33089f64672 (patch) | |
tree | 7c061b6f7c0b92a5436faa73003047f6082a1a10 | |
parent | daafdda6e90d9c36ad8f56be1f03d0b402595f30 (diff) | |
download | xf86-input-wacom-2cf46016810056d3fd08c6b7dec3b33089f64672.tar.gz |
Change wcmCursorProxoutDist from a common to a private property
Refactors wcmCursorProxoutDist and related variables so that the information
is tracked on a per-tool basis rather than being considered a common property
of the tablet. This is in preparation for a follow-up patch which will expose
the proxout feature to tools other than the cursor/puck.
Ref: https://github.com/linuxwacom/input-wacom/issues/54
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
-rw-r--r-- | src/wcmCommon.c | 26 | ||||
-rw-r--r-- | src/wcmUSB.c | 10 | ||||
-rw-r--r-- | src/wcmValidateDevice.c | 8 | ||||
-rw-r--r-- | src/wcmXCommand.c | 10 | ||||
-rw-r--r-- | src/xf86WacomDefs.h | 6 |
5 files changed, 30 insertions, 30 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 3c2bc84..d247f14 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1365,7 +1365,7 @@ static void commonDispatchDevice(InputInfoPtr pInfo, } } - /* force out-prox when distance is outside wcmCursorProxoutDist for pucks */ + /* force out-prox when distance from surface exceeds wcmProxoutDist */ if (IsCursor(priv)) { /* Assume the the user clicks the puck buttons while @@ -1375,29 +1375,29 @@ static void commonDispatchDevice(InputInfoPtr pInfo, * 4 for many many kernel versions). */ if (filtered.buttons) - common->wcmMaxCursorDist = filtered.distance; + priv->wcmSurfaceDist = filtered.distance; - DBG(10, common, "Distance over" + DBG(10, priv, "Distance over" " the tablet: %d, ProxoutDist: %d current" - " min/max %d hard prox: %d\n", + " surface %d hard prox: %d\n", filtered.distance, - common->wcmCursorProxoutDist, - common->wcmMaxCursorDist, + priv->wcmProxoutDist, + priv->wcmSurfaceDist, ds->proximity); - if (common->wcmMaxCursorDist) { + if (priv->wcmSurfaceDist) { if (priv->oldState.proximity) { - if (abs(filtered.distance - common->wcmMaxCursorDist) - > common->wcmCursorProxoutDist) + if (abs(filtered.distance - priv->wcmSurfaceDist) + > priv->wcmProxoutDist) filtered.proximity = 0; } /* once it is out. Don't let it in until a hard in */ - /* or it gets inside wcmCursorProxoutDist */ + /* or it gets inside wcmProxoutDist */ else { - if (abs(filtered.distance - common->wcmMaxCursorDist) > - common->wcmCursorProxoutDist && ds->proximity) + if (abs(filtered.distance - priv->wcmSurfaceDist) > + priv->wcmProxoutDist && ds->proximity) return; if (!ds->proximity) return; @@ -1554,7 +1554,7 @@ WacomCommonPtr wcmNewCommon(void) common->wcmMaxTouchY = 1024; /* max touch Y value */ common->wcmMaxStripX = 4096; /* Max fingerstrip X */ common->wcmMaxStripY = 4096; /* Max fingerstrip Y */ - common->wcmCursorProxoutDistDefault = PROXOUT_INTUOS_DISTANCE; + common->wcmProxoutDistDefault = PROXOUT_INTUOS_DISTANCE; /* default to Intuos */ common->wcmSuppress = DEFAULT_SUPPRESS; /* transmit position if increment is superior */ diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 2bec7b4..5cac174 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -501,7 +501,7 @@ static void usbInitProtocol5(WacomCommonPtr common, const char* id, { common->wcmProtocolLevel = WCM_PROTOCOL_5; common->wcmPktLength = sizeof(struct input_event); - common->wcmCursorProxoutDistDefault = PROXOUT_INTUOS_DISTANCE; + common->wcmProxoutDistDefault = PROXOUT_INTUOS_DISTANCE; /* tilt enabled */ common->wcmFlags |= TILT_ENABLED_FLAG; @@ -512,7 +512,7 @@ static void usbInitProtocol4(WacomCommonPtr common, const char* id, { common->wcmProtocolLevel = WCM_PROTOCOL_4; common->wcmPktLength = sizeof(struct input_event); - common->wcmCursorProxoutDistDefault = PROXOUT_GRAPHIRE_DISTANCE; + common->wcmProxoutDistDefault = PROXOUT_GRAPHIRE_DISTANCE; /* tilt disabled */ common->wcmFlags &= ~TILT_ENABLED_FLAG; @@ -838,9 +838,9 @@ static int usbDetectConfig(InputInfoPtr pInfo) else priv->nbuttons = usbdata->nbuttons; - if (!common->wcmCursorProxoutDist) - common->wcmCursorProxoutDist - = common->wcmCursorProxoutDistDefault; + if (!priv->wcmProxoutDist) + priv->wcmProxoutDist + = common->wcmProxoutDistDefault; return TRUE; } diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index 7137c2c..0f34493 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -924,11 +924,11 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary, if (IsCursor(priv)) { - common->wcmCursorProxoutDist = xf86SetIntOption(pInfo->options, "CursorProx", 0); - if (common->wcmCursorProxoutDist < 0 || - common->wcmCursorProxoutDist > common->wcmMaxDist) + priv->wcmProxoutDist = xf86SetIntOption(pInfo->options, "CursorProx", 0); + if (priv->wcmProxoutDist < 0 || + priv->wcmProxoutDist > common->wcmMaxDist) xf86Msg(X_CONFIG, "%s: CursorProx invalid %d \n", - pInfo->name, common->wcmCursorProxoutDist); + pInfo->name, priv->wcmProxoutDist); } priv->topX = xf86SetIntOption(pInfo->options, "TopX", 0); diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 63d1b3d..9828d8b 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -87,7 +87,7 @@ static Atom prop_serials; static Atom prop_serial_binding; static Atom prop_strip_buttons; static Atom prop_wheel_buttons; -static Atom prop_cursorprox; +static Atom prop_proxout; static Atom prop_threshold; static Atom prop_suppress; static Atom prop_touch; @@ -274,8 +274,8 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo) prop_serial_binding = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIAL_BIND, XA_INTEGER, 32, 1, values); if (IsCursor(priv)) { - values[0] = common->wcmCursorProxoutDist; - prop_cursorprox = InitWcmAtom(pInfo->dev, WACOM_PROP_PROXIMITY_THRESHOLD, XA_INTEGER, 32, 1, values); + values[0] = priv->wcmProxoutDist; + prop_proxout = InitWcmAtom(pInfo->dev, WACOM_PROP_PROXIMITY_THRESHOLD, XA_INTEGER, 32, 1, values); } values[0] = (!common->wcmMaxZ) ? 0 : common->wcmThreshold; @@ -835,7 +835,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, return wcmSetActionsProperty(dev, property, prop, checkonly, ARRAY_SIZE(priv->strip_actions), priv->strip_actions, priv->strip_keys); else if (property == prop_wheel_buttons) return wcmSetActionsProperty(dev, property, prop, checkonly, ARRAY_SIZE(priv->wheel_actions), priv->wheel_actions, priv->wheel_keys); - else if (property == prop_cursorprox) + else if (property == prop_proxout) { CARD32 value; @@ -851,7 +851,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, return BadValue; if (!checkonly) - common->wcmCursorProxoutDist = value; + priv->wcmProxoutDist = value; } else if (property == prop_threshold) { const INT32 MAXIMUM = wcmInternalToUserPressure(pInfo, priv->maxCurve); diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h index a2053a8..cab3abf 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -298,6 +298,8 @@ struct _WacomDeviceRec int nPressCtrl[4]; /* control points for curve */ int minPressure; /* the minimum pressure a pen may hold */ int oldMinPressure; /* to record the last minPressure before going out of proximity */ + int wcmSurfaceDist; /* Distance reported by hardware when tool at surface */ + int wcmProxoutDist; /* Distance from surface when proximity-out should be triggered */ unsigned int eventCnt; /* count number of events while in proximity */ int maxRawPressure; /* maximum 'raw' pressure seen until first button event */ WacomToolPtr tool; /* The common tool-structure for this device */ @@ -462,9 +464,7 @@ struct _WacomCommonRec int wcmGestureMode; /* data is in Gesture Mode? */ WacomDeviceState wcmGestureState[MAX_FINGERS]; /* inital state when in gesture mode */ WacomGesturesParameters wcmGestureParameters; - int wcmMaxCursorDist; /* Max mouse distance reported so far */ - int wcmCursorProxoutDist; /* Max mouse distance for proxy-out max/256 units */ - int wcmCursorProxoutDistDefault; /* Default max mouse distance for proxy-out */ + int wcmProxoutDistDefault; /* Default value for wcmProxoutDist */ int wcmSuppress; /* transmit position on delta > supress */ int wcmRawSample; /* Number of raw data used to filter an event */ int wcmPressureRecalibration; /* Determine if pressure recalibration of |