fix(input): a mouse button released outside the game is not a click on return #265
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!265
Loading…
Reference in a new issue
No description provided.
Delete branch "jarynclouatre/Longshot:fix/mouse-release-outside"
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?
Why
A left button held on a page of the pause screen's panel and let go outside the game became a click when the pointer came back. On the Map page: press on the R sign, Alt-Tab away, let go, come back, and the page turns with no click.
On the panel's pages (Key Items, Threads of Time, the Map) a left press is held until its release and is a click there, so a drag can pan or turn instead.
mouse_tick_locked(host/oot_menu.c) returned at once while there was no pointer (hos_mouse_game_pointerreturns 0 outside the window or under the Insert menu), and the pending press, declared below that return, stayed set. At the first tick back the button read as up, and the release made the click at the place of the press.What changed
host/oot_menu.c,mouse_tick_locked): the pending press is declared at the top of the function and dropped while there is no pointer, and on the R button's item choice, which returns early too. A press is only kept while the pointer stays with the game.hos_mouse_game_pointerreturns 0 for a pointer that is away, not for a frame without a new sample, so a normal click keeps its press. A drag carried out of the window ends there, since its release cannot be seen.tests/test_oot_menu_mouse.py): on Key Items, a press on the R sign let go there taps R once; a press on it, then the pointer away (another window in front), the button let go and the pointer back, taps nothing. The left button's held state the menu reads (GetAsyncKeyState) is now the fixture's, through a header included first in both files, so the desk's own mouse cannot change the result.Flags and settings
None.
Measurements
main:
f3fe1763(2026-11-13)this PR: fix/mouse-release-outside @
ac3a5fc3Hardware: a Linux x86-64 PC for the suite (g++ 15.2, Python 3.14.4); a Windows 11 PC (Ryzen 7 9800X3D) for the mouse fixture
Scene: none, the game was not run
Method:
python3 -I -B tests/run_all.py, two runs each, interleaved (main, PR, main, PR, with another branch's runs between); both runs of a side gave the same counts.tests/test_oot_menu_mouse.pyruns on Windows only and is skipped on Linux; its fixture was cross-built with llvm-mingw 20261104 from this branch's test, once against this branch'soot_menu.cand once against main's, and both builds were run on the Windows PC.How to reproduce: the commands above in a checkout of each commit
f3fe1763ac3a5fc3tests/run_all.py(run 1, run 2)test_bake_portability.py,test_menu_i18n.pytest_oot_menu_mouse.pyfixture built with llvm-mingw (-Wall)taps "0:R/75;", the release made a tap)test_bake_portability.pyfails here for a missing Python module (zstandard), on main as well.test_menu_i18n.pyfails on main itself: a pt_BR hint (the testing tools' row) is no longer a text ofvk_menu.cpp.Testing
Tested: the game-free suite on a Linux PC, and the mouse fixture on a Windows 11 PC (main's
oot_menu.cfails the new case, this branch passes), as in Measurements.Not tested: the game.
Needs other testers: None.
Screenshots
None.
Risk and rollback
A drag on the map or a stone that leaves the window now ends there; before, it went on when the pointer came back with the button still held. Reverting the commit puts the old order back.
Reviewer notes
Issues
None.
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
tests/that reads changed source updated in this PR, not weakened.WIP: fix(input): a mouse button released outside the game is not a click on returnto fix(input): a mouse button released outside the game is not a click on returnThe mouse fixture ran on a Windows 11 PC (llvm-mingw 20261104 builds of this branch's test): against main's
oot_menu.cit fails the new case at line 259 (taps "0:R/75;", the release came back as a tap), against this branch's it passes. Measurements and Testing are updated; out of WIP.