Skip to content

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

Open
gsucristo wants to merge 1 commit into
xcl-dev:mainfrom
gsucristo:user/wine-hide-console-window
Open

gsucristo wants to merge 1 commit into
xcl-dev:mainfrom
gsucristo:user/wine-hide-console-window

Conversation

@gsucristo

Copy link
Copy Markdown
Contributor

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.

…-dev#175)

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.
@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

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.

@Anon64

Anon64 commented Nov 24, 2026

Copy link
Copy Markdown

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.

@NicolaiVdS

Copy link
Copy Markdown

Linux (Wine) report on NVIDIA.

Tested

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.

CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
The test title's window check required DWMWA_CLOAKED != 0. Under Wine,
DwmGetWindowAttribute(DWMWA_CLOAKED) succeeds and reports 0 (no DWM
cloaking), so the check failed with "W: not cloaked" on every Linux and macOS
run. xcl-dev#794 makes XCL hide the window in that case and keep it hidden when the
title shows it again (SWP_SHOWWINDOW stripped in WM_WINDOWPOSCHANGING).

The check now accepts that, with xcl-dev#794's own condition: a window must be
cloaked, or not visible. It also shows each window again (ShowWindow SW_SHOW,
SetWindowPos SWP_SHOWWINDOW) and requires it to stay concealed, which covers
the second half of xcl-dev#794 on every platform. The two windows and the class are
cleaned up on every path, and a failed cleanup is reported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants