[PATCH synaptics v5 06/18] Add an old_hw_state field to remember the last values

Peter Hutterer peter.hutterer at who-t.net
Mon Mar 12 23:37:33 PDT 2012


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/synaptics.c    |    6 ++++++
 src/synapticsstr.h |    1 +
 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 */
-- 
1.7.7.6



More information about the xorg-devel mailing list