[PATCH synaptics v2 11/21] Add from_timer argument to HandleState

Daniel Stone daniel at fooishbar.org
Tue Jun 14 10:05:59 PDT 2011


from_timer denotes whether HandleState was invoked from a timeout (e.g.
to generate fake motion, or for the tap-to-click state machine), or from
a genuine motion event.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/synaptics.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

v2: Split out from hardware time patch; sense of 'actual' inverted and renamed
    to from_timer, commentary added.

diff --git a/src/synaptics.c b/src/synaptics.c
index 1fd9cb8..4396e6e 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -135,7 +135,8 @@ static InputInfoPtr SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 static void SynapticsUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
 static Bool DeviceControl(DeviceIntPtr, int);
 static void ReadInput(InputInfoPtr);
-static int HandleState(InputInfoPtr, struct SynapticsHwState*, CARD32 now);
+static int HandleState(InputInfoPtr, struct SynapticsHwState*, CARD32 now,
+                       Bool from_timer);
 static int ControlProc(InputInfoPtr, xDeviceCtl*);
 static int SwitchMode(ClientPtr, DeviceIntPtr, int);
 static Bool DeviceInit(DeviceIntPtr);
@@ -1229,7 +1230,7 @@ timerFunc(OsTimerPtr timer, CARD32 now, pointer arg)
     hw = priv->hwState;
     hw.millis += now - priv->timer_time;
     priv->hwState.millis = hw.millis;
-    delay = HandleState(pInfo, &hw, hw.millis);
+    delay = HandleState(pInfo, &hw, hw.millis, TRUE);
 
     priv->timer_time = now;
     priv->timer = TimerSet(priv->timer, 0, delay, timerFunc, pInfo);
@@ -1270,7 +1271,7 @@ ReadInput(InputInfoPtr pInfo)
 
     while (SynapticsGetHwState(pInfo, priv, &hw)) {
 	priv->hwState = hw;
-	delay = HandleState(pInfo, &hw, hw.millis);
+	delay = HandleState(pInfo, &hw, hw.millis, FALSE);
 	newDelay = TRUE;
     }
 
@@ -2455,9 +2456,14 @@ repeat_scrollbuttons(const InputInfoPtr pInfo,
  * the hardware state changes. The return value is used to specify how many
  * milliseconds to wait before calling the function again if no state change
  * occurs.
+ *
+ * from_timer denotes if HandleState was triggered from a timer (e.g. to
+ * generate fake motion events, or for the tap-to-click state machine), rather
+ * than from having received a motion event.
  */
 static int
-HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now)
+HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
+            Bool from_timer)
 {
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
     SynapticsParameters *para = &priv->synpara;
-- 
1.7.5.3



More information about the xorg-devel mailing list