Implementing smooth scrolling in an X client

Paul Vojta vojta at math.berkeley.edu
Wed Jun 13 12:15:35 PDT 2012


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?

> > 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)?

--Paul Vojta, vojta at math.berkeley.edu



More information about the xorg mailing list