[PATCH 19/21] Modify ScrollData in repeat_scrollbuttons

Daniel Stone daniel at fooishbar.org
Tue Jun 14 10:06:07 PDT 2011


repeat_scrollbuttons used to read the scroll repeat values and then post
button events directly.  Instead, make it modify ScrollData and let
post_scroll_events take care of sending the scroll events, which
requires moving the repeat_scrollbuttons call upwards.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/synaptics.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 21b2498..ab43bcc 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2525,7 +2525,8 @@ post_scroll_events(const InputInfoPtr pInfo, struct ScrollData scroll)
 static inline int
 repeat_scrollbuttons(const InputInfoPtr pInfo,
                      const struct SynapticsHwState *hw,
-		     int buttons, CARD32 now, int delay)
+		     int buttons, CARD32 now, int delay,
+		     struct ScrollData *sd)
 {
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
     SynapticsParameters *para = &priv->synpara;
@@ -2562,8 +2563,14 @@ repeat_scrollbuttons(const InputInfoPtr pInfo,
 	    while (change) {
 		id = ffs(change);
 		change &= ~(1 << (id - 1));
-		xf86PostButtonEvent(pInfo->dev, FALSE, id, FALSE, 0, 0);
-		xf86PostButtonEvent(pInfo->dev, FALSE, id, TRUE, 0, 0);
+		if (id == 4)
+		    sd->up++;
+		else if (id == 5)
+		    sd->down++;
+		else if (id == 6)
+		    sd->left++;
+		else if (id == 7)
+		    sd->right++;
 	    }
 
 	    priv->nextRepeat = now + repeat_delay;
@@ -2727,6 +2734,9 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
 	xf86PostButtonEvent(pInfo->dev, FALSE, id, (buttons & (1 << (id - 1))), 0, 0);
     }
 
+    if (priv->has_scrollbuttons)
+	delay = repeat_scrollbuttons(pInfo, hw, buttons, now, delay, &scroll);
+
     /* Process scroll events only if coordinates are
      * in the Synaptics Area
      */
@@ -2742,9 +2752,6 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
 	post_button_click(pInfo, 1);
     }
 
-    if (priv->has_scrollbuttons)
-	delay = repeat_scrollbuttons(pInfo, hw, buttons, now, delay);
-
     /* Save old values of some state variables */
     priv->finger_state = finger;
     priv->lastButtons = buttons;
-- 
1.7.5.3



More information about the xorg-devel mailing list