On 04/25/2012 11:15 PM, Peter Hutterer wrote:
> Regression introduced in cddab79c408db3b13905a2be72aff4f7bf1406f8.
> 
> If an event has a delta of less than scroll_dist_vert, the delta is
> unconditionally divided by the distance, leaving some remainder close to 0
> and never actually triggering the scroll amount.
> 
> Fix this by working with the increment, not the normalised values.
> 
> X.Org Bug 46617 <http://bugs.freedesktop.org/show_bug.cgi?id=46617>
> 
> Signed-off-by: Peter Hutterer <[email protected]>
> ---
> Changes to v1:
> - also reset the repeat scroll buttons to use the scroll distance
>   horizontally/verticall instead of 1.0. Not that I expect any of these
>   devices to still be around.
> 
>  src/synaptics.c |   26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 2a43f95..893a5c8 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -2864,31 +2864,29 @@ post_scroll_events(const InputInfoPtr pInfo)
>      SynapticsParameters *para = &priv->synpara;
>  
>      /* smooth scrolling uses the dist as increment */
> -    priv->scroll.delta_y /= para->scroll_dist_vert;
> -    priv->scroll.delta_x /= para->scroll_dist_horiz;
>  
> -    while (priv->scroll.delta_y <= -1.0)
> +    while (priv->scroll.delta_y <= -para->scroll_dist_vert)
>      {
>          post_button_click(pInfo, 4);
> -        priv->scroll.delta_y += 1.0;
> +        priv->scroll.delta_y += para->scroll_dist_vert;
>      }
>  
> -    while (priv->scroll.delta_y >= 1.0)
> +    while (priv->scroll.delta_y >= para->scroll_dist_vert)
>      {
>          post_button_click(pInfo, 5);
> -        priv->scroll.delta_y -= 1.0;
> +        priv->scroll.delta_y -= para->scroll_dist_vert;
>      }
>  
> -    while (priv->scroll.delta_x <= -1.0)
> +    while (priv->scroll.delta_x <= -para->scroll_dist_horiz)
>      {
>          post_button_click(pInfo, 6);
> -        priv->scroll.delta_x += 1.0;
> +        priv->scroll.delta_x += para->scroll_dist_horiz;
>      }
>  
> -    while (priv->scroll.delta_x >= 1.0)
> +    while (priv->scroll.delta_x >= para->scroll_dist_horiz)
>      {
>          post_button_click(pInfo, 7);
> -        priv->scroll.delta_x -= 1.0;
> +        priv->scroll.delta_x -= para->scroll_dist_horiz;
>      }
>  #endif
>  }
> @@ -2934,13 +2932,13 @@ repeat_scrollbuttons(const InputInfoPtr pInfo,
>               id = ffs(change);
>               change &= ~(1 << (id - 1));
>               if (id == 4)
> -                 priv->scroll.delta_y -= 1.0;
> +                 priv->scroll.delta_y -= para->scroll_dist_vert;
>               else if (id == 5)
> -                 priv->scroll.delta_y += 1.0;
> +                 priv->scroll.delta_y += para->scroll_dist_vert;
>               else if (id == 6)
> -                 priv->scroll.delta_x -= 1.0;
> +                 priv->scroll.delta_x -= para->scroll_dist_horiz;
>               else if (id == 7)
> -                 priv->scroll.delta_x += 1.0;
> +                 priv->scroll.delta_x += para->scroll_dist_horiz;
>           }
>  
>           priv->nextRepeat = now + repeat_delay;

Looks good to me.

Reviewed-by: Chase Douglas <[email protected]>
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to