Merge pull request #8619 from electron/mac-os-version-checks
Use IsAtLeastOS10_* version checks
This commit is contained in:
commit
5cd18fe32a
1 changed files with 10 additions and 10 deletions
|
@ -228,7 +228,7 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
- (void)windowWillEnterFullScreen:(NSNotification*)notification {
|
||||
// Hide the native toolbar before entering fullscreen, so there is no visual
|
||||
// artifacts.
|
||||
if (base::mac::IsOS10_10() &&
|
||||
if (base::mac::IsAtLeastOS10_10() &&
|
||||
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
||||
NSWindow* window = shell_->GetNativeWindow();
|
||||
[window setToolbar:nil];
|
||||
|
@ -243,7 +243,7 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
// have to set one, because title bar is visible here.
|
||||
NSWindow* window = shell_->GetNativeWindow();
|
||||
if ((shell_->transparent() || !shell_->has_frame()) &&
|
||||
base::mac::IsOS10_10() &&
|
||||
base::mac::IsAtLeastOS10_10() &&
|
||||
// FIXME(zcbenz): Showing titlebar for hiddenInset window is weird under
|
||||
// fullscreen mode.
|
||||
shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET) {
|
||||
|
@ -252,7 +252,7 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
|
||||
// Restore the native toolbar immediately after entering fullscreen, if we do
|
||||
// this before leaving fullscreen, traffic light buttons will be jumping.
|
||||
if (base::mac::IsOS10_10() &&
|
||||
if (base::mac::IsAtLeastOS10_10() &&
|
||||
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
||||
base::scoped_nsobject<NSToolbar> toolbar(
|
||||
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
||||
|
@ -269,13 +269,13 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
// Restore the titlebar visibility.
|
||||
NSWindow* window = shell_->GetNativeWindow();
|
||||
if ((shell_->transparent() || !shell_->has_frame()) &&
|
||||
base::mac::IsOS10_10() &&
|
||||
base::mac::IsAtLeastOS10_10() &&
|
||||
shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET) {
|
||||
[window setTitleVisibility:NSWindowTitleHidden];
|
||||
}
|
||||
|
||||
// Turn off the style for toolbar.
|
||||
if (base::mac::IsOS10_10() &&
|
||||
if (base::mac::IsAtLeastOS10_10() &&
|
||||
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
||||
shell_->SetStyleMask(false, NSFullSizeContentViewWindowMask);
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ NativeWindowMac::NativeWindowMac(
|
|||
[window_ setDisableKeyOrMainWindow:YES];
|
||||
|
||||
if (transparent() || !has_frame()) {
|
||||
if (base::mac::IsOS10_10()) {
|
||||
if (base::mac::IsAtLeastOS10_10()) {
|
||||
// Don't show title bar.
|
||||
[window_ setTitleVisibility:NSWindowTitleHidden];
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ NativeWindowMac::NativeWindowMac(
|
|||
|
||||
// Hide the title bar.
|
||||
if (title_bar_style_ == HIDDEN_INSET) {
|
||||
if (base::mac::IsOS10_10()) {
|
||||
if (base::mac::IsAtLeastOS10_10()) {
|
||||
[window_ setTitlebarAppearsTransparent:YES];
|
||||
base::scoped_nsobject<NSToolbar> toolbar(
|
||||
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
||||
|
@ -1104,7 +1104,7 @@ void NativeWindowMac::Center() {
|
|||
void NativeWindowMac::SetTitle(const std::string& title) {
|
||||
// For macOS <= 10.9, the setTitleVisibility API is not available, we have
|
||||
// to avoid calling setTitle for frameless window.
|
||||
if (!base::mac::IsOS10_10() && (transparent() || !has_frame()))
|
||||
if (!base::mac::IsAtLeastOS10_10() && (transparent() || !has_frame()))
|
||||
return;
|
||||
|
||||
[window_ setTitle:base::SysUTF8ToNSString(title)];
|
||||
|
@ -1314,7 +1314,7 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
|||
vibrancyType = NSVisualEffectMaterialTitlebar;
|
||||
}
|
||||
|
||||
if (base::mac::IsOS10_11()) {
|
||||
if (base::mac::IsAtLeastOS10_11()) {
|
||||
// TODO(kevinsawicki): Use NSVisualEffectMaterial* constants directly once
|
||||
// they are available in the minimum SDK version
|
||||
if (type == "selection") {
|
||||
|
|
Loading…
Reference in a new issue