summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-03-09 14:20:35 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-14 08:46:42 +1000
commitf6c1efbc6d22f41fb8a4abd2f57db173a2ac3171 (patch)
treeb27f84249e8d54d817cc2812e6f0cb44dd9da6a6
parentbad1b75524f2fa882e9b6ac7160463fbd3b5cccf (diff)
Add an old_hw_state field to remember the last values
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--src/synaptics.c6
-rw-r--r--src/synapticsstr.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index e2153b9..13f1378 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -957,6 +957,7 @@ DeviceClose(DeviceIntPtr dev)
priv->timer = NULL;
free_shm_data(priv);
SynapticsHwStateFree(&priv->hwState);
+ SynapticsHwStateFree(&priv->old_hw_state);
SynapticsHwStateFree(&priv->local_hw_state);
SynapticsHwStateFree(&priv->comm.hwState);
return RetValue;
@@ -1231,6 +1232,10 @@ DeviceInit(DeviceIntPtr dev)
if (!priv->hwState)
goto fail;
+ priv->old_hw_state = SynapticsHwStateAlloc(priv);
+ if (!priv->old_hw_state)
+ goto fail;
+
priv->local_hw_state = SynapticsHwStateAlloc(priv);
if (!priv->local_hw_state)
goto fail;
@@ -1430,6 +1435,7 @@ ReadInput(InputInfoPtr pInfo)
while (SynapticsGetHwState(pInfo, priv, hw)) {
SynapticsCopyHwState(priv->hwState, hw);
delay = HandleState(pInfo, hw, hw->millis, FALSE);
+ SynapticsCopyHwState(priv->old_hw_state, priv->hwState);
newDelay = TRUE;
}
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 92c64fb..b346293 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -193,6 +193,7 @@ struct _SynapticsPrivateRec
void *proto_data; /* protocol-specific data */
struct SynapticsHwState *hwState;
+ struct SynapticsHwState *old_hw_state; /* previous hw state */
const char *device; /* device node */
Bool shm_config; /* True when shared memory area allocated */