sdl: fix touchscreen input on hosts without native touch support - #938
Open
xiaodoudou wants to merge 1 commit into
Open
sdl: fix touchscreen input on hosts without native touch support#938xiaodoudou wants to merge 1 commit into
xiaodoudou wants to merge 1 commit into
Conversation
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.
Description
LiSendTouchEvent()is called for every finger event but its return value is thrown away. On a host with no touch support it returnsLI_ERR_UNSUPPORTEDand nothing gets sent, which is the caseLimelight.halready tells us to handle:We never did. Touch only seems to work because SDL is separately turning it into mouse events, and that brings its own problem: SDL drags its internal cursor along with your finger, so when you lift it the compositor re-reports the real pointer as one large motion event. In relative mode that goes out as a delta and throws the pointer across the screen. With SDL's synthesis off the same event still arrives, but with a zero delta, so it stops mattering.
This adds the documented fallback and turns the synthesis off, so touch has one path instead of two fighting each other.
I treat touch as absolute rather than following the mouse capture mode, since a touchscreen reports where your finger is, not how far it moved.
SDL_FINGERUPdeliberately sends no movement, because a release has no new position to report, and that was the jump.Hosts that do support native touch are untouched by this,
LiSendTouchEvent()succeeds and the fallback never runs.Purpose
Touchscreens are unusable against hosts without native touch support. The pointer follows your finger while you drag, jumps somewhere else the moment you let go, and a tap does not move it at all.
Tested on an Ayn Odin 2 running ROCKNIX, streaming to Sunshine on the SDL platform under Wayland. That host returned
LI_ERR_UNSUPPORTEDfor every touch event in a logged session, so this is the path being used. Taps now land where you touch, drags track properly, and letting go leaves the pointer alone. I checked it against an unpatched build of the same commit so I could be sure it was this change and not something else in master.I do not have a host with native touch support to try, so that side is reasoned from the early return rather than actually tested.