summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2017-12-08 13:55:32 -0800
committerJason Gerecke <killertofu@gmail.com>2017-12-15 11:02:53 -0800
commit2fa4ef48c98860859d48810d870567fe99b5d76f (patch)
tree1cfcf6e37ff0e2d0f04525b70cd0ef60ea00b61b
parent527fa95c29f6aee2c2d655e834ff3f45a9160c06 (diff)
downloadxf86-input-wacom-2fa4ef48c98860859d48810d870567fe99b5d76f.tar.gz
Do not overwrite raw device state with filtered coordinate values
By performing coordinate filtering in wcmEvent and overwriting the raw device state stored in pChannel, we loose the ability to see the actual (but noisy) hardware coordinates at later points in the code. By moving this filtering into commonDispatchDevice we can apply the result to only the 'filtered' DeviceState sample that is ultimately passed along to wcmSendEvents. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
-rw-r--r--src/wcmCommon.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index dc6ecbd..900544b 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -897,7 +897,6 @@ static Bool check_arbitrated_control(InputInfoPtr pInfo, WacomDeviceStatePtr ds)
void wcmEvent(WacomCommonPtr common, unsigned int channel,
const WacomDeviceState* pState)
{
- WacomDeviceState* pLast;
WacomDeviceState ds;
WacomChannelPtr pChannel;
enum WacomSuppressMode suppress;
@@ -905,7 +904,6 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
WacomToolPtr tool;
WacomDevicePtr priv;
pChannel = common->wcmChannel + channel;
- pLast = &pChannel->valid.state;
DBG(10, common, "channel = %d\n", channel);
@@ -962,21 +960,6 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
ds.tilty = 0;
}
- /* Optionally filter values only while in proximity */
- if (ds.proximity && ds.device_type != PAD_ID)
- {
- /* Start filter fresh when entering proximity */
- if (!pLast->proximity)
- wcmResetSampleCounter(pChannel);
-
- wcmFilterCoord(common,pChannel,&ds);
- }
-
- /* skip event if we don't have enough movement */
- suppress = wcmCheckSuppress(common, pLast, &ds);
- if (suppress == SUPPRESS_ALL)
- return;
-
/* JEJ - Do not move this code without discussing it with me.
* The device state is invariant of any filtering performed below.
* Changing the device state after this point can and will cause
@@ -1251,6 +1234,21 @@ static void commonDispatchDevice(InputInfoPtr pInfo,
filtered.pressure = applyPressureCurve(priv,&filtered);
}
+ /* Optionally filter values only while in proximity */
+ if (filtered.proximity && filtered.device_type != PAD_ID)
+ {
+ /* Start filter fresh when entering proximity */
+ if (!priv->oldState.proximity)
+ wcmResetSampleCounter(pChannel);
+
+ wcmFilterCoord(common,pChannel,&filtered);
+ }
+
+ /* skip event if we don't have enough movement */
+ suppress = wcmCheckSuppress(common, &priv->oldState, &filtered);
+ if (suppress == SUPPRESS_ALL)
+ return;
+
/* Store cursor hardware prox for next use */
if (IsCursor(priv))
priv->oldCursorHwProx = ds->proximity;