fix: paint and flash issues on macOS (#46629)

This commit is contained in:
trop[bot] 2025-04-15 12:56:20 +02:00 committed by GitHub
parent e825107f8a
commit 339e0040ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 57 additions and 6 deletions

View file

@ -154,6 +154,9 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
bool hiddenInMissionControl = false;
options.Get(options::kHiddenInMissionControl, &hiddenInMissionControl);
bool paint_when_initially_hidden = true;
options.Get(options::kPaintWhenInitiallyHidden, &paint_when_initially_hidden);
// The window without titlebar is treated the same with frameless window.
if (title_bar_style_ != TitleBarStyle::kNormal)
set_has_frame(false);
@ -194,8 +197,8 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
params.bounds = bounds;
params.delegate = this;
params.type = views::Widget::InitParams::TYPE_WINDOW;
// Allow painting before shown, to be later disabled in ElectronNSWindow.
params.headless_mode = true;
// Possibly allow painting before shown - later disabled in ElectronNSWindow.
params.headless_mode = paint_when_initially_hidden;
if (IsTranslucent()) {
params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent;
}