-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your issue described in the documentation?
- I have read the documentation
Is your issue present in the nightly release?
- This issue is present in the nightly release
Describe the Bug
On a headless Windows setup with no physical mouse connected, games that use the Raw Input API (WM_INPUT) for map/camera controls have broken mouse input when streaming via Sunshine + Moonlight.
Symptoms:
- GUI clicks work perfectly (menus, buttons, UI elements)
- Map drag (hold left mouse + move to scroll) is completely non-functional
- Mouse wheel zoom works but centers on the wrong point (top-left / origin instead of cursor position)
- Mouse cursor is visible and moves correctly at all times
- All other applications and games work fine
Root cause:
Sunshine injects mouse input via SendInput(). When no physical mouse device is present in Windows, the Raw Input subsystem does not properly dispatch WM_INPUT messages from SendInput() because there is no hardware device to attribute the events to. SendInput() still moves the system cursor and generates WM_MOUSEMOVE (which is why GUI works), but games reading WM_INPUT for map controls receive nothing or default values (explaining the zoom centering on 0,0).
Proof:
Plugging any USB mouse into the host machine immediately fixes the issue — even without using the mouse. Simply having a physical mouse device present causes Windows to properly route SendInput() events through the Raw Input pipeline.
Tested and ruled out:
- Windows DPI scaling (tried 100%)
- Game DPI override (Application mode)
- Sunshine high-resolution scrolling (disabled)
- Moonlight mouse mode (relative/game mode from start)
- Ctrl+Alt+Shift+M toggle mid-stream
- Game windowed/fullscreen/borderless modes
- Resolutions all matching across host and client
Suggested Fix
Sunshine already uses ViGEmBus to create virtual gamepad devices. A similar approach for mouse input — creating a virtual HID mouse device instead of (or in addition to) using SendInput() — would make the injected input appear as real hardware to Windows, ensuring proper WM_INPUT dispatch regardless of whether a physical mouse is connected.
Alternatively, Sunshine already detects the no-mouse condition for cursor visibility (Mouse Keys workaround in PR #721). This detection could be extended to warn users that some games may have input issues without a physical mouse present.
Expected Behavior
Games using the Raw Input API should receive proper mouse input from Sunshine regardless of whether a physical mouse is connected to the host.
Steps to Reproduce
- Set up a headless Windows machine (no physical mouse connected)
- Configure Sunshine and connect via Moonlight
- Launch a game that uses Raw Input for map/camera controls (e.g., Nexus 5X / Stellaris Nexus)
- Try to drag the map with left mouse button — does not work
- Try to zoom with scroll wheel — zooms toward top-left instead of cursor
- Plug in any USB mouse to the host
- Both drag and zoom now work correctly
Host Operating System
Windows
Operating System Version
Windows 11 Pro
Apps
Nexus 5X (Steam App ID 1983990) — likely affects any game using Raw Input API for camera/map controls