Repository navigation
Conversation
|
This branch has not been deployed
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
mouse_presstracks which mouse buttons are held so thatreset_mouse_buttons()can release them when theclient disconnects. It is indexed by the Moonlight button ID, but those IDs run from
BUTTON_LEFT(1) toBUTTON_X2(5), while the array only had 5 slots (0-4). The bounds check in the mouse button passthrough(
button < mouse_press.size()) therefore skippedBUTTON_X2entirely: the press was still forwarded to theplatform, but never recorded, so a disconnect never released it.
In practice this leaves the host's "forward" mouse button stuck down. It is easy to hit with Moonlight's gamepad
mouse emulation, which maps RB to
BUTTON_X2: the quit combo (Select + Start + LB + RB) ends the stream while RB isstill held. Afterwards clicks and text selection on the host no longer work until the button state is reset
(e.g. Ctrl+Alt+Del).
BUTTON_X1(LB) was released correctly, onlyBUTTON_X2stayed down.The fix sizes the array as
BUTTON_X2 + 1so every Moonlight button ID has a slot. Two small test helpers(
send_mouse_button_packet(),release_held_mouse_buttons()) mirror the existing keyboard helpers and are used bya regression test that presses each button and checks that a disconnect-style reset releases it.
Screenshot
Issues Fixed or Closed
Possibly related: moonlight-stream/moonlight-qt#2035 (a comment there reports stuck input with gamepad mouse mode and
a Windows host).
Roadmap Issues
Testing
Added
InputGamepadSessionTest.ReleasesEveryHeldMouseButtonOnDisconnectintests/unit/test_input.cpp. It uses theexisting fake libvirtualhid backend, presses each Moonlight mouse button (
BUTTON_LEFTthroughBUTTON_X2) and checksthat
release_held_mouse_buttons()(the samereset_mouse_buttons()a disconnect runs) submits exactly one releasefor that button.
Validated in a
debian:trixiecontainer (deps fromscripts/linux_build.sh --step=deps, CUDA and docs off), based on13ca613:
BUTTON_X2only; the fake backend logsbutton 4 pressedwith no matching release.InputGamepadSessionTest.*:InputPacketValidationTest.*:*Keyboard*:*Mouse*underxvfb-run,51 tests passed.
clang-format --dry-run --Werror(19.1.7) on the changed files: no findings.Manual: reproduced the stuck button on a Windows host (Apollo, which shares this code) with the Moonlight gamepad
mouse emulation quit combo. I did not build or run the full test suite, or test on Windows or macOS.
Type of Change
Checklist
AI Usage
See our AI usage policy.