Add support for titleBarStyle: 'hidden' on OS X 10.9 (hidden-inset falls back to hidden)
This commit is contained in:
parent
6a9801b82c
commit
ab8fd49c72
3 changed files with 23 additions and 6 deletions
|
@ -127,6 +127,8 @@ class NativeWindowMac : public NativeWindow,
|
||||||
void UpdateDraggableRegions(
|
void UpdateDraggableRegions(
|
||||||
const std::vector<DraggableRegion>& regions) override;
|
const std::vector<DraggableRegion>& regions) override;
|
||||||
|
|
||||||
|
void ShowWindowButton(NSWindowButton button);
|
||||||
|
|
||||||
void InstallView();
|
void InstallView();
|
||||||
void UninstallView();
|
void UninstallView();
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,11 @@ struct Converter<atom::NativeWindowMac::TitleBarStyle> {
|
||||||
*out = atom::NativeWindowMac::HIDDEN;
|
*out = atom::NativeWindowMac::HIDDEN;
|
||||||
} else if (title_bar_style == "hidden-inset" || // Deprecate this after 2.0
|
} else if (title_bar_style == "hidden-inset" || // Deprecate this after 2.0
|
||||||
title_bar_style == "hiddenInset") {
|
title_bar_style == "hiddenInset") {
|
||||||
*out = atom::NativeWindowMac::HIDDEN_INSET;
|
if (base::mac::IsOSYosemiteOrLater()) {
|
||||||
|
*out = atom::NativeWindowMac::HIDDEN_INSET;
|
||||||
|
} else {
|
||||||
|
*out = atom::NativeWindowMac::HIDDEN;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -460,9 +464,7 @@ NativeWindowMac::NativeWindowMac(
|
||||||
bool closable = true;
|
bool closable = true;
|
||||||
options.Get(options::kClosable, &closable);
|
options.Get(options::kClosable, &closable);
|
||||||
|
|
||||||
// New title bar styles are available in Yosemite or newer
|
options.Get(options::kTitleBarStyle, &title_bar_style_);
|
||||||
if (base::mac::IsOSYosemiteOrLater())
|
|
||||||
options.Get(options::kTitleBarStyle, &title_bar_style_);
|
|
||||||
|
|
||||||
std::string windowType;
|
std::string windowType;
|
||||||
options.Get(options::kType, &windowType);
|
options.Get(options::kType, &windowType);
|
||||||
|
@ -1099,6 +1101,11 @@ void NativeWindowMac::UpdateDraggableRegions(
|
||||||
UpdateDraggableRegionViews(regions);
|
UpdateDraggableRegionViews(regions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindowMac::ShowWindowButton(NSWindowButton button) {
|
||||||
|
auto view = [window_ standardWindowButton:button];
|
||||||
|
[view.superview addSubview:view positioned:NSWindowAbove relativeTo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindowMac::InstallView() {
|
void NativeWindowMac::InstallView() {
|
||||||
// Make sure the bottom corner is rounded: http://crbug.com/396264.
|
// Make sure the bottom corner is rounded: http://crbug.com/396264.
|
||||||
// But do not enable it on OS X 10.9 for transparent window, otherwise a
|
// But do not enable it on OS X 10.9 for transparent window, otherwise a
|
||||||
|
@ -1127,8 +1134,15 @@ void NativeWindowMac::InstallView() {
|
||||||
// The fullscreen button should always be hidden for frameless window.
|
// The fullscreen button should always be hidden for frameless window.
|
||||||
[[window_ standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
|
[[window_ standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
|
||||||
|
|
||||||
if (title_bar_style_ != NORMAL)
|
if (title_bar_style_ != NORMAL) {
|
||||||
|
if (base::mac::IsOSMavericks()) {
|
||||||
|
ShowWindowButton(NSWindowZoomButton);
|
||||||
|
ShowWindowButton(NSWindowMiniaturizeButton);
|
||||||
|
ShowWindowButton(NSWindowCloseButton);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Hide the window buttons.
|
// Hide the window buttons.
|
||||||
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
||||||
|
|
|
@ -208,7 +208,7 @@ Possible values are:
|
||||||
input sparingly.
|
input sparingly.
|
||||||
* On Windows, possible type is `toolbar`.
|
* On Windows, possible type is `toolbar`.
|
||||||
|
|
||||||
The `titleBarStyle` option is only supported on macOS 10.10 Yosemite and newer.
|
The `titleBarStyle` option.
|
||||||
Possible values are:
|
Possible values are:
|
||||||
|
|
||||||
* `default` or not specified, results in the standard gray opaque Mac title
|
* `default` or not specified, results in the standard gray opaque Mac title
|
||||||
|
@ -218,6 +218,7 @@ Possible values are:
|
||||||
the top left.
|
the top left.
|
||||||
* `hidden-inset` results in a hidden title bar with an alternative look
|
* `hidden-inset` results in a hidden title bar with an alternative look
|
||||||
where the traffic light buttons are slightly more inset from the window edge.
|
where the traffic light buttons are slightly more inset from the window edge.
|
||||||
|
It is not supported on macOS 10.9 Mavericks, where it falls back to `hidden`.
|
||||||
|
|
||||||
The `webPreferences` option is an object that can have the following properties:
|
The `webPreferences` option is an object that can have the following properties:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue