fix: window content protection on older Windows versions (#47856)
This commit is contained in:
parent
c569d5e4ba
commit
01faaa30ea
3 changed files with 17 additions and 6 deletions
|
@ -176,6 +176,11 @@ void ElectronDesktopWindowTreeHostWin::UpdateAllowScreenshots() {
|
|||
if (allowed == allow_screenshots_)
|
||||
return;
|
||||
|
||||
// On some older Windows versions, setting the display affinity
|
||||
// to WDA_EXCLUDEFROMCAPTURE won't prevent the window from being
|
||||
// captured - setting WS_EX_LAYERED mitigates this issue.
|
||||
if (base::win::GetVersion() < base::win::Version::WIN11_22H2)
|
||||
native_window_view_->SetLayered();
|
||||
::SetWindowDisplayAffinity(
|
||||
GetAcceleratedWidget(),
|
||||
allow_screenshots_ ? WDA_NONE : WDA_EXCLUDEFROMCAPTURE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue