Implementing smooth scrolling in an X client
Paul Vojta
vojta at math.berkeley.edu
Mon Jun 4 15:50:47 PDT 2012
Folks:
I've started working on implementing smooth scrolling in xdvi, and I have a
question about it.
When I do
xinput --test 9
(where 9 is the deviceid of my Synaptics touchpad) and stroke my finger
down the right-hand side of the touchpad, I get an increasing sequence of
numbers:
motion a[3]=1935
motion a[3]=1950
motion a[3]=1964
motion a[3]=1979
motion a[3]=2007
motion a[3]=2017
motion a[3]=2034
motion a[3]=2062
motion a[3]=2088
motion a[3]=2124
motion a[3]=2154
motion a[3]=2185
motion a[3]=2210
etc. So far I've modified xdvi so that I can get a similar printout from
xdvi.
I guess that what I'm supposed to do with these numbers is keep track of
the most recently reported number, and scroll based on the differences
between the numbers.
But now if I move my mouse to some other window (e.g., xterm), scroll in
that window for a while, and then move back, the numbers reported to
xdvi would reflect the scrolling activity done in the other window.
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.
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?
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?
I am using Debian on x86_64, with the following package versions:
xserver-xorg-core 2:1.12.1.902-1
xserver-xorg-input-synaptics 1.6.1-1
xinput 1.6.0-1
Sincerely,
Paul Vojta
More information about the xorg
mailing list