Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DWMWA_CLOAK support on Windows #3576

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Neo-Zhixing
Copy link

@Neo-Zhixing Neo-Zhixing commented Mar 9, 2024

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

Tested on Windows 11 build 22621.3155

At least one application is using this attribute: vizia/vizia#386

DWMWA_CLOAK is explained in detail in this blog post: https://devblogs.microsoft.com/oldnewthing/20200302-00/?p=103507

Comment on lines +252 to +255
/// Cloaks the window such that it is not visible to the user. The window is still composed by DWM.
///
/// Not supported on Windows 7 and earlier.
fn set_cloaked(&self, cloaked: bool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like content protected? Or what it means here? Like it's not visible, but you can screen capture it? Like overlay, etc?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description was copy pasted from the winapi docs, but basically DWMWA_CLOAK makes a window invisible.

This is explained in detail here: https://devblogs.microsoft.com/oldnewthing/20200302-00/?p=103507

The shell has a concept called cloaking, in which a window is given all the trappings of visibility, without actually being presented to the user. As far as the app can tell, it seems to be visible: It still has the WS_VISIBLE window style, its coordinates are still within the bounds of the monitor, it still gets WM_PAINT messages, it has a non-empty clipping region, all the ways a traditional Win32 app has of detecting whether it is on screen say, “Yup, you’re on screen. Everything is just fine!”

From the user's perspective, an invisible window will not show up on the taskbar, but a cloaked window will.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: A cloaked window will not appear on Taskbar. Cloaking is particularly useful when you want a window to complete its UI layout, sizing, etc. without flickering in front of the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

4 participants