F1 key bindings: a wait for a key ends when the game window is not in front #4968
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4968"
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 eipastel on 2026-12-01T15:50:28Z.
[pr-fix] Fixes point 2 of #4939.
What it changes
In F1 → KEY BINDINGS, a wait for a key read
GetAsyncKeyState, which answers for the whole desktop. After Alt+Tab (or a click on another window) during the wait, the next key typed in the other program was written tobindings.ini. #2245 (9e0c369db) ended the wait as soon as the game window was not in front; the #4634 rewrite ofmenu.rsleft that out (#4939, point 2).This brings it back on the new menu, nearly as it was:
binds::Binds::heardreturnsHeard::{Nothing, Key, Lost};heard_fromtakes "a window of ours is in front" and the key reader, and ends the wait withLostbefore reading any key when we are not in front.hear_bindingshowsNOT CHANGED: THE GAME WINDOW WAS NOT IN FRONTforLostand binds nothing.a_wait_for_a_key_ends_when_the_window_is_not_in_frontcomes back (adapted:Bindsis built in the test, as there is noBinds::ofany more).Points 1, 3, 4 and 5 of #4939 are not touched here (3 and 5: #4942 and #4950; 4: #2868).
How it was tested
cargo test -p victory-gpu --lib host::menu: the new test passes.cargo clippy -p victory-gpu --all-targets -- -D warnings: only the five errors already onmain(font.rs, menu.rs:667, panel.rs; #4679 / #4707), none in the changed lines.cargo xtask policy --stagedpasses.Checked for overlap
menu.rs; none of their diffs adds a focus check to the binding wait (searched forfocused(),heard,NOT IN FRONT).🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-12-01T18:05:07Z.
Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.
Base
5fabb46eaf6ed8771321787f8871051abde69b9b, headcb586d1d038300d4619ed4263b1be50125b71a0f.git diff --numstat→ crates/victory-gpu/src/host/menu.rs 76/7.a_wait_for_a_key_ends_when_the_window_is_not_in_frontis new on the base (git grep -F a_wait_for_a_key_ends_when_the_window_is_not_in_front 5fabb46e -- .→ no match, exit 1).whole_view_above_window-style helper changes in the same hunk are production code, not tests.git diff --check "5fabb46e..cb586d1d"→ no output, exit 0.Result:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out; finished in 0.00s.What the test actually pins, since it is worth being precise: it drives
Binds::heard_from(ours, held)with a closure, so no OS input is read. The cases are — no wait in progress →Heard::Nothingand the closure panics if called; waiting and in front with nothing held →Nothingand the wait survives; Esc while waiting →Nothing(Esc is not bindable) and the wait still survives;Ewhile waiting →Heard::Key(b'E')andwaitingis cleared; waiting while another program is in front →Heard::Lost, the wait is cleared, and the closure is never called; back in front afterwards →Nothing. It closes by reading the binding back (value("Y") == "F").So it covers the new "not in front ends the wait" branch and that the branch does not consume a key. No device, GPU/driver N/A. No game data.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.