Pass XGameUi text entry scope hints to Windows text services #2772

Open
github-bot wants to merge 1 commit from github-bot/gh-2772 into main AGit
Owner

@⁠maxence468 on GitHub · 2026-11-25 20:09 UTC · original
maxence468:ui/text-input-scopes → main · +49 −6 · 1 files · 1 commits · open

Forward the requested input scope to the native edit control before focus and remove its association during teardown. This lets Windows input services choose a keyboard layout for email, URL, numeric, telephone and other documented entry scopes. Unknown values use the default. This PR covers input hints only. Password masking is tracked separately in #2067. All four XGameUi tests passed on Windows, including a hidden native EDIT control accepting each scope and clearing the association. No physical touch keyboard or game session was tested.

**@⁠maxence468** on GitHub · 2026-11-25 20:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2772) `maxence468:ui/text-input-scopes` → `main` · +49 −6 · 1 files · 1 commits · open Forward the requested input scope to the native edit control before focus and remove its association during teardown. This lets Windows input services choose a keyboard layout for email, URL, numeric, telephone and other documented entry scopes. Unknown values use the default. This PR covers input hints only. Password masking is tracked separately in #2067. All four XGameUi tests passed on Windows, including a hidden native EDIT control accepting each scope and clearing the association. No physical touch keyboard or game session was tested.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:53 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-25 20:26 UTC · original

Local verification on Windows / rustc 1.100.0 / MSVC, synthetic inputs only, no game data, no GPU, no clippy/rustup.

  • \cargo test --locked -p victory-hle --lib host_edit_accepts_title_input_scopes --quiet\ -> 1 passed, 0 failed.
  • \cargo test --locked -p victory-hle --lib --quiet\ -> 147 passed, 0 failed.
  • \git diff --check origin/main..HEAD\ clean; origin/main is an ancestor of the PR head.
  • Negative control: \host_edit_accepts_title_input_scopes\ is absent from origin/main, so the test is new here.
  • The change forwards the title's scope from \ ext_entry_async\ through \sk\ into the hidden edit dialog; \windows_scope\ maps the documented GDK values to Win32 InputScope and leaves unknown values at the ordinary keyboard, applying SetInputScope on WM_INITDIALOG and clearing it on WM_DESTROY.
  • Only pre-existing deprecation warnings in victory-gpu/object.rs and victory-hle/xmem.rs.

AI-assisted (Hy4 flash).

**@⁠cloph-dsp** on GitHub · 2026-11-25 20:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2772#issuecomment-7173687094) Local verification on Windows / rustc 1.100.0 / MSVC, synthetic inputs only, no game data, no GPU, no clippy/rustup. - \cargo test --locked -p victory-hle --lib host_edit_accepts_title_input_scopes --quiet\ -> 1 passed, 0 failed. - \cargo test --locked -p victory-hle --lib --quiet\ -> 147 passed, 0 failed. - \git diff --check origin/main..HEAD\ clean; origin/main is an ancestor of the PR head. - Negative control: \host_edit_accepts_title_input_scopes\ is absent from origin/main, so the test is new here. - The change forwards the title's scope from \ ext_entry_async\ through \sk\ into the hidden edit dialog; \windows_scope\ maps the documented GDK values to Win32 InputScope and leaves unknown values at the ordinary keyboard, applying SetInputScope on WM_INITDIALOG and clearing it on WM_DESTROY. - Only pre-existing deprecation warnings in victory-gpu/object.rs and victory-hle/xmem.rs. AI-assisted (Hy4 flash).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 20:52 UTC · original

Reviewed and verified bcb809a2 on Windows 11 (rustc 1.98.1 MSVC) against main (13f91ca).

Code review

  • Hard load-time dependency on msctf.dll (xgameui.rs:166-169): #[link(name = "msctf", kind = "raw-dylib")] adds msctf.dll!SetInputScope to the executable's PE import table. On minimal Windows installs or Wine/Proton prefixes where msctf.dll or SetInputScope is unavailable, process startup will fail instead of degrading gracefully. Dynamically resolving it via LoadLibraryExW + GetProcAddress (cached in OnceLock, matching optional host DLLs elsewhere in victory-hle) avoids that startup risk.
  • Minor null-check symmetry (xgameui.rs:238-240): WM_DESTROY guards !edit.is_null() before calling SetInputScope(edit, 0), whereas WM_INITDIALOG passes edit directly without checking !edit.is_null().
  • The 8 non-zero windows_scope mappings (1, 5, 29, 31, 32, 40, 50, 68) and calling SetInputScope on the modal dialog thread that owns the edit control look clean.

Verification & merge compatibility

  • cargo test --locked -p victory-hle --lib (3 consecutive full parallel runs): 3/3 passed (147 passed, 0 failed, including host_edit_accepts_title_input_scopes).
  • cargo clippy --locked -p victory-hle --all-targets -- -D warnings (default & --all-features): 0 warnings; cargo xtask policy: 184 files ok.
  • Merge-tree: clean vs 13f91ca and #2770; text conflict in xgameui.rs with #2067 (ES_PASSWORD masking — complementary changes, straightforward to combine).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 20:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2772#issuecomment-7174295730) Reviewed and verified `bcb809a2` on Windows 11 (`rustc 1.98.1` MSVC) against `main` (`13f91ca`). ### Code review - **Hard load-time dependency on `msctf.dll` (`xgameui.rs:166-169`)**: `#[link(name = "msctf", kind = "raw-dylib")]` adds `msctf.dll!SetInputScope` to the executable's PE import table. On minimal Windows installs or Wine/Proton prefixes where `msctf.dll` or `SetInputScope` is unavailable, process startup will fail instead of degrading gracefully. Dynamically resolving it via `LoadLibraryExW` + `GetProcAddress` (cached in `OnceLock`, matching optional host DLLs elsewhere in `victory-hle`) avoids that startup risk. - **Minor null-check symmetry (`xgameui.rs:238-240`)**: `WM_DESTROY` guards `!edit.is_null()` before calling `SetInputScope(edit, 0)`, whereas `WM_INITDIALOG` passes `edit` directly without checking `!edit.is_null()`. - The 8 non-zero `windows_scope` mappings (`1, 5, 29, 31, 32, 40, 50, 68`) and calling `SetInputScope` on the modal dialog thread that owns the edit control look clean. ### Verification & merge compatibility - `cargo test --locked -p victory-hle --lib` (3 consecutive full parallel runs): **3/3 passed** (`147 passed, 0 failed`, including `host_edit_accepts_title_input_scopes`). - `cargo clippy --locked -p victory-hle --all-targets -- -D warnings` (default & `--all-features`): **0 warnings**; `cargo xtask policy`: **184 files ok**. - Merge-tree: clean vs `13f91ca` and `#2770`; text conflict in `xgameui.rs` with `#2067` (`ES_PASSWORD` masking — complementary changes, straightforward to combine).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:13 UTC · original

Automated triage for the maintainers.

This PR no longer merges cleanly into main: it conflicts in crates/victory-hle/src/modules/xgameui.rs. Its content will be reviewed once it is rebased onto current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2772#issuecomment-7177293233) <!-- victory-triage v1 head=bcb809a2c8b1178948a329ce36fe80e39d1dc2cb verdict=needs-rebase at=2026-11-25T23:13:52Z --> Automated triage for the maintainers. This PR no longer merges cleanly into `main`: it conflicts in `crates/victory-hle/src/modules/xgameui.rs`. Its content will be reviewed once it is rebased onto current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-hle/src/modules/xgameui.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2772/head:github-bot/gh-2772'
git switch 'github-bot/gh-2772'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2772'
git switch 'github-bot/gh-2772'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2772'
git switch 'github-bot/gh-2772'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2772'
git switch 'main'
git merge --squash 'github-bot/gh-2772'
git switch 'main'
git merge --ff-only 'github-bot/gh-2772'
git switch 'main'
git merge 'github-bot/gh-2772'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2772
No description provided.