Remove most of our 10.10 compatibility checks

This commit is contained in:
Allan Odgaard
2018-10-30 12:31:51 +07:00
parent aa674c08b7
commit e6ae59976b
6 changed files with 12 additions and 40 deletions

View File

@@ -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;

View File

@@ -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)

View File

@@ -634,9 +634,7 @@ static std::vector<bundles::item_ptr> 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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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;