mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
fix: restore previous Windows screenshotting (#47020)
Fixes https://github.com/electron/electron/issues/45990 We previously made a change in https://github.com/electron/electron/pull/45868 to fix content protection being lost on hide and re-show. However, this cause a breaking change where protected windows were made opaque black instead of being hidden as before. This overrides relevant methods in ElectronDesktopWindowTreeHostWin to restore the previous behavior. without regressing the original issue.
This commit is contained in:
@@ -126,6 +126,16 @@ bool ElectronDesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
|
||||
return views::DesktopWindowTreeHostWin::HandleMouseEvent(event);
|
||||
}
|
||||
|
||||
void ElectronDesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) {
|
||||
if (native_window_view_->widget())
|
||||
native_window_view_->widget()->OnNativeWidgetVisibilityChanged(visible);
|
||||
}
|
||||
|
||||
void ElectronDesktopWindowTreeHostWin::SetAllowScreenshots(bool allow) {
|
||||
::SetWindowDisplayAffinity(GetAcceleratedWidget(),
|
||||
allow ? WDA_NONE : WDA_EXCLUDEFROMCAPTURE);
|
||||
}
|
||||
|
||||
void ElectronDesktopWindowTreeHostWin::OnNativeThemeUpdated(
|
||||
ui::NativeTheme* observed_theme) {
|
||||
HWND hWnd = GetAcceleratedWidget();
|
||||
|
||||
@@ -41,6 +41,8 @@ class ElectronDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin,
|
||||
int frame_thickness) const override;
|
||||
bool HandleMouseEventForCaption(UINT message) const override;
|
||||
bool HandleMouseEvent(ui::MouseEvent* event) override;
|
||||
void HandleVisibilityChanged(bool visible) override;
|
||||
void SetAllowScreenshots(bool allow) override;
|
||||
|
||||
// ui::NativeThemeObserver:
|
||||
void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
|
||||
|
||||
Reference in New Issue
Block a user