After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 680088 - Duplicate mouse wheel scroll events with xinput enabled
Duplicate mouse wheel scroll events with xinput enabled
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: x11
git master
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-07-17 11:57 UTC by Emanuele Aina
Modified: 2012-07-17 14:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case for duplicate xinput scroll events (1.25 KB, text/plain)
2012-07-17 11:57 UTC, Emanuele Aina
  Details
x11/xi2: Do not generate scroll events on ButtonRelease (4.03 KB, patch)
2012-07-17 14:15 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Emanuele Aina 2012-07-17 11:57:01 UTC
Created attachment 219010 [details]
Test case for duplicate xinput scroll events

Running the attached program with and without XI2 enabled and scrolling the mouse wheel dow/up/down results in:
$ ./scroll
SCROLL (direction:down)
SCROLL (direction:up)
SCROLL (direction:down)
^C
$ ./scroll --enable-xinput
SCROLL (direction:smooth dx:0,00 dy:0,000000)
SCROLL (direction:down)
SCROLL (direction:down)
SCROLL (direction:smooth dx:0,00 dy:-1,000000)
SCROLL (direction:up)
SCROLL (direction:up)
SCROLL (direction:smooth dx:0,00 dy:1,000000)
SCROLL (direction:down)
SCROLL (direction:down)

Note that in the second invocation the non-smooth scroll events are duplicated even if I've applied the same amount of wheel clicks in both cases.
Comment 1 Emmanuele Bassi (:ebassi) 2012-07-17 14:04:41 UTC
the X server is sending multiple synthetic ButtonPress events (that we'll translate into ClutterScrollEvent) to make up for the smooth scrolling delta:

  
 [scroll starts] -------> physical space -------> [scroll end]
 | threshold    | threshold   | threshold   | threshold   | threshold
                [ButtonPress] [ButtonPress] [ButtonPress]

which, thinking about it, makes sense if you want to maintain a spatial relationship between the scrolling on the device and the scrolling on the window all the while keeping existing code using discrete scrolling code working with devices that have smooth scrolling capabilities, instead of simply breaking them (which was the approach favoured by Apple).
Comment 2 Emmanuele Bassi (:ebassi) 2012-07-17 14:11:51 UTC
actually, no: looking at the event translation code we generate ClutterScrollEvent on XI_ButtonPress *and* XI_ButtonRelease, which is wrong.
Comment 3 Emmanuele Bassi (:ebassi) 2012-07-17 14:15:05 UTC
Created attachment 219022 [details] [review]
x11/xi2: Do not generate scroll events on ButtonRelease

Scroll events are generated on ButtonPress only in the core event
handling, so it should happen the same if we use XInput.
Comment 4 Emmanuele Bassi (:ebassi) 2012-07-17 14:16:03 UTC
Attachment 219022 [details] pushed as 2a31a93 - x11/xi2: Do not generate scroll events on ButtonRelease