events: Add additional wheel scroll info and gestures for client-side kinetic scrolling - #15965
Open
Kontrabant wants to merge 3 commits into
Open
events: Add additional wheel scroll info and gestures for client-side kinetic scrolling#15965Kontrabant wants to merge 3 commits into
Kontrabant wants to merge 3 commits into
Conversation
Kontrabant
marked this pull request as ready for review
July 15, 2026 14:48
If the source of a scroll event is known to be from a finger, pass this information through in the scroll wheel event. Additionally, a scroll event for a finger with a delta of 0,0 may be passed through to indicate that the scroll ended due to the finger being lifted. This allows for implementing client-side kinetic scrolling via a 'flick' gesture.
Use the new information in scroll events to implement kinetic scrolling when finger scroll events are received.
A hold gesture indicates that fingers are resting on a trackpad with no associated motion. This is useful for stopping a kinetic scroll.
Kontrabant
force-pushed
the
scroll_finger
branch
from
July 16, 2026 14:21
93b3643 to
0225121
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the source of a scroll event, in particular if the source of the scroll was a finger, notes that a scroll event with an x/y of 0,0 indicates that the scroll ended due to the finger being lifted, and adds a 'hold' gesture to indicate that there are motionless fingers on a trackpad.
This allows for implementing client-side kinetic scrolling via a 'flick' gesture, and stopping it when a finger is again placed on the trackpad. A basic demonstration of this functionality was added to testmouse.
This information is currently passed through on X11 (although XInput2 lacks the hold gesture) and Wayland. There is probably a way to get this information on Apple platforms, but I haven't looked into it yet, and Macs already have native kinetic scrolling that can be enabled via a hint. No idea about Windows, as kinetic scrolling there seems to be implemented within third-party drivers.
As mentioned, to indicate finger lift, a mouse wheel event with x and y values of 0.0 is sent (libinput does the same to indicate that a kinetic scroll should be started). It's unlikely that sending zero scroll values would cause problems in existing software, as they already have to contend with either axis potentially being zero, but it is a slight behavior change, so maybe a separate SDL_EVENT_MOUSE_WHEEL_STOP (SDL_EVENT_MOUSE_WHEEL_FINGER_LIFTED?) event would be better suited for this?
Fixes #15955