Skip to content

Games using Raw Input have broken mouse drag/zoom on headless setups with no physical mouse #4792

Description

@Licho1

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

  1. Set up a headless Windows machine (no physical mouse connected)
  2. Configure Sunshine and connect via Moonlight
  3. Launch a game that uses Raw Input for map/camera controls (e.g., Nexus 5X / Stellaris Nexus)
  4. Try to drag the map with left mouse button — does not work
  5. Try to zoom with scroll wheel — zooms toward top-left instead of cursor
  6. Plug in any USB mouse to the host
  7. 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

Activity

  1. busybox11 commented on Mar 2, 2026

    @busybox11

    Seeing the same issue on a Linux machine. The docs do mention that plugging in a physical mouse should fix the weirdness we're seeing. However, the issue consistently happens on my end now, and I don't remember it being consistent before.

    Mostly seeing this on Zen Browser (based on Firefox), not on Chromium-based ones.

    Running 2026.226.41312, commit 98dc21954ea0c254f058ef5b3b3ec6aef359e2aa on Hyprland. Don't have the time to bisect now unfortunately.

  2. fyachan commented on Mar 6, 2026

    @fyachan

    +1

  3. LizardByte-bot commented on Jun 4, 2026

    @LizardByte-bot
    Member

    It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

  4. busybox11 commented on Jun 4, 2026

    @busybox11

    Still relevant, although it's not happening anymore when "Optimize mouse for remote desktop" is disabled. Pretty sure it was working regardless of this mode before though.

  5. Licho1 commented on Jun 6, 2026

    @Licho1
    Author

    Sunshine foundation solved it by adding virtual mouse driver

  6. busybox11 commented on Jun 7, 2026

    @busybox11

    I do have the virtual mouse driver, but it is only effective if not using the "optimized for remote desktop" setting :( couldn't troubleshoot this further but I'd love to dig deeper if there's anything I could help with. Could be obvious, sorry if I missed something.

  7. Licho1 commented on Jun 7, 2026

    @Licho1
    Author

    Sunshine Foundation fork bundles some zako virtual mouse and pushes low level events to it, so it fully works there.
    So if you are looking for an alternative until it is fixed here, this works:

    Image
  8. busybox11 commented on Jun 7, 2026

    @busybox11

    Ah, isn't this Windows specific ? I'm primarily using Linux and macOS, not sure if that will work. Also I'd like to avoid using vibe coded software on my personal machines, I believe this one is. Not sure though.

  9. baudneo commented on Sep 8, 2026

    @baudneo
  10. busybox11 commented on Sep 9, 2026

    @busybox11

    This is marked as fixed but I believe it isn't actually fixed on platforms other than Windows?
    I definitely still have the issue on Linux and macOS was flaky (not necessarily blaming Sunshine here, but still noteworthy)

  11. ReenigneArcher commented on Sep 9, 2026

    @ReenigneArcher
    Member

    This is a Windows specific issue, SendInput is a Windows API. https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput

  12. busybox11 commented on Sep 9, 2026

    @busybox11

    Ah. All my comments were about Linux, I didn't know if it was the exact issue as the OG post but it seemed very similar. Not sure if I should track it somewhere else. Will open another issue if it happens again in Linux for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions