events: Pass through the scroll wheel source when known#15965
Draft
Kontrabant wants to merge 2 commits into
Draft
events: Pass through the scroll wheel source when known#15965Kontrabant wants to merge 2 commits into
Kontrabant wants to merge 2 commits into
Conversation
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.
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.
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 with a finger source and 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. A basic demonstration of this functionality was added to testmouse.
This information is currently passed through on X11 and Wayland. There is probably a way to get this information on Apple platforms, but I haven't looked into it yet, and Macs have native kinetic scrolling that can be enabled via a hint. No idea about Windows, as kinetic scrolling there seems to be implemented by third-party drivers.
As mentioned, to indicate finger lift, a mouse wheel event with x and y values of 0.0 are sent. It's unlikely that sending zero scroll values would cause problems in existing software, 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