fix: setContentProtection(true)
after hide on Windows (#45889)
fix: content protection after hide on Windows
5789117
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
179fde9278
commit
6eb4932c68
8 changed files with 60 additions and 11 deletions
|
@ -1317,17 +1317,15 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
|
|||
|
||||
void NativeWindowViews::SetContentProtection(bool enable) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
HWND hwnd = GetAcceleratedWidget();
|
||||
DWORD affinity = enable ? WDA_EXCLUDEFROMCAPTURE : WDA_NONE;
|
||||
::SetWindowDisplayAffinity(hwnd, affinity);
|
||||
if (!layered_) {
|
||||
// Workaround to prevent black window on screen capture after hiding and
|
||||
// showing the BrowserWindow.
|
||||
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
ex_style |= WS_EX_LAYERED;
|
||||
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
|
||||
layered_ = true;
|
||||
}
|
||||
widget()->native_widget_private()->SetAllowScreenshots(!enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NativeWindowViews::IsContentProtected() const {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
return !widget()->native_widget_private()->AreScreenshotsAllowed();
|
||||
#else // Not implemented on Linux
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue