Report keyboard glyphs and dead keys using the focused window layout #2757
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2757
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2757"
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?
@maxence468 on GitHub · 2026-11-25 19:48 UTC · original
maxence468:input/layout-key-readings→main· +56 −13 · 1 files · 1 commits · openKeyboard readings always returned zero for codePoint and false for isDeadKey. Resolve these fields from the keyboard layout of the focused title window using MapVirtualKeyExW. Scripted inputs without a focused title window use the polling thread layout. This supplies key labels to GameInput clients without consuming dead-key state. Tested on a French AZERTY Windows system, including é, dead circumflex and right Ctrl. All ten GameInput tests passed with default features and with diagnostics enabled. No in-game UI was tested.
@kotekompotek on GitHub · 2026-11-25 20:07 UTC · original
Correct use of MAPVK_VK_TO_CHAR: low word is the keycap glyph, high bit flags a dead key, and the query doesn't consume a pending accent. Querying the foreground thread's layout (not the calling thread's) is the right detail - it matches the layout actually active in our window. The GetKeyboardLayout(0) fallback for scripted keys keeps diagnostics working unfocused.
@cloph-dsp on GitHub · 2026-11-25 20:13 UTC · original
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.
AI-assisted (Hy4 flash).
@oni-swr on GitHub · 2026-11-25 20:15 UTC · original
Independent WARP/CPU verification for head
9ff50e868eagainst origin/main13f91caee2. State check at start and again before posting: open, non-draft, mergeable, head unchanged; no prior oni-swr comment.Environment: Windows 11 x64, Rust 1.98.1 (48a229cea 2026-09-01), cargo 1.98.1, Windows SDK dxil.dll 10.0.26100.0 (file version 1.8.2502.11).
VICTORY_WARP=1andVICTORY_D3D12_WARP=1set (WARP only, no physical GPU); no game files.CARGO_TARGET_DIR=D:\victory-warp-2741-target. Tested commit: the PR head itself, which is exactly one commit on top oforigin/main(merge-base =origin/main, so no temporary merge was needed). Host keyboard layouts: de-CH, en-GB (a Windows API test, so it ran on the real host layout; no layout was switched).Commands/results:
cargo test --locked -p victory-hle— lib 146 passed, 0 failed; other binaries pass.cargo clippy --locked -p victory-hle --all-targets -- -D warnings— pass.cargo test --locked -p victory-hle --lib keyboard_readings— 1/1 passed.cargo test --locked -p victory-hle— lib 147 passed (+1), 0 failed; and with--features diagnosticsalso lib 147 passed, 0 failed. Clippy--all-targets -- -D warningspasses with and without--features diagnostics.code_point: 0(the pre-PR value) ->keyboard_readings_include_keycap_and_extended_scan_codeFAILED at gameinput.rs:1322.dead_key: false-> the test still PASSED.Review findings:
code_point == 'A'assertion is also layout dependent: it would fail on a layout where VK_A maps to a non-Latin glyph (for example Russian or Greek). A synthetic layout-independent check, or skipping unless the layout is Latin, would be safer./// The foreground window is one of ours ...now sits abovereadingsinstead offocused_layout(the function it described).No production blocker found: the layout used is the foreground window thread's (falling back to the calling thread's for scripted keys with no focus), and the dead-key bit and low word are taken from
MAPVK_VK_TO_CHARas documented.Not tested additionally: the AZERTY branch itself (not installed here).
Not tested: physical GPU, retail title/game behavior, release build (debug profile only).
AI disclosure: Claude Code (Claude Sonnet 5.5).
@fuzeofficlal on GitHub · 2026-11-25 20:21 UTC · original
Reviewed and verified
9ff50e86on Windows 11 againstmain(13f91ca).Code review
focused_layout()cleanly guards foreground ownership (process == GetCurrentProcessId()) and skips physical keyboard polling when unfocused or focused in another process, whileVICTORY_KEYSunderdiagnosticsstill falls back toGetKeyboardLayout(0).MapVirtualKeyExW(MAPVK_VK_TO_VSC_EXandMAPVK_VK_TO_CHAR) is safe with respect to system dead-key state (unlike unflaggedToUnicodeEx, it does not mutate kernel keyboard state, has no buffer truncation or surrogate issues, and handleshkl == 0gracefully).MAPVK_VK_TO_CHARreports unshifted keycap glyphs (e.g., uppercase letters, no Shift/AltGr punctuation or non-BMP glyphs), whereas#656(which conflicts in the samegameinput.rshunk) usesToUnicodeEx(..., wFlags=4)for shifted/composed characters.Verification (Windows 11,
rustc 1.98.1MSVC)cargo test -p victory-hle --lib --locked(6 consecutive full parallel runs): 6/6 passed (147 passed, 0 failed).cargo test -p victory-hle --lib --features diagnostics --locked -- modules::gameinput::: 10 passed, 0 failed (includingkeyboard_readings_include_keycap_and_extended_scan_code).cargo clippy -p victory-hle --all-targets --locked -- -D warnings(default &--all-features): 0 warnings;cargo xtask policy: 184 files ok.git merge-treeagainst13f91ca,#1430,#2715, and#2717; conflicts with#656.@Marvisak on GitHub · 2026-11-25 23:27 UTC · original
Automated triage for the maintainers. In
crates/victory-hle/src/modules/gameinput.rs,key_statenow fillscode_pointanddead_keyfromMapVirtualKeyExW(MAPVK_VK_TO_CHAR)with the focused window's layout. The API use looks right, but a few things need changing first. (1) The removed comment said the title reads only scan codes and virtual keys. Please say where these fields are read, and give evidence for what the console reports incodePoint:MAPVK_VK_TO_CHARgives the unshifted keycap glyph (uppercase 'A' for the A key), which is not obviously the console's value. (2)keyboard_readings_include_keycap_and_extended_scan_codeassertscode_point == 'A'on the host layout, so it fails on non-Latin layouts (for example Russian or Greek). The dead-key assertion runs only on French AZERTY, so most machines and CI never check it. Please make the test independent of the layout, for example by loading a known layout or skipping when the layout does not match. (3) The doc comment/// The foreground window is one of ours ...now sits abovereadingsinstead offocused_layout. CI:checkpassing.Generated by Claude Code
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.