fix(menu): keep the mouse free after Escape then F1 #2035
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2035
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/escape-mouse-capture"
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?
Summary
With the default menu shortcut, Esc releases the mouse. Opening and closing the menu with F1 later could grab it again. F1 now restores capture only if the mouse was captured when F1 opened the menu. The opt-in Esc shortcut still restores the capture it released.
Closes #2031.
Technical changes
Validation
At
1519603dond47206ed, the pointer fixture passed on Windows LLVM and Ubuntu Clang 18. It checks default Esc then F1, opt-in Esc, and F1 while captured on both host paths.The Windows shortcut suite and all 18 window-procedure cases in the screensaver fixture passed. The first hosted Windows run found a stale two-argument test stub for the updated menu handler. The stub now matches the handler.
On the first revision, two negative controls independently reproduced stale recapture in the Windows and SDL host paths. In a Windows Kokiri smoke test at
600960cd, the default Esc-then-F1 sequence, direct F1, and opt-in Esc opening returned to gameplay. The run exited normally and preserved the original checkpoint hashes. Cursor confinement was asserted in the fixtures; the native run verified the menu transitions.Both hosted Windows source shards pass at this head. Main includes the startup fixture fix from #2051.
Looks good. I traced it through the code and the logic holds.
menu_tickcomputesesc_opensin the same tick that flipsopen_now, so the lparam on WM_APP + 8 really means "this open came from the Esc shortcut". F1/Insert/pad opens send 0, so the staleesc_had_captureis dropped (Windows) or ignored (SDL,request == 2) as intended.esc_had_captureon WM_KILLFOCUS / FOCUS_LOST is the right call; otherwise a note from before an alt-tab could restore capture later.menu_asked(0 / 1 / 2) keeps the SDL request atomic, so state and reason can't be read torn. Default stays -1,menu_mouse(int request)handles it correctly.No prior discussion on the PR to address. Nothing blocking.
github-sync referenced this pull request2026-11-12 06:22:54 +00:00