diff options
author | Jason Gerecke <jason.gerecke@wacom.com> | 2019-09-03 13:29:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-03 13:29:39 -0700 |
commit | 0ac49a26d25279b7777239066aff8e1f5f23bd4b (patch) | |
tree | 29fea551476088d8eb49a900b6fbf221e816013a | |
parent | 299e830bb7fcc4d73bbad12244de90d0c4bdd9d3 (diff) | |
parent | bde3339eb056d8ac237b9caacdef20dcf38d0d9f (diff) | |
download | xf86-input-wacom-0ac49a26d25279b7777239066aff8e1f5f23bd4b.tar.gz |
Merge pull request #73 from jigpu/fix-54
Allow stylus devices to have "CursorProximity" effect in relative mode
Reviewed-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
-rw-r--r-- | man/wacom.man | 7 | ||||
-rw-r--r-- | man/xsetwacom.man | 7 | ||||
-rw-r--r-- | src/wcmCommon.c | 34 | ||||
-rw-r--r-- | src/wcmUSB.c | 13 | ||||
-rw-r--r-- | src/wcmValidateDevice.c | 14 | ||||
-rw-r--r-- | src/wcmXCommand.c | 14 | ||||
-rw-r--r-- | src/xf86WacomDefs.h | 6 |
7 files changed, 52 insertions, 43 deletions
diff --git a/man/wacom.man b/man/wacom.man index e8b9513..6bf523c 100644 --- a/man/wacom.man +++ b/man/wacom.man @@ -214,9 +214,10 @@ X server is running, no other programs will be able to read the event stream. Default: "false". .TP 4 .B Option \fI"CursorProx"\fP \fI"number"\fP -sets the max distance from tablet to stop reporting movement for the cursor. -Default for Intuos series is 10, for Graphire series (including Volitos) is -42. Only available for the cursor/puck device. +sets the distance at which a relative tool is treated as being out of proximity. +Beyond this distance the cursor will stop responding to tool motion. The +default value for pucks is 10 (Intuos Pro) or 42 (Intuos/Bamboo). The default +value for pens is 30. .TP 4 .B Option \fI"RawSample"\fP \fI"number"\fP Set the sample window size (a sliding average sampling window) for diff --git a/man/xsetwacom.man b/man/xsetwacom.man index d919e5c..bbd5863 100644 --- a/man/xsetwacom.man +++ b/man/xsetwacom.man @@ -255,9 +255,10 @@ This is a read-only parameter. Initial touch switch state is retrieved from the kernel when X driver starts. .TP \fBCursorProximity\fR distance -sets the max distance from tablet to stop reporting movement for cursor in -relative mode. Default for Intuos series is 10, for Graphire series (including -Volitos) is 42. Only available for the cursor/puck device. +Set the distance at which a relative tool is treated as being out of proximity. +Beyond this distance the cursor will stop responding to tool motion. The +default value for pucks is 10 (Intuos Pro) or 42 (Intuos/Bamboo). The default +value for pens is 30. .TP \fBThreshold\fR level Set the minimum pressure necessary to generate a Button event for the stylus diff --git a/src/wcmCommon.c b/src/wcmCommon.c index b1a468a..805d3cc 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1364,39 +1364,41 @@ static void commonDispatchDevice(InputInfoPtr pInfo, } } - /* force out-prox when distance is outside wcmCursorProxoutDist for pucks */ - if (IsCursor(priv)) + /* force out-prox when distance from surface exceeds wcmProxoutDist */ + if (IsTablet(priv) && !is_absolute(pInfo)) { /* Assume the the user clicks the puck buttons while - * it is resting on the tablet. This works for both + * it is resting on the tablet (and taps styli onto + * the tablet surface). This works for both * tablets that have a normal distance scale (protocol * 5) as well as those with an inverted scale (protocol * 4 for many many kernel versions). */ - if (filtered.buttons) - common->wcmMaxCursorDist = filtered.distance; + if ((IsCursor(priv) && filtered.buttons) || + (IsStylus(priv) && filtered.buttons & 0x01)) + 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 >= 0) { 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; @@ -1553,7 +1555,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..f7aea3a 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,12 @@ static int usbDetectConfig(InputInfoPtr pInfo) else priv->nbuttons = usbdata->nbuttons; - if (!common->wcmCursorProxoutDist) - common->wcmCursorProxoutDist - = common->wcmCursorProxoutDistDefault; + if (!priv->wcmProxoutDist) { + priv->wcmProxoutDist + = common->wcmProxoutDistDefault; + if (IsStylus(priv)) + priv->wcmProxoutDist = 30; + } return TRUE; } diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index 7137c2c..dda2fff 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -922,13 +922,15 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary, if (wcmParseSerials (pInfo) != 0) goto error; - if (IsCursor(priv)) + if (IsTablet(priv)) { - common->wcmCursorProxoutDist = xf86SetIntOption(pInfo->options, "CursorProx", 0); - if (common->wcmCursorProxoutDist < 0 || - common->wcmCursorProxoutDist > common->wcmMaxDist) - xf86Msg(X_CONFIG, "%s: CursorProx invalid %d \n", - pInfo->name, common->wcmCursorProxoutDist); + const char *prop = IsCursor(priv) ? "CursorProx" : "StylusProx"; + priv->wcmProxoutDist = xf86SetIntOption(pInfo->options, prop, 0); + if (priv->wcmProxoutDist < 0 || + priv->wcmProxoutDist > common->wcmMaxDist) + xf86Msg(X_CONFIG, "%s: %s invalid %d \n", + pInfo->name, prop, priv->wcmProxoutDist); + priv->wcmSurfaceDist = -1; } priv->topX = xf86SetIntOption(pInfo->options, "TopX", 0); diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 63d1b3d..154be1d 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; @@ -273,9 +273,9 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo) values[0] = priv->serial; 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); + if (IsTablet(priv)) { + 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,14 +835,14 @@ 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; if (prop->size != 1 || prop->format != 32) return BadValue; - if (!IsCursor (priv)) + if (!IsTablet (priv)) return BadValue; value = *(CARD32*)prop->data; @@ -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 |