mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Fix Yosemite tabbar style check code
Use NSAppKitVersionNumber instead of MAC_OS_X_VERSION_MIN_REQUIRED
This commit is contained in:
@@ -164,12 +164,8 @@ enum {
|
||||
|
||||
oldTabBarStyle = [[view tabBarControl] styleName];
|
||||
|
||||
NSString *style;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10
|
||||
style = @"Yosemite";
|
||||
#else
|
||||
style = @"Unified";
|
||||
#endif
|
||||
NSString *style =
|
||||
shouldUseYosemiteTabBarStyle() ? @"Yosemite" : @"Unified";
|
||||
[[view tabBarControl] setStyleNamed:style];
|
||||
|
||||
// add text view
|
||||
|
||||
+11
-11
@@ -125,18 +125,18 @@ enum {
|
||||
[tabBarControl setDelegate:self];
|
||||
[tabBarControl setHidden:YES];
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10
|
||||
CGFloat screenWidth = [[NSScreen mainScreen] frame].size.width;
|
||||
[tabBarControl setStyleNamed:@"Yosemite"];
|
||||
[tabBarControl setCellMinWidth:120];
|
||||
[tabBarControl setCellMaxWidth:screenWidth];
|
||||
[tabBarControl setCellOptimumWidth:screenWidth];
|
||||
#else
|
||||
[tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]];
|
||||
[tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]];
|
||||
[tabBarControl setCellOptimumWidth:
|
||||
if (shouldUseYosemiteTabBarStyle()) {
|
||||
CGFloat screenWidth = [[NSScreen mainScreen] frame].size.width;
|
||||
[tabBarControl setStyleNamed:@"Yosemite"];
|
||||
[tabBarControl setCellMinWidth:120];
|
||||
[tabBarControl setCellMaxWidth:screenWidth];
|
||||
[tabBarControl setCellOptimumWidth:screenWidth];
|
||||
} else {
|
||||
[tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]];
|
||||
[tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]];
|
||||
[tabBarControl setCellOptimumWidth:
|
||||
[ud integerForKey:MMTabOptimumWidthKey]];
|
||||
#endif
|
||||
}
|
||||
|
||||
[tabBarControl setShowAddTabButton:[ud boolForKey:MMShowAddTabButtonKey]];
|
||||
[[tabBarControl addTabButton] setTarget:self];
|
||||
|
||||
@@ -80,15 +80,6 @@
|
||||
#define FUOPT_BGCOLOR_HLGROUP 0x004
|
||||
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10
|
||||
# define TABBAR_STYLE_UNIFIED @"Yosemite"
|
||||
# define TABBAR_STYLE_METAL @"Yosemite"
|
||||
#else
|
||||
# define TABBAR_STYLE_UNIFIED @"Unified"
|
||||
# define TABBAR_STYLE_METAL @"Metal"
|
||||
#endif
|
||||
|
||||
|
||||
@interface MMWindowController (Private)
|
||||
- (NSSize)contentSize;
|
||||
- (void)resizeWindowToFitContentSize:(NSSize)contentSize
|
||||
@@ -106,6 +97,8 @@
|
||||
- (void)applicationDidChangeScreenParameters:(NSNotification *)notification;
|
||||
- (void)enterNativeFullScreen;
|
||||
- (void)processAfterWindowPresentedQueue;
|
||||
+ (NSString *)tabBarStyleForUnified;
|
||||
+ (NSString *)tabBarStyleForMetal;
|
||||
@end
|
||||
|
||||
|
||||
@@ -1187,7 +1180,8 @@
|
||||
[[window animator] setAlphaValue:0];
|
||||
} completionHandler:^{
|
||||
[window setStyleMask:([window styleMask] | NSFullScreenWindowMask)];
|
||||
[[vimView tabBarControl] setStyleNamed:TABBAR_STYLE_UNIFIED];
|
||||
NSString *tabBarStyle = [[self class] tabBarStyleForUnified];
|
||||
[[vimView tabBarControl] setStyleNamed:tabBarStyle];
|
||||
[self updateTablineSeparator];
|
||||
|
||||
// Stay dark for some time to wait for things to sync, then do the full screen operation
|
||||
@@ -1251,7 +1245,8 @@
|
||||
fullScreenEnabled = NO;
|
||||
[window setAlphaValue:1];
|
||||
[window setStyleMask:([window styleMask] & ~NSFullScreenWindowMask)];
|
||||
[[vimView tabBarControl] setStyleNamed:TABBAR_STYLE_METAL];
|
||||
NSString *tabBarStyle = [[self class] tabBarStyleForMetal];
|
||||
[[vimView tabBarControl] setStyleNamed:tabBarStyle];
|
||||
[self updateTablineSeparator];
|
||||
[window setFrame:preFullScreenFrame display:YES];
|
||||
}
|
||||
@@ -1281,7 +1276,8 @@
|
||||
[[window animator] setAlphaValue:0];
|
||||
} completionHandler:^{
|
||||
[window setStyleMask:([window styleMask] & ~NSFullScreenWindowMask)];
|
||||
[[vimView tabBarControl] setStyleNamed:TABBAR_STYLE_METAL];
|
||||
NSString *tabBarStyle = [[self class] tabBarStyleForMetal];
|
||||
[[vimView tabBarControl] setStyleNamed:tabBarStyle];
|
||||
[self updateTablineSeparator];
|
||||
[window setFrame:preFullScreenFrame display:YES];
|
||||
|
||||
@@ -1328,7 +1324,8 @@
|
||||
fullScreenEnabled = YES;
|
||||
[window setAlphaValue:1];
|
||||
[window setStyleMask:([window styleMask] | NSFullScreenWindowMask)];
|
||||
[[vimView tabBarControl] setStyleNamed:TABBAR_STYLE_UNIFIED];
|
||||
NSString *tabBarStyle = [[self class] tabBarStyleForUnified];
|
||||
[[vimView tabBarControl] setStyleNamed:tabBarStyle];
|
||||
[self updateTablineSeparator];
|
||||
[self maximizeWindow:fullScreenOptions];
|
||||
}
|
||||
@@ -1691,5 +1688,16 @@
|
||||
|
||||
[afterWindowPresentedQueue release]; afterWindowPresentedQueue = nil;
|
||||
}
|
||||
|
||||
+ (NSString *)tabBarStyleForUnified
|
||||
{
|
||||
return shouldUseYosemiteTabBarStyle() ? @"Yosemite" : @"Unified";
|
||||
}
|
||||
|
||||
+ (NSString *)tabBarStyleForMetal
|
||||
{
|
||||
return shouldUseYosemiteTabBarStyle() ? @"Yosemite" : @"Metal";
|
||||
}
|
||||
|
||||
@end // MMWindowController (Private)
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
#endif
|
||||
|
||||
// Needed for pre-10.11 SDK
|
||||
#ifndef NSAppKitVersionNumber10_10
|
||||
# define NSAppKitVersionNumber10_10 1343
|
||||
#endif
|
||||
#ifndef NSAppKitVersionNumber10_10_Max
|
||||
# define NSAppKitVersionNumber10_10_Max 1349
|
||||
#endif
|
||||
|
||||
@@ -151,3 +151,6 @@ NSView *showHiddenFilesView();
|
||||
// http://www.unicode.org/reports/tr15/
|
||||
NSString *normalizeFilename(NSString *filename);
|
||||
NSArray *normalizeFilenames(NSArray *filenames);
|
||||
|
||||
|
||||
BOOL shouldUseYosemiteTabBarStyle();
|
||||
|
||||
@@ -296,3 +296,12 @@ normalizeFilenames(NSArray *filenames)
|
||||
|
||||
return outnames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL
|
||||
shouldUseYosemiteTabBarStyle()
|
||||
{
|
||||
return floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_10;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user