fix: fullscreen restoration on Windows (#49872)

This commit is contained in:
Shelley Vohr
2026-02-20 17:58:37 +01:00
committed by GitHub
parent 3e58c6cb3a
commit 5795689fd9
3 changed files with 30 additions and 0 deletions

View File

@@ -197,6 +197,14 @@ void ElectronDesktopWindowTreeHostWin::SetAllowScreenshots(bool allow) {
UpdateAllowScreenshots();
}
// Refs https://chromium-review.googlesource.com/c/chromium/src/+/7095963
// Chromium's fullscreen handler conflicts with ours and results in incorrect
// restoration.
void ElectronDesktopWindowTreeHostWin::Restore() {
::SendMessage(GetAcceleratedWidget(), WM_SYSCOMMAND,
static_cast<WPARAM>(SC_RESTORE), 0);
}
void ElectronDesktopWindowTreeHostWin::UpdateAllowScreenshots() {
bool allowed = views::DesktopWindowTreeHostWin::AreScreenshotsAllowed();
if (allowed == allow_screenshots_)

View File

@@ -50,6 +50,7 @@ class ElectronDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin,
LRESULT* result) override;
void HandleVisibilityChanged(bool visible) override;
void SetAllowScreenshots(bool allow) override;
void Restore() override;
// ui::NativeThemeObserver:
void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;