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:
parent
3a6d7e0c22
commit
130f00dfcd
6 changed files with 67 additions and 10 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue