D3D12.X: drop SC_KEYMENU so the window is never frozen in menu mode #1431

Open
WTactic wants to merge 1 commit from upstream-pr/1441 into main
WTactic commented 2026-11-24 16:00:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by WTactic on 2026-11-24T16:00:17Z.


Pressing Alt or F10 sends WM_SYSCOMMAND SC_KEYMENU, which puts Windows default message handling into a modal menu loop on the thread that owns the window. The title stops drawing and reading input until a key ends the loop, with nothing on screen indicating why it hung.

Drop SC_KEYMENU in the window procedure next to WM_CLOSE handling so keyboard menu activation cannot freeze the game thread.

What is in it

  • crates/xcl/src/hle/d3d12x/present.rs: intercept WM_SYSCOMMAND with SC_KEYMENU in wndproc and drop it; add unit test syscommand_keymenu_is_dropped.

Tested

  • Hardware: NVIDIA GeForce RTX 4090, Intel Core i9-10850K @ 3.60 GHz, Windows 11 x64 (26200), rustc 1.97.1, release/debug
  • cargo test -p xcl --lib syscommand_keymenu_is_dropped: 1 passed, 0 failed

Regression run
main (1d027e5):

xcl-smoke v1
commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1529 (PresentX 1529)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15898 MB

PR (cd45c76):

xcl-smoke v1
commit: cd45c763b17e9c684936cbe2d0b71a699900332f
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1584 (PresentX 1585)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17086 MB

Not tested

  • AMD RDNA GPU adapter.

AI use

  • Gemini 4 Hydrogen + custom harness: identified window menu freeze, implemented message drop, wrote unit test, and regression verified.
<!-- greyfinch-sync:ivall/xcl:issue:5475714129 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1441). Originally posted by [WTactic](https://github.com/WTactic) on 2026-11-24T16:00:17Z. --- Pressing Alt or F10 sends `WM_SYSCOMMAND SC_KEYMENU`, which puts Windows default message handling into a modal menu loop on the thread that owns the window. The title stops drawing and reading input until a key ends the loop, with nothing on screen indicating why it hung. Drop `SC_KEYMENU` in the window procedure next to `WM_CLOSE` handling so keyboard menu activation cannot freeze the game thread. **What is in it** - `crates/xcl/src/hle/d3d12x/present.rs`: intercept `WM_SYSCOMMAND` with `SC_KEYMENU` in `wndproc` and drop it; add unit test `syscommand_keymenu_is_dropped`. **Tested** - Hardware: NVIDIA GeForce RTX 4090, Intel Core i9-10850K @ 3.60 GHz, Windows 11 x64 (26200), `rustc 1.97.1`, release/debug - `cargo test -p xcl --lib syscommand_keymenu_is_dropped`: 1 passed, 0 failed **Regression run** `main` (`1d027e5`): ``` xcl-smoke v1 commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331 gpu: NVIDIA GeForce RTX 4090 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1529 (PresentX 1529) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15898 MB ``` PR (`cd45c76`): ``` xcl-smoke v1 commit: cd45c763b17e9c684936cbe2d0b71a699900332f gpu: NVIDIA GeForce RTX 4090 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1584 (PresentX 1585) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17086 MB ``` **Not tested** - AMD RDNA GPU adapter. **AI use** - Gemini 4 Hydrogen + custom harness: identified window menu freeze, implemented message drop, wrote unit test, and regression verified.
futurepro62 commented 2026-11-24 17:06:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T16:54:10Z.


Full-suite run, since this PR has no test report yet. Tested exact head 98672d6 (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: syscommand_keymenu_is_dropped.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7138383472 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1441#issuecomment-7138383472). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T16:54:10Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `98672d6` (on its base `930e8b4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `syscommand_keymenu_is_dropped`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**, no skips. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
mastrr9 commented 2026-11-24 17:06:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mastrr9 on 2026-11-24T17:05:41Z.


Verified head 98672d691847685e9a501b627cbfe8ce3eefb621 on Windows 11 / NVIDIA RTX 5080:

  • cargo test -p xcl --lib -- hle::d3d12x::present --test-threads=4: 7 passed, 0 failed, 0 ignored (0 new compiler warnings).
<!-- greyfinch-sync:ivall/xcl:comment:7138675215 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1441#issuecomment-7138675215). Originally posted by [mastrr9](https://github.com/mastrr9) on 2026-11-24T17:05:41Z. --- Verified head `98672d691847685e9a501b627cbfe8ce3eefb621` on Windows 11 / NVIDIA RTX 5080: - `cargo test -p xcl --lib -- hle::d3d12x::present --test-threads=4`: **7 passed, 0 failed, 0 ignored** (0 new compiler warnings).
DavidM1911 commented 2026-11-24 19:07:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:52:35Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7141275243 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1441#issuecomment-7141275243). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:52:35Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
DavidM1911 commented 2026-11-26 06:06:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:27:41Z.


Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7183505296 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1441#issuecomment-7183505296). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T05:27:41Z. --- Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
github-actions[bot] commented 2026-12-01 02:32:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:32:36Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7298729053 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1441#issuecomment-7298729053). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:32:36Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 05:45:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:45:51Z.


Triage (#1607) – head cd45c76

No open or merged PR makes the same change; main's wndproc (present.rs) still passes WM_SYSCOMMAND/SC_KEYMENU to DefWindowProcW.
frame_dump_tests::syscommand_keymenu_is_dropped calls wndproc with a null HWND; DefWindowProcW on a null window most likely returns 0 too, so the test probably passes without the fix and does not show that the message is dropped.
Dropping every SC_KEYMENU also disables Alt+Space (the system menu); worth a line in the description. The PR conflicts with main and needs a rebase.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302112761 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1441#issuecomment-7302112761). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:45:51Z. --- **Triage (#1607)** – head cd45c76 No open or merged PR makes the same change; `main`'s `wndproc` (present.rs) still passes `WM_SYSCOMMAND`/`SC_KEYMENU` to `DefWindowProcW`. `frame_dump_tests::syscommand_keymenu_is_dropped` calls `wndproc` with a null `HWND`; `DefWindowProcW` on a null window most likely returns 0 too, so the test probably passes without the fix and does not show that the message is dropped. Dropping every `SC_KEYMENU` also disables Alt+Space (the system menu); worth a line in the description. The PR conflicts with `main` and needs a rebase. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/1441:upstream-pr/1441'
git switch 'upstream-pr/1441'

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/1441'
git switch 'upstream-pr/1441'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1441'
git switch 'upstream-pr/1441'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1441'
git switch 'main'
git merge --squash 'upstream-pr/1441'
git switch 'main'
git merge --ff-only 'upstream-pr/1441'
git switch 'main'
git merge 'upstream-pr/1441'
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
xcl-dev/xcl!1431
No description provided.