fix: fullscreen for windows without rounded corners (#47681)

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:
trop[bot] 2025-07-08 15:21:13 +02:00 committed by GitHub
commit 130f00dfcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 67 additions and 10 deletions

View file

@ -154,13 +154,6 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
NSUInteger styleMask = NSWindowStyleMaskTitled;
// The NSWindowStyleMaskFullSizeContentView style removes rounded corners
// for frameless window.
const bool rounded_corner =
options.ValueOrDefault(options::kRoundedCorners, true);
if (!rounded_corner && !has_frame())
styleMask = NSWindowStyleMaskBorderless;
if (minimizable)
styleMask |= NSWindowStyleMaskMiniaturizable;
if (closable)
@ -220,6 +213,11 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
SetParentWindow(parent);
}
const bool rounded_corner =
options.ValueOrDefault(options::kRoundedCorners, true);
if (!rounded_corner && !has_frame())
SetBorderless(!rounded_corner);
if (transparent()) {
// Setting the background color to clear will also hide the shadow.
[window_ setBackgroundColor:[NSColor clearColor]];
@ -768,6 +766,11 @@ void NativeWindowMac::MoveTop() {
[window_ orderWindowByShuffling:NSWindowAbove relativeTo:0];
}
void NativeWindowMac::SetBorderless(bool borderless) {
SetStyleMask(!borderless, NSWindowStyleMaskTitled);
SetStyleMask(borderless, NSWindowStyleMaskBorderless);
}
void NativeWindowMac::SetResizable(bool resizable) {
ScopedDisableResize disable_resize;
SetStyleMask(resizable, NSWindowStyleMaskResizable);