moonlight: fix touchscreen input on hosts without native touch - #3092
Merged
Conversation
xiaodoudou
force-pushed
the
moonlight-touch-patch
branch
from
August 2, 2026 06:09
1cc84af to
c003600
Compare
Contributor
Author
|
Rebased onto current Re-tested afterwards on 20260801 and the fix still behaves as expected: taps land where you touch, drags track the finger, and letting go leaves the pointer where it was. Nothing on |
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.
Summary
This is meant as a temporary carry. I have opened the same fix upstream at moonlight-stream/moonlight-embedded#938. If you would rather wait for that to be merged than carry a patch, that is completely fair, and this can be closed. I am proposing it here because upstream can be slow to move on input changes, the equivalent X11 cursor-jump fix in moonlight-stream/moonlight-embedded#834 has been open since 2021, and the touchscreen is unusable in the meantime. Drop the patch once the pin in
package.mkmoves past the merge.Moonlight calls
LiSendTouchEvent()for every finger event and ignores the return value. On a host that does not support native touch it returnsLI_ERR_UNSUPPORTEDand nothing is sent, which is the caseLimelight.htells you to handle:There is no such fallback upstream. Touch only appears to work because SDL is separately turning it into mouse events, and that has a side effect: SDL drags its own cursor along with your finger, so when the touch ends the compositor re-reports the real pointer as one large motion event. Moonlight streams with relative mouse mode, so that goes out as a delta and throws the host pointer across the screen.
The patch adds the documented fallback and turns off SDL's synthesis, so touch has one path instead of two fighting each other. It also treats touch as absolute, since a touchscreen reports where your finger is rather than how far it moved.
src/input/sdl.cis identical between the pinneda6bf715and current upstream master, so the patch applies cleanly to what we build today and will keep applying if the pin moves before the upstream PR lands.Testing
How was this tested? On an AYN Odin 2 (SM8550) running ROCKNIX 20260801, streaming to Sunshine.
/storageso the system binary stayed untouched.Test results: Taps now land where you touch, drags track the finger, and letting go leaves the pointer alone.
The host in question returns
LI_ERR_UNSUPPORTEDfor every touch event, 2015 out of 2015 in a logged session, so this is the path being used. With SDL's touch synthesis left on, the spurious event after each release carriedxrel=-740 yrel=173. With it off the same event still arrives but carriesxrel=0 yrel=0, which is why it stops mattering.I only have the one device, and no host with native touch support to try the other path on.
Additional Context
LiSendTouchEvent()succeeds and none of the patched code runs.projects/ROCKNIX/packages/apps/moonlight/patches/, whichscripts/unpackalready applies, so no change topackage.mkis needed.a6bf715from September 2024, and v2.7.1 since then brings amoonlight-common-cprotocol update plus fixes for high latency connections. That will not affect this bug, but it is overdue.AI Usage
While ROCKNIX doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.
Did you use AI tools to help write this code? YES
Reviewed with Claude Code. I also used it to automate the local cross-build so I could test on device, and to look back over the change for anything worth improving.