user: hide title console window when DWM cloaking is unavailable (#175) #794

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

@⁠gsucristo on GitHub · 2026-11-24 05:33 UTC · original
gsucristo:user/wine-hide-console-window → main · +92 −9 · 1 files · 1 commits · open

Keep the title's 1920x1080 console window hidden when DWM window cloaking is unavailable (as under Wine), where DwmSetWindowAttribute(DWMWA_CLOAK) fails or leaves DWMWA_CLOAKED == 0 and causes the title's blank window to cover XCL's presenter window. Part of #175.

What is in it

  • crates/xcl/src/hle/user.rs: query DwmGetWindowAttribute(DWMWA_CLOAKED) after DwmSetWindowAttribute(DWMWA_CLOAK); if cloaking did not take effect, call ShowWindow(hwnd, SW_HIDE) and strip SWP_SHOWWINDOW in console_wndproc on WM_WINDOWPOSCHANGING so subsequent title show calls keep it hidden while keeping its 1920x1080 client rect.
  • crates/xcl/src/hle/user.rs (tests): add console_window_stays_hidden_when_uncloaked.

Tested

  • NVIDIA GeForce RTX 4090 (driver 610.57.04), AMD Ryzen 9 7950X3D, Linux + Proton Experimental / vkd3d-proton (relaxed vtable check), rustc 1.98.1 (x86_64-pc-windows-msvc cross-compile), debug.
  • cargo test --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --skip a_freed_block_is_decommitted_before_its_address_is_reused: 700 passed, 4 failed (pre-existing Wine-only failures: hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime, test_title_runs_and_game_folder_is_untouched, disk_free_space_ex_reports_pls_quota, set_predication_buffer_state_and_kickoff), 41 ignored, 1 filtered (a_freed_block_is_decommitted_before_its_address_is_reused).
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64).
  • New test passed: hle::user::tests::console_window_stays_hidden_when_uncloaked (verified IsWindowVisible == 0 under Wine after ShowWindow(SW_SHOW) and SetWindowPos(SWP_SHOWWINDOW)).

Regression run

  • Pending native Windows scripts/smoke.ps1 runs on a retail title (Linux/Proton environment only).

Not tested

  • Native Windows 10/11 DWM-cloaked branch (cloaked != 0), AMD RDNA, scripts/smoke.ps1 retail regression run.

AI use

  • Antigravity (Google DeepMind; exact model version not exposed to the agent) — assisted with code, test, and PR description; reviewed, built, and run on hardware by the author.
**@⁠gsucristo** on GitHub · 2026-11-24 05:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/794) `gsucristo:user/wine-hide-console-window` → `main` · +92 −9 · 1 files · 1 commits · open Keep the title's 1920x1080 console window hidden when DWM window cloaking is unavailable (as under Wine), where `DwmSetWindowAttribute(DWMWA_CLOAK)` fails or leaves `DWMWA_CLOAKED == 0` and causes the title's blank window to cover XCL's presenter window. Part of #175. **What is in it** - `crates/xcl/src/hle/user.rs`: query `DwmGetWindowAttribute(DWMWA_CLOAKED)` after `DwmSetWindowAttribute(DWMWA_CLOAK)`; if cloaking did not take effect, call `ShowWindow(hwnd, SW_HIDE)` and strip `SWP_SHOWWINDOW` in `console_wndproc` on `WM_WINDOWPOSCHANGING` so subsequent title show calls keep it hidden while keeping its 1920x1080 client rect. - `crates/xcl/src/hle/user.rs` (`tests`): add `console_window_stays_hidden_when_uncloaked`. **Tested** - NVIDIA GeForce RTX 4090 (driver 610.57.04), AMD Ryzen 9 7950X3D, Linux + Proton Experimental / vkd3d-proton (relaxed vtable check), `rustc 1.98.1` (`x86_64-pc-windows-msvc` cross-compile), debug. - `cargo test --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --skip a_freed_block_is_decommitted_before_its_address_is_reused`: 700 passed, 4 failed (pre-existing Wine-only failures: `hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime`, `test_title_runs_and_game_folder_is_untouched`, `disk_free_space_ex_reports_pls_quota`, `set_predication_buffer_state_and_kickoff`), 41 ignored, 1 filtered (`a_freed_block_is_decommitted_before_its_address_is_reused`). - `SKIPPED` GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` (`no wave64`), `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` (`no wave64`). - New test passed: `hle::user::tests::console_window_stays_hidden_when_uncloaked` (verified `IsWindowVisible == 0` under Wine after `ShowWindow(SW_SHOW)` and `SetWindowPos(SWP_SHOWWINDOW)`). **Regression run** - Pending native Windows `scripts/smoke.ps1` runs on a retail title (Linux/Proton environment only). **Not tested** - Native Windows 10/11 DWM-cloaked branch (`cloaked != 0`), AMD RDNA, `scripts/smoke.ps1` retail regression run. **AI use** - Antigravity (Google DeepMind; exact model version not exposed to the agent) — assisted with code, test, and PR description; reviewed, built, and run on hardware by the author.
XCL cloaks the title's 1920x1080 console window via `DwmSetWindowAttribute`
(`DWMWA_CLOAK`) so it stays invisible behind XCL's own presenter window. On
environments without DWM cloaking (such as Wine), the call fails or leaves
`DWMWA_CLOAKED == 0`, so the title window remains visible on top of XCL.

Check both `DwmSetWindowAttribute` and `DwmGetWindowAttribute(DWMWA_CLOAKED)`;
when the window is not actually cloaked, hide it with `ShowWindow(SW_HIDE)`
and strip `SWP_SHOWWINDOW` in `WM_WINDOWPOSCHANGING` so title calls to show
it keep it hidden while preserving its 1920x1080 client rect.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:32:46 +00:00
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 05:51 UTC · original

Test run of bee31d566288a70b7c749146527577af73081c0d on AMD RDNA4. I merged it onto current main e50836b locally (clean merge).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200 (native Windows, not Wine), Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 705 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 664 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the user tests pass.

Review: Hiding the console window only when DWMWA_CLOAKED reads back 0 after DWMWA_CLOAK leaves native Windows (where cloaking works) on the existing path. Not checked under Wine.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 05:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/794#issuecomment-7123338803) Test run of `bee31d566288a70b7c749146527577af73081c0d` on AMD RDNA4. I merged it onto current `main` `e50836b` locally (clean merge). **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200 (native Windows, not Wine), Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **705 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 664 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; the `user` tests pass. **Review:** Hiding the console window only when `DWMWA_CLOAKED` reads back 0 after `DWMWA_CLOAK` leaves native Windows (where cloaking works) on the existing path. Not checked under Wine. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 07:17 UTC · original

Regression runs for this PR's head bee31d5 and for its base main d208e14, on a retail title (same title, 60 s each), made with scripts/smoke.ps1 (release, clean tree at each commit) and pasted unedited, for Regression run.

main:

xcl-smoke v1
commit: d208e14b765f469f4b56301b78afa8dac5378339
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1647 (PresentX 1648)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16733 MB

this PR:

xcl-smoke v1
commit: bee31d566288a70b7c749146527577af73081c0d
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16915 MB

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974 (native Windows), Rust 1.90.0

Not tested

  • the unit tests on this machine
  • Wine: on native Windows DWM cloaking is available, so the new path is not taken; this is a regression check only

Report written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-24 07:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/794#issuecomment-7124834248) Regression runs for this PR's head `bee31d5` and for its base `main` `d208e14`, on a retail title (same title, 60 s each), made with `scripts/smoke.ps1` (release, clean tree at each commit) and pasted unedited, for **Regression run**. main: ``` xcl-smoke v1 commit: d208e14b765f469f4b56301b78afa8dac5378339 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1647 (PresentX 1648) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16733 MB ``` this PR: ``` xcl-smoke v1 commit: bee31d566288a70b7c749146527577af73081c0d gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1654 (PresentX 1654) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16915 MB ``` **Tested** - NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974 (native Windows), Rust 1.90.0 **Not tested** - the unit tests on this machine - Wine: on native Windows DWM cloaking is available, so the new path is not taken; this is a regression check only Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠NicolaiVdS on GitHub · 2026-11-24 11:05 UTC · original

Linux (Wine) report on NVIDIA.

Tested

  • AMD Ryzen 9 9950X, NVIDIA GeForce RTX 5070 Ti (driver 620.73.04), 30 GB RAM + 7 GB swap, Arch Linux (kernel 7.3.5), GE-Proton11-5 (wine-11.0 Staging). xcl.exe cross-built in release for x86_64-pc-windows-gnu (MinGW), rustc 1.99.0.
  • Build: main 09940bb + #867 at dfe1aaa + a small local change on top of #867 (XCL's own fences go through its unwrap_fence) + #684's e56dbc3 and #794's bee31d5 cherry-picked. Not this PR's head on its own.
  • cargo test --release --target x86_64-pc-windows-gnu -p xcl --lib -- hle::xg::tests hle::user::tests, run under that Wine: 10 passed, 0 failed, 0 ignored. console_window_stays_hidden_when_uncloaked is one of them.
  • Retail title 1.0.2.1 (TitleID 7952987A): without this PR, every run logged … is the console's screen (1920x1080, no frame, cloaked) and a second, white 1920x1080 window stayed open next to XCL's. With it, every run (three) logs … (1920x1080, no frame, hidden), and the frames are presented in XCL's window as before.

Not tested: Windows; the whole workspace suite (only hle::xg / hle::user, under Wine); scripts/smoke.ps1; this PR without #684 and #867.

AI use: Claude Code (Claude Opus 5.5) read the logs and the title's call site, built the branches, ran the tests and the scripted runs, and wrote this report. The runs are on my machine, on the hardware above.

**@⁠NicolaiVdS** on GitHub · 2026-11-24 11:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/794#issuecomment-7129648968) Linux (Wine) report on NVIDIA. **Tested** - AMD Ryzen 9 9950X, NVIDIA GeForce RTX 5070 Ti (driver 620.73.04), 30 GB RAM + 7 GB swap, Arch Linux (kernel 7.3.5), GE-Proton11-5 (wine-11.0 Staging). `xcl.exe` cross-built in release for `x86_64-pc-windows-gnu` (MinGW), rustc 1.99.0. - Build: `main` `09940bb` + #867 at `dfe1aaa` + a small local change on top of #867 (XCL's own fences go through its `unwrap_fence`) + #684's `e56dbc3` and #794's `bee31d5` cherry-picked. Not this PR's head on its own. - `cargo test --release --target x86_64-pc-windows-gnu -p xcl --lib -- hle::xg::tests hle::user::tests`, run under that Wine: 10 passed, 0 failed, 0 ignored. `console_window_stays_hidden_when_uncloaked` is one of them. - Retail title 1.0.2.1 (TitleID 7952987A): without this PR, every run logged `… is the console's screen (1920x1080, no frame, cloaked)` and a second, white 1920x1080 window stayed open next to XCL's. With it, every run (three) logs `… (1920x1080, no frame, hidden)`, and the frames are presented in XCL's window as before. **Not tested:** Windows; the whole workspace suite (only `hle::xg` / `hle::user`, under Wine); `scripts/smoke.ps1`; this PR without #684 and #867. **AI use:** Claude Code (Claude Opus 5.5) read the logs and the title's call site, built the branches, ran the tests and the scripted runs, and wrote this report. The runs are on my machine, on the hardware above.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 10:58 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 10:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/794#issuecomment-7160421329) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠vakaobr on GitHub · 2026-11-25 18:09 UTC · original

Tested bee31d5 on a Mac, together with #1462: the test title's window check passes there with it.

Tested (MacBook Pro M5 Pro, macOS 27.2.1, CrossOver 26.3.0, D3DMetal 3.0, Rust 1.100.0 x86_64-pc-windows-gnu, debug). Cherry-picked cleanly with #1462 onto the Mac branch from #258 (vakaobr/xcl mac/integration, now 5f9a58f, which also has #750 and #1698 so the title runs to the end), not onto main.

  • Without it, CrossOver's DwmSetWindowAttribute(DWMWA_CLOAK) returns S_OK and DwmGetWindowAttribute(DWMWA_CLOAKED) returns E_NOTIMPL (0x80004001; GE-Proton's S_OK with 0 in #1481 is another variant, which the hr_get < 0 || cloaked == 0 test covers too). A small program making the same window (WS_POPUP | WS_VISIBLE, WS_EX_TOOLWINDOW, 1920x1080, cloaked) gets a window macOS lists as on screen at 1920x1080 (CGWindowListCopyWindowInfo), behind or over the presenter window depending on order.
  • The test title, run with xcl run 3 times: all 50 of its checks pass and it exits with 0. The log says (1920x1080, no frame, hidden). Without this and #1462 the user32 … check fails (W: not cloaked).
  • hle::user::tests, each in its own process: 4 of 4 pass, console_window_stays_hidden_when_uncloaked among them.

Not measured: whether macOS lists the hidden window. The test title's windows live for milliseconds, too short for me to catch in the window list, so that rests on the unit test (IsWindowVisible 0 after the title shows it again).

A question rather than a finding: a hidden window is not visible to the title and cannot be the foreground window, where a cloaked one can be. A title that waits for its window to be visible or active could behave differently than on Windows. On this Mac a layered window with alpha 0 and WS_EX_TRANSPARENT stays visible to Win32 while macOS draws it at alpha 0 (CGWindowList: on screen, alpha 0), in case that ever matters. I have no title that shows a difference.

Not tested: Windows, main, a retail title.

AI use: Claude Code with Claude Opus 5.5 ran the tests and probes and wrote this report.

**@⁠vakaobr** on GitHub · 2026-11-25 18:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/794#issuecomment-7170515683) Tested `bee31d5` on a Mac, together with #1462: the test title's window check passes there with it. **Tested** (MacBook Pro M5 Pro, macOS 27.2.1, CrossOver 26.3.0, D3DMetal 3.0, Rust 1.100.0 `x86_64-pc-windows-gnu`, debug). Cherry-picked cleanly with #1462 onto the Mac branch from #258 (`vakaobr/xcl` `mac/integration`, now `5f9a58f`, which also has #750 and #1698 so the title runs to the end), not onto `main`. - Without it, CrossOver's `DwmSetWindowAttribute(DWMWA_CLOAK)` returns `S_OK` and `DwmGetWindowAttribute(DWMWA_CLOAKED)` returns `E_NOTIMPL` (`0x80004001`; GE-Proton's `S_OK` with 0 in #1481 is another variant, which the `hr_get < 0 || cloaked == 0` test covers too). A small program making the same window (`WS_POPUP | WS_VISIBLE`, `WS_EX_TOOLWINDOW`, 1920x1080, cloaked) gets a window macOS lists as on screen at 1920x1080 (`CGWindowListCopyWindowInfo`), behind or over the presenter window depending on order. - The test title, run with `xcl run` 3 times: all 50 of its checks pass and it exits with 0. The log says `(1920x1080, no frame, hidden)`. Without this and #1462 the `user32 …` check fails (`W: not cloaked`). - `hle::user::tests`, each in its own process: 4 of 4 pass, `console_window_stays_hidden_when_uncloaked` among them. **Not measured:** whether macOS lists the hidden window. The test title's windows live for milliseconds, too short for me to catch in the window list, so that rests on the unit test (`IsWindowVisible` 0 after the title shows it again). A question rather than a finding: a hidden window is not visible to the title and cannot be the foreground window, where a cloaked one can be. A title that waits for its window to be visible or active could behave differently than on Windows. On this Mac a layered window with alpha 0 and `WS_EX_TRANSPARENT` stays visible to Win32 while macOS draws it at alpha 0 (`CGWindowList`: on screen, alpha 0), in case that ever matters. I have no title that shows a difference. **Not tested:** Windows, `main`, a retail title. AI use: Claude Code with Claude Opus 5.5 ran the tests and probes and wrote this report.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-794'
git switch 'github-bot/gh-794'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-794'
git switch 'github-bot/gh-794'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-794'
git switch 'main'
git merge --squash 'github-bot/gh-794'
git switch 'main'
git merge --ff-only 'github-bot/gh-794'
git switch 'main'
git merge 'github-bot/gh-794'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.