Keyboard/mouse: mouse look does nothing with an absolute-position mouse (RDP, VMs, tablets) #962

Open
opened 2026-11-26 04:38:31 +00:00 by github-bot · 1 comment
Owner

@⁠Conrage on GitHub · 2026-11-24 09:35 UTC · original

The WM_INPUT handler only adds movement when MOUSE_MOVE_ABSOLUTE is clear:

github.com/ivall/xcl@077ce40/crates/xcl/src/hle/kbm.rs (L309-L312)

if raw.flags & MOUSE_MOVE_ABSOLUTE == 0 {
    DX.fetch_add(raw.last_x, Ordering::Relaxed);
    DY.fetch_add(raw.last_y, Ordering::Relaxed);
}

Remote Desktop, most virtual machines without relative-mouse integration, pen tablets and some remote-play tools send absolute coordinates. With them, the right stick never moves and nothing is logged. WASD and the buttons still work.

Repro: run a title over Remote Desktop (or in a Hyper-V or VirtualBox guest) with keyboard_mouse = true, then move the mouse. The camera does not turn.

Suggested fix: keep the last absolute position (0–65535, virtual-desktop space when MOUSE_VIRTUAL_DESKTOP is set), add the scaled difference to DX/DY, and reset the stored position in reset_mouse_state (focus loss, sizing) so the first event after refocusing doesn't jump.

Not tested: found by reading the code; not reproduced over RDP.

AI use: found, checked and written up by Claude Code (Claude Opus 5.5) at my request.

**@⁠Conrage** on GitHub · 2026-11-24 09:35 UTC · [original](https://github.com/xcl-dev/xcl/issues/962) The `WM_INPUT` handler only adds movement when `MOUSE_MOVE_ABSOLUTE` is clear: https://github.com/ivall/xcl/blob/077ce40/crates/xcl/src/hle/kbm.rs#L309-L312 ```rust if raw.flags & MOUSE_MOVE_ABSOLUTE == 0 { DX.fetch_add(raw.last_x, Ordering::Relaxed); DY.fetch_add(raw.last_y, Ordering::Relaxed); } ``` Remote Desktop, most virtual machines without relative-mouse integration, pen tablets and some remote-play tools send absolute coordinates. With them, the right stick never moves and nothing is logged. WASD and the buttons still work. **Repro:** run a title over Remote Desktop (or in a Hyper-V or VirtualBox guest) with `keyboard_mouse = true`, then move the mouse. The camera does not turn. **Suggested fix:** keep the last absolute position (0–65535, virtual-desktop space when `MOUSE_VIRTUAL_DESKTOP` is set), add the scaled difference to `DX`/`DY`, and reset the stored position in `reset_mouse_state` (focus loss, sizing) so the first event after refocusing doesn't jump. **Not tested:** found by reading the code; not reproduced over RDP. **AI use:** found, checked and written up by Claude Code (Claude Opus 5.5) at my request.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:38:31 +00:00
Author
Owner

@⁠ettehn on GitHub · 2026-11-24 09:45 UTC · original

I’m taking this one. I have a local Windows patch on 6bac4b4 that turns absolute raw positions into per-device pixel deltas, handles primary and virtual desktop coordinates, and resets the baseline on focus loss or a coordinate-space change. The seven keyboard/mouse unit tests pass, including a synthetic absolute-input case. A live RDP or tablet test is still outstanding.

Assisted by OpenAI Codex (GPT-6.2 Astra).

**@⁠ettehn** on GitHub · 2026-11-24 09:45 UTC · [original](https://github.com/xcl-dev/xcl/issues/962#issuecomment-7127842950) I’m taking this one. I have a local Windows patch on `6bac4b4` that turns absolute raw positions into per-device pixel deltas, handles primary and virtual desktop coordinates, and resets the baseline on focus loss or a coordinate-space change. The seven keyboard/mouse unit tests pass, including a synthetic absolute-input case. A live RDP or tablet test is still outstanding. Assisted by OpenAI Codex (GPT-6.2 Astra).
This discussion has been locked. Commenting is limited to contributors.
No description provided.