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

Open
maxence468 wants to merge 1 commit from upstream-pr/2772 into main
maxence468 commented 2026-11-25 20:09:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by maxence468 on 2026-11-25T20:09:25Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6612790046 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2772). Originally posted by [maxence468](https://github.com/maxence468) on 2026-11-25T20:09:25Z. --- 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.
cloph-dsp commented 2026-11-25 21:03:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T20:26:56Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173687094 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2772#issuecomment-7173687094). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-25T20:26:56Z. --- 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).
fuzeofficlal commented 2026-11-25 21:03:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T20:52:03Z.


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).
<!-- greyfinch-sync:Marvisak/VIctory:comment:7174295730 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2772#issuecomment-7174295730). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T20:52:03Z. --- 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).
Marvisak commented 2026-11-26 00:03:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:13:57Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177293233 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2772#issuecomment-7177293233). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T23:13:57Z. --- <!-- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2772:upstream-pr/2772'
git switch 'upstream-pr/2772'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2772'
git switch 'upstream-pr/2772'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2772'
git switch 'upstream-pr/2772'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2772'
git switch 'main'
git merge --squash 'upstream-pr/2772'
git switch 'main'
git merge --ff-only 'upstream-pr/2772'
git switch 'main'
git merge 'upstream-pr/2772'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2770
No description provided.