[PATCH evdev 1/1] Support smooth scrolling on REL_WHEEL, REL_HWHEEL and REL_DIAL

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 22 16:14:17 PDT 2011


On Thu, Sep 22, 2011 at 11:05:42AM +0100, Daniel Stone wrote:
> Hi,
> 
> On Mon, Aug 22, 2011 at 03:35:15PM +1000, Peter Hutterer wrote:
> > +#ifdef HAVE_SMOOTH_SCROLLING
> > +        if (axis == REL_WHEEL)
> > +            SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, 1.0, SCROLL_FLAG_PREFERRED);
> > +        else if (axis == REL_DIAL)
> > +            SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, 1.0, SCROLL_FLAG_NONE);
> 
> This will break scroll emulation on devices which have a dial but not a
> vertical wheel.

how so? the Preferred is only preferred if there are two axes, otherwise the
first axis is chosen. So for a device without REL_WHEEL, you only get one
vert scroll valuator - REL_DIAL and that's the one chosen for emulation.

> 
> > +        else if (axis == REL_HWHEEL)
> > +            SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE);
> > +#endif
> 
> And this should be _PREFERRED, no? (See inputproto review.)

I think the wording in the proto isn't clear enough. The scroll emulation
approach is essentially:

if (count(vert scroll axes) == 1):
   use that axis
else if (count > 1):
   if (one is preferred):
       use preferred axis
   else:
        don't do that!

so we only need preferred if we have more than one axis on that scroll
direction.  We could set the horiz axis to Prefered but it really doesn't
make a difference here.

Cheers,
  Peter


More information about the xorg-devel mailing list