summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2016-11-11 08:43:31 -0800
committerJason Gerecke <killertofu@gmail.com>2016-11-14 09:23:21 -0800
commit5bd8f70b9b3d6266e4c8e3c0ffd408d2c2e3c365 (patch)
tree4b54745d4a7667504226e5a506521fb18d2979dd
parent9433019e82b6e3ac5c2ca21ae4fabbb8a6756e38 (diff)
downloadxf86-input-wacom-5bd8f70b9b3d6266e4c8e3c0ffd408d2c2e3c365.tar.gz
Further reduce arbitration priority of cursor devices
Cursor (puck) devices are typically left on the sensor and can emit spurious events that can potentially cause the driver to steal "active" status from another tool. In the past we'd only considered the case where the active tool was a touch but it is reasonable to extend this logic to other tool types. If a cursor emits a spurious event in the middle of a pen dragging, for example, the drag will momentarily stop as the pen is temporarily sent out of prox -- with potentially disasterous results. Additionally, when the pen "returns" in prox on the next event, any currently-applied pressure will be taken as the preload and result in incorrect pressure scaling until the pen is removed from contact. This commit removes the "IsTouch" conditions from the handling of spurious cursor events in check_arbitrated_control. The result is that a cursor will not be granted "active" status in preference to any other tool (and will drop "active" status if gained after 100ms and while no buttons are pressed). Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/wcmCommon.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 689646c..17df7fc 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -854,29 +854,38 @@ static Bool check_arbitrated_control(InputInfoPtr pInfo, WacomDeviceStatePtr ds)
if (IsPad(priv)) {
/* Pad may never be the "active" pointer controller */
+ DBG(6, priv, "Event from pad; not yielding pointer control\n.");
return FALSE;
}
if (active == NULL || active->oldState.device_id == ds->device_id) {
- DBG(11, priv, "Same device ID as active; allowing access.\n");
+ DBG(11, priv, "Event from active device; maintaining pointer control.\n");
return TRUE;
}
- else if (IsCursor(active) && IsTouch(priv)) {
- /* Cursor devices are often left idle in range, so allow touch to
- * grab control if the tool has not been used for some time.
+ else if (IsCursor(active)) {
+ /* Cursor devices are often left idle in range, so allow other devices
+ * to grab control if the tool has not been used for some time.
*/
- return (ds->time - active->oldState.time > 100) && (active->oldState.buttons == 0);
+ Bool yield = (ds->time - active->oldState.time > 100) && (active->oldState.buttons == 0);
+ DBG(6, priv, "Currently-active cursor %s idle; %s pointer control.\n",
+ yield ? "is" : "is not", yield ? "yielding" : "not yielding");
+ return yield;
}
- else if (IsTouch(active) && IsCursor(priv)) {
+ else if (IsCursor(priv)) {
/* An otherwise idle cursor may still occasionally jitter and send
- * events while the user is making active touches. Do not allow
- * the cursor to grab control in this particular case.
+ * events while the user is actively using other tools or touching
+ * the device. Do not allow the cursor to grab control in this
+ * particular case.
*/
+ DBG(6, priv, "Event from non-active cursor; not yielding pointer control.\n");
return FALSE;
}
else {
/* Non-touch input has priority over touch in general */
- return !IsTouch(priv);
+ Bool yield = !IsTouch(priv);
+ DBG(6, priv, "Event from non-active %s device; %s pointer control.\n",
+ yield ? "non-touch" : "touch", yield ? "yielding" : "not yielding");
+ return yield;
}
}