fix: make window without rounded corners closable (#32597)

This commit is contained in:
Cheng Zhao 2022-01-25 23:51:53 +09:00 committed by GitHub
parent a0b7e30fe7
commit 1cf36822e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 5 deletions

View file

@ -295,12 +295,12 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
NSUInteger styleMask = NSWindowStyleMaskTitled;
// The NSWindowStyleMaskFullSizeContentView style removes rounded corners
// for framless window.
// Removing NSWindowStyleMaskTitled removes window title, which removes
// rounded corners of window.
bool rounded_corner = true;
options.Get(options::kRoundedCorners, &rounded_corner);
if (!rounded_corner && !has_frame())
styleMask = NSWindowStyleMaskFullSizeContentView;
styleMask = 0;
if (minimizable)
styleMask |= NSMiniaturizableWindowMask;
@ -1350,7 +1350,7 @@ void NativeWindowMac::UpdateVibrancyRadii(bool fullscreen) {
if (vibrantView != nil && !vibrancy_type_.empty()) {
const bool no_rounded_corner =
[window_ styleMask] & NSWindowStyleMaskFullSizeContentView;
!([window_ styleMask] & NSWindowStyleMaskTitled);
if (!has_frame() && !is_modal() && !no_rounded_corner) {
CGFloat radius;
if (fullscreen) {