From e6ae59976b810a7dc05d806194b70f838b2d5cfd Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Tue, 30 Oct 2018 12:31:51 +0700 Subject: [PATCH] Remove most of our 10.10 compatibility checks --- .../src/OFB/OFBFinderTagsChooser.mm | 7 +----- .../src/OakUIConstructionFunctions.mm | 23 ++++++------------- .../OakFilterList/src/BundleItemChooser.mm | 4 +--- Frameworks/OakFilterList/src/OakChooser.mm | 6 ++--- .../OakFilterList/src/ui/SearchField.mm | 4 +--- Frameworks/license/src/LicenseManager.mm | 8 ------- 6 files changed, 12 insertions(+), 40 deletions(-) diff --git a/Frameworks/FileBrowser/src/OFB/OFBFinderTagsChooser.mm b/Frameworks/FileBrowser/src/OFB/OFBFinderTagsChooser.mm index 973ada43..c9814a93 100644 --- a/Frameworks/FileBrowser/src/OFB/OFBFinderTagsChooser.mm +++ b/Frameworks/FileBrowser/src/OFB/OFBFinderTagsChooser.mm @@ -171,14 +171,9 @@ static constexpr CGFloat LabelNameHeight = 15; NSMutableParagraphStyle* style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [style setAlignment:NSCenterTextAlignment]; - NSColor* labelColor; - if([NSColor respondsToSelector:@selector(secondaryLabelColor)]) // MAC_OS_X_VERSION_10_10 - labelColor = [NSColor secondaryLabelColor]; - else labelColor = [NSColor colorWithCalibratedWhite:0 alpha:0.5]; - NSDictionary* labelAttributes = @{ NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]], - NSForegroundColorAttributeName: labelColor, + NSForegroundColorAttributeName: [NSColor secondaryLabelColor], NSParagraphStyleAttributeName: style, }; return labelAttributes; diff --git a/Frameworks/OakAppKit/src/OakUIConstructionFunctions.mm b/Frameworks/OakAppKit/src/OakUIConstructionFunctions.mm index 5ea07a8c..b58d01b1 100644 --- a/Frameworks/OakAppKit/src/OakUIConstructionFunctions.mm +++ b/Frameworks/OakAppKit/src/OakUIConstructionFunctions.mm @@ -239,22 +239,13 @@ OakRolloverButton* OakCreateCloseButton (NSString* accessibilityLabel) if(self.style == OakBackgroundFillViewStyleStatusBar) { - // MAC_OS_X_VERSION_10_10 - if(OAK_AVAILABLE(10, 10)) - { - NSVisualEffectView* effectView = [[NSVisualEffectView alloc] initWithFrame:[self bounds]]; - effectView.material = NSVisualEffectMaterialTitlebar; - effectView.blendingMode = NSVisualEffectBlendingModeWithinWindow; - effectView.state = NSVisualEffectStateFollowsWindowActiveState; - _visualEffectBackgroundView = effectView; - [_visualEffectBackgroundView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; - [self addSubview:_visualEffectBackgroundView positioned:NSWindowBelow relativeTo:nil]; - } - else - { - self.activeBackgroundGradient = [[NSGradient alloc] initWithColorsAndLocations:[NSColor colorWithCalibratedWhite:1 alpha:0.68], 0.0, [NSColor colorWithCalibratedWhite:1 alpha:0.0416], 0.0416, [NSColor colorWithCalibratedWhite:1 alpha:0], 1.0, nil]; - self.inactiveBackgroundGradient = [[NSGradient alloc] initWithColorsAndLocations:[NSColor colorWithCalibratedWhite:1 alpha:0.68], 0.0, [NSColor colorWithCalibratedWhite:1 alpha:0.0416], 0.0416, [NSColor colorWithCalibratedWhite:1 alpha:0], 1.0, nil]; - } + NSVisualEffectView* effectView = [[NSVisualEffectView alloc] initWithFrame:[self bounds]]; + effectView.material = NSVisualEffectMaterialTitlebar; + effectView.blendingMode = NSVisualEffectBlendingModeWithinWindow; + effectView.state = NSVisualEffectStateFollowsWindowActiveState; + _visualEffectBackgroundView = effectView; + [_visualEffectBackgroundView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; + [self addSubview:_visualEffectBackgroundView positioned:NSWindowBelow relativeTo:nil]; } if(self.style == OakBackgroundFillViewStyleDivider) diff --git a/Frameworks/OakFilterList/src/BundleItemChooser.mm b/Frameworks/OakFilterList/src/BundleItemChooser.mm index 9749db69..db7df054 100644 --- a/Frameworks/OakFilterList/src/BundleItemChooser.mm +++ b/Frameworks/OakFilterList/src/BundleItemChooser.mm @@ -634,9 +634,7 @@ static std::vector relevant_items_in_scope (scope::context_t [_keyEquivalentView setTranslatesAutoresizingMaskIntoConstraints:NO]; [_keyEquivalentView bind:NSValueBinding toObject:self withKeyPath:@"keyEquivalentString" options:nil]; [_keyEquivalentView addObserver:self forKeyPath:@"recording" options:NSKeyValueObservingOptionNew context:kRecordingBinding]; - - if(nil != &NSAccessibilitySharedFocusElementsAttribute) // MAC_OS_X_VERSION_10_10 - [_keyEquivalentView accessibilitySetOverrideValue:@[ self.tableView ] forAttribute:NSAccessibilitySharedFocusElementsAttribute]; + [_keyEquivalentView accessibilitySetOverrideValue:@[ self.tableView ] forAttribute:NSAccessibilitySharedFocusElementsAttribute]; } return _keyEquivalentView; } diff --git a/Frameworks/OakFilterList/src/OakChooser.mm b/Frameworks/OakFilterList/src/OakChooser.mm index 4e3a4fbb..c0c36da0 100644 --- a/Frameworks/OakFilterList/src/OakChooser.mm +++ b/Frameworks/OakFilterList/src/OakChooser.mm @@ -141,8 +141,7 @@ static void* kFirstResponderBinding = &kFirstResponderBinding; tableView.target = self; tableView.dataSource = self; tableView.delegate = self; - if(nil != &NSAccessibilitySharedFocusElementsAttribute) // MAC_OS_X_VERSION_10_10 - [_searchField.cell accessibilitySetOverrideValue:@[tableView] forAttribute:NSAccessibilitySharedFocusElementsAttribute]; + [_searchField.cell accessibilitySetOverrideValue:@[tableView] forAttribute:NSAccessibilitySharedFocusElementsAttribute]; _tableView = tableView; _scrollView = [[NSScrollView alloc] initWithFrame:NSZeroRect]; @@ -274,8 +273,7 @@ static void* kFirstResponderBinding = &kFirstResponderBinding; [self updateFilterString:_filterString]; // see http://lists.apple.com/archives/accessibility-dev/2014/Aug/msg00024.html - if(nil != &NSAccessibilitySharedFocusElementsAttribute) // MAC_OS_X_VERSION_10_10 - NSAccessibilityPostNotification(_tableView, NSAccessibilitySelectedRowsChangedNotification); + NSAccessibilityPostNotification(_tableView, NSAccessibilitySelectedRowsChangedNotification); } - (void)updateFilterString:(NSString*)aString diff --git a/Frameworks/OakFilterList/src/ui/SearchField.mm b/Frameworks/OakFilterList/src/ui/SearchField.mm index b2a0972b..34fe0249 100644 --- a/Frameworks/OakFilterList/src/ui/SearchField.mm +++ b/Frameworks/OakFilterList/src/ui/SearchField.mm @@ -165,8 +165,6 @@ static NSString* CreateSpacedString(NSUInteger length) @implementation OakLinkedSearchField + (void)initialize { - // MAC_OS_X_VERSION_10_10 - if((nil == &NSAccessibilitySharedFocusElementsAttribute) && (self == OakLinkedSearchField.class)) - [OakLinkedSearchField setCellClass:[OakLinkedSearchFieldCell class]]; + [OakLinkedSearchField setCellClass:[OakLinkedSearchFieldCell class]]; } @end diff --git a/Frameworks/license/src/LicenseManager.mm b/Frameworks/license/src/LicenseManager.mm index f78d9c25..1e78304a 100644 --- a/Frameworks/license/src/LicenseManager.mm +++ b/Frameworks/license/src/LicenseManager.mm @@ -290,10 +290,6 @@ static NSString* const kAddLicenseViewIdentifier = @"org.TextMate.addLicenseButt - (void)addRegisterButtonToWindow:(NSWindow*)window { - // MAC_OS_X_VERSION_10_10 - if(![window respondsToSelector:@selector(addTitlebarAccessoryViewController:)]) - return; - NSButton* addLicenseButton = [[NSButton alloc] initWithFrame:NSZeroRect]; addLicenseButton.cell.backgroundStyle = NSBackgroundStyleRaised; @@ -318,10 +314,6 @@ static NSString* const kAddLicenseViewIdentifier = @"org.TextMate.addLicenseButt - (void)removeAllRegisterButtons:(id)sender { - // MAC_OS_X_VERSION_10_10 - if(![NSWindow instancesRespondToSelector:@selector(titlebarAccessoryViewControllers)]) - return; - for(NSWindow* win in [NSApp orderedWindows]) { NSArray* viewControllers = win.titlebarAccessoryViewControllers;