fix: restore previous Windows screenshotting (#47033)
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. 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
0e9c0d8c04
commit
ace7ef4316
2 changed files with 12 additions and 0 deletions
|
|
@ -126,6 +126,16 @@ bool ElectronDesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
|
||||||
return views::DesktopWindowTreeHostWin::HandleMouseEvent(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(
|
void ElectronDesktopWindowTreeHostWin::OnNativeThemeUpdated(
|
||||||
ui::NativeTheme* observed_theme) {
|
ui::NativeTheme* observed_theme) {
|
||||||
HWND hWnd = GetAcceleratedWidget();
|
HWND hWnd = GetAcceleratedWidget();
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ class ElectronDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin,
|
||||||
int frame_thickness) const override;
|
int frame_thickness) const override;
|
||||||
bool HandleMouseEventForCaption(UINT message) const override;
|
bool HandleMouseEventForCaption(UINT message) const override;
|
||||||
bool HandleMouseEvent(ui::MouseEvent* event) override;
|
bool HandleMouseEvent(ui::MouseEvent* event) override;
|
||||||
|
void HandleVisibilityChanged(bool visible) override;
|
||||||
|
void SetAllowScreenshots(bool allow) override;
|
||||||
|
|
||||||
// ui::NativeThemeObserver:
|
// ui::NativeThemeObserver:
|
||||||
void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
|
void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue