[PATCH synaptics 1/2] Don't unconditionally divide by scroll_dist_vert (#46617)

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 25 23:16:18 PDT 2012


On Wed, Apr 25, 2012 at 10:34:48PM -0700, Chase Douglas wrote:
> On 04/25/2012 08:00 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 <peter.hutterer at who-t.net>
> > ---
> >  src/synaptics.c |   18 ++++++++----------
> >  1 file changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/src/synaptics.c b/src/synaptics.c
> > index 2a43f95..0546ab9 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
> >  }
> 
> This is changing the units of the delta values from being normalized to
> the button click thresholds to being based on device coordinates, right?
> In which case, won't this affect things elsewhere? For example, in the
> repeat_scrollbuttons() function it looks like calculations are based on
> normalized button click thresholds.
> 
> It's late here though, maybe I'm reading things wrong.

nah, you're right. I fixed this up in v2. No real effect I suspect, these
devices should be extinct by now. and if they aren't they'll stop working in
the next release, I've removed scrollbutton support from the driver in my
cleanup branch.

Cheers,
  Peter


More information about the xorg-devel mailing list