Implementing smooth scrolling in an X client

Peter Hutterer peter.hutterer at who-t.net
Wed Jun 13 15:44:17 PDT 2012


On Wed, Jun 13, 2012 at 12:15:35PM -0700, Paul Vojta wrote:
> On Tue, Jun 12, 2012 at 11:25:08AM +1000, Peter Hutterer wrote:
> > On Mon, Jun 04, 2012 at 06:50:47PM -0400, Paul Vojta wrote:
> 
> [snip]
> 
> > > So I would need to keep track of EnterNotify events for each window for
> > > which I'm doing smooth scrolling, and set a flag each time such an event
> > > is received.
> > 
> > yes, this is a bug in the protocol and that behaviour is what GTK has to do
> > as well.
> > http://who-t.blogspot.com.au/2012/06/xi-21-protocol-design-issues.html
> 
> Thanks very much for that reference -- it's very helpful.
> 
> > > A problem with this (other than the extra programming effort required)
> > > is that on four-button Synaptics touchpads, the first button press of
> > > the third or fourth button after returning to the xdvi window would
> > > (I think) have no effect anymore.  (More generally, the first scrolling
> > > distance would be ignored for every return to the window, but would not
> > > be noticeable unless it was produced by a button press or simulated button
> > > press.)
> > > 
> > > Is this correct?
> > 
> > are you talking about the touchpads that have separate scroll buttons? I'd
> > not worry too much about those, I think even the newest ones are several
> > years old now (to the point that the next version of synaptics won't support
> > the scroll buttons anymore).
> 
> Yes, but also things like RTCornerButton=4, etc.  Also, what happens if you
> have a traditional wheel mouse in addition to a touchpad?

atm, the first scroll event is effectively lost/useless. how much of an
issue that is remains to be determined, Carlos said so far there hasn't been
a great uproar.

> > > And, more to the point, is there some way by which I could just receive the
> > > deltas of the scrolling valuators for when the pointer is in the designated
> > > window?
> > 
> > you can't really get the deltas only, you'll always have to calculate them
> > from the previous value.  your only option for not skipping the first event
> > is to run XIQueryDevice after an EnterEvent to get the current value on the
> > valuator so you can use that first event with that delta. Of course, that is
> > prone to race conditions so you have to work around them too.
> 
> OK, thanks.
> 
> > sorry :(
> 
> Any plans to change the spec anytime soon (e.g., for X11R7.8 or XI 2.3)?

big maybe, not sure how to fix it yet. the simplest way is of course to add
valuator state to the enter events but this may leave some other
corner-cases. Either way, it's unlikely this will happen before server 1.14,
lack of time.

Cheers,
  Peter



More information about the xorg mailing list