[PATCH 13/15] Modify ScrollData in repeat_scrollbuttons

Peter Hutterer peter.hutterer at who-t.net
Mon Jun 13 22:34:16 PDT 2011


On Thu, Jun 09, 2011 at 08:57:34PM +0100, Daniel Stone wrote:
> 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>

but I'm also quite tempted to throw support for hw scroll buttons out in the
near future.

Cheers,
  Peter

> ---
>  src/synaptics.c |   19 +++++++++++++------
>  1 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 488354f..30b442e 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -2495,7 +2495,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;
> @@ -2532,8 +2533,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;
> @@ -2693,6 +2700,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
>       */
> @@ -2708,9 +2718,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