fix: window with CustomButtonsOnHover should have rounded corner (#26901)
This commit is contained in:
parent
b4c1e54ed3
commit
28ae68d66c
1 changed files with 5 additions and 11 deletions
|
@ -392,10 +392,6 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
|
|||
}
|
||||
|
||||
NSUInteger styleMask = NSWindowStyleMaskTitled;
|
||||
bool customOnHover = title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover;
|
||||
if (customOnHover && (!useStandardWindow || transparent() || !has_frame()))
|
||||
styleMask = NSWindowStyleMaskFullSizeContentView;
|
||||
|
||||
if (minimizable)
|
||||
styleMask |= NSMiniaturizableWindowMask;
|
||||
if (closable)
|
||||
|
@ -1697,24 +1693,22 @@ void NativeWindowMac::AddContentViewLayers(bool minimizable, bool closable) {
|
|||
// The fullscreen button should always be hidden for frameless window.
|
||||
[[window_ standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
|
||||
|
||||
// Create a custom window buttons view for kCustomButtonsOnHover.
|
||||
if (title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover) {
|
||||
buttons_view_.reset(
|
||||
[[CustomWindowButtonView alloc] initWithFrame:NSZeroRect]);
|
||||
|
||||
// NSWindowStyleMaskFullSizeContentView does not work with zoom button
|
||||
SetFullScreenable(false);
|
||||
|
||||
if (!minimizable)
|
||||
[[buttons_view_ viewWithTag:2] removeFromSuperview];
|
||||
if (!closable)
|
||||
[[buttons_view_ viewWithTag:1] removeFromSuperview];
|
||||
|
||||
[[window_ contentView] addSubview:buttons_view_];
|
||||
} else {
|
||||
if (title_bar_style_ != TitleBarStyle::kNormal)
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide the window buttons.
|
||||
// Hide the window buttons except for kHidden and kHiddenInset.
|
||||
if (title_bar_style_ == TitleBarStyle::kNormal ||
|
||||
title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover) {
|
||||
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
||||
[[window_ standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
|
||||
[[window_ standardWindowButton:NSWindowCloseButton] setHidden:YES];
|
||||
|
|
Loading…
Reference in a new issue