Fix IME commitText() to enable voice dictation and swipe typing#1556
Open
AFK-Automations wants to merge 1 commit intomoonlight-stream:masterfrom
Open
Fix IME commitText() to enable voice dictation and swipe typing#1556AFK-Automations wants to merge 1 commit intomoonlight-stream:masterfrom
AFK-Automations wants to merge 1 commit intomoonlight-stream:masterfrom
Conversation
Moonlight receives keyboard input via KeyEvent (onKeyDown/onKeyUp) but does not handle IME commitText() events. This means Gboard voice dictation, swipe typing, and autocomplete suggestions are silently dropped. Adds StreamInputConnection (extending BaseInputConnection) that intercepts commitText() and routes text through the existing sendUtf8Text() protocol method. Also handles deleteSurroundingText() for IME-driven backspace/delete operations. Closes moonlight-stream#1496
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.
Problem
Android IME text input via
commitText()is silently dropped during streaming. This means Gboard voice dictation, swipe typing, and autocomplete suggestions never reach the host - the keyboard appears to listen but no text arrives on the remote PC. Reported in #1496.Root Cause
Moonlight handles keyboard input through
onKeyDown()/onKeyUp()which only processes individualKeyEventobjects. When Gboard voice engine or swipe/autocomplete completes, Android callscommitText()on the activeInputConnection. No customInputConnectionwas provided, so the committed text was never forwarded to the host.Fix
StreamInputConnectionextendingBaseInputConnectionthat interceptscommitText()and routes text through the existingsendUtf8Text()protocol methodonCreateInputConnection()override onStreamViewto provide the custom InputConnection during streamingdeleteSurroundingText()for IME-driven backspace/deletesetComposingText()andfinishComposingText()handled gracefully to prevent errors during in-progress dictationWhat works after this change
Files changed
StreamInputConnection.java-- new fileStreamView.java-- addedonCreateInputConnection()overrideGame.java-- passesNvConnectionreference to StreamViewTested on Android with Gboard, connected to Sunshine host on Windows 11. Voice dictation, swipe typing, autocomplete, and regular typing all function correctly. No regressions observed.
Closes #1496