[PATCH 21/23] Scroll: Modify ScrollData in repeat_scrollbuttons

Daniel Stone daniel at fooishbar.org
Thu Jun 23 15:12:56 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 6c18976..03a67ab 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2528,7 +2528,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;
@@ -2565,8 +2566,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;
@@ -2730,6 +2737,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
      */
@@ -2745,9 +2755,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.4



More information about the xorg-devel mailing list