fix(input): pause mouse capture and warp while dragging or resizing the window #1002
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1002"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by adwen-007 on 2026-11-28T10:57:26Z.
Problem
When
VICTORY_MOUSE_WARP=1andVICTORY_MOUSE_CAPTURE=1are enabled in windowed mode, grabbing the title bar to drag or resize the window triggersWM_MOVE/ capture logic that re-clips and warps the cursor back to the window center mid-drag, causing the window to jump across the screen.Fix
crates/victory-hle/src/modules/lifecycle.rsonWM_NCLBUTTONDOWN/WM_ENTERSIZEMOVE, and resume cleanly onWM_EXITSIZEMOVEor client-area click (WM_LBUTTONDOWN).Verification
VICTORY_MOUSE_CAPTURE=1andVICTORY_MOUSE_WARP=1: window drags and resizes smoothly without cursor warp interference, and camera capture resumes on click inside the game window.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T11:49:39Z.
Review: APPROVED
Tested locally merged onto
main(63b902f).crates/victory-hle/src/modules/lifecycle.rs;cargo xtask policypassed (294 files ok).cargo test -p victory-hle --lib lifecycle::passed (11 passed; 0 failed, includingmouse_reference_handles_focus_reset_and_warp) with 0 compiler warnings.Nice UX fix pausing mouse capture/warp during window move/resize loops (
WM_ENTERSIZEMOVE/WM_EXITSIZEMOVE). LGTM.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-11-28T20:39:49Z.
One more place that may pull the cursor while the title bar is dragged, if I read main
923e38cright (read from code; not run on main).The PR pauses the capture and warp in
lifecycle.rs. With the mouse and keyboard profile (VICTORY_MNK_BINDINGS),crates/victory-hle/src/modules/mnk.rshas its own pull:sample()(line 223) callsrecenter()(lines 164-185) about every 8 ms whenever the foreground window is ours and F1 is closed.recenter()readsGetCursorPosand, if the cursor is off the client centre, callsSetCursorPosto the centre. It does not check whether the cursor is inside the client area, whether a button is held, or whether a move/size loop is running. A title-bar click makes our window the foreground one, so I would expect the window to be pulled back or impossible to drag. The only ways out I can see on main are F1 (which stops the pull) and leaving the window (Alt+Tab).On our fork, an earlier version captured on activation, and a click on the title bar did capture the mouse there; that is what led us to look. It is a different code path from main's, so this is not confirmation for main.
Suggestion, not a request: if the pause in this PR is meant to cover the MnK profile too,
recenter()would need the same condition (no pull fromWM_NCLBUTTONDOWNtoWM_EXITSIZEMOVE, and none when the cursor is outside the client area). A release key would also help; #731 proposes Alt for the capture.This was written with AI assistance (Claude Code).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by adwen-007 on 2026-11-28T21:39:12Z.
Thanks @Jesper-Andersson — great catch!
Rebased onto
main(923e38c) and updatedcrates/victory-hle/src/modules/mnk.rs(f71c8b9) to cover the MnK profile as well:lifecycle::mouse_dragging()(WM_ENTERSIZEMOVE/WM_NCLBUTTONDOWN→WM_EXITSIZEMOVE/WM_LBUTTONDOWN/ focus loss) and guarded bothmnk::sample()andmnk::recenter().mnk::recenter()before initial centering (!centered), so clicking the title bar or window chrome never pulls the cursor into the client area.Verified
cargo check -p victory-hlepasses cleanly with zero warnings.