vlc | branch: master | David Fuhrmann <[email protected]> | Sat Jun 10 21:15:01 2017 +0200| [508ce668df0c53c35d671c0e13395ce11b041803] | committer: David Fuhrmann
macosx: Change OS constants to always include all higher OS versions This fixes several cases where OSX_SIERRA was forgotten. This seems to be a recurring problem and there is no need to limit the constants to a specific macOS version. Usually, a feature introduced in one version as also available on the subsequent ones. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=508ce668df0c53c35d671c0e13395ce11b041803 --- modules/gui/macosx/CompatibilityFixes.h | 14 ++++++-------- modules/gui/macosx/NSScreen+VLCAdditions.m | 2 +- modules/gui/macosx/VLCAboutWindowController.m | 2 +- modules/gui/macosx/VLCFSPanelController.m | 2 +- modules/gui/macosx/VLCHelpWindowController.m | 2 +- modules/gui/macosx/VLCMainWindowTitleView.m | 12 ++++++------ modules/gui/macosx/VLCStatusBarIcon.m | 6 +++--- modules/gui/macosx/VLCStringUtility.m | 2 +- modules/gui/macosx/Windows.m | 4 ++-- 9 files changed, 22 insertions(+), 24 deletions(-) diff --git a/modules/gui/macosx/CompatibilityFixes.h b/modules/gui/macosx/CompatibilityFixes.h index 0b2f933865..f98679c18d 100644 --- a/modules/gui/macosx/CompatibilityFixes.h +++ b/modules/gui/macosx/CompatibilityFixes.h @@ -25,14 +25,12 @@ #pragma mark - #pragma OS detection code -#define OSX_LION (NSAppKitVersionNumber < 1162 && NSAppKitVersionNumber >= 1115.2) -#define OSX_MOUNTAIN_LION (NSAppKitVersionNumber < 1244 && NSAppKitVersionNumber >= 1162) -#define OSX_MAVERICKS (NSAppKitVersionNumber < 1334 && NSAppKitVersionNumber >= 1244) -#define OSX_YOSEMITE (NSAppKitVersionNumber < 1404 && NSAppKitVersionNumber >= 1334) -#define OSX_EL_CAPITAN (NSAppKitVersionNumber >= 1404 && NSAppKitVersionNumber < 1485) -#define OSX_SIERRA (NSAppKitVersionNumber >= 1485) - -#define OSX_YOSEMITE_OR_HIGHER (NSAppKitVersionNumber >= 1334) +#define OSX_LION_AND_HIGHER (NSAppKitVersionNumber >= 1115.2) +#define OSX_MOUNTAIN_LION_AND_HIGHER (NSAppKitVersionNumber >= 1162) +#define OSX_MAVERICKS_AND_HIGHER (NSAppKitVersionNumber >= 1244) +#define OSX_YOSEMITE_AND_HIGHER (NSAppKitVersionNumber >= 1334) +#define OSX_EL_CAPITAN_AND_HIGHER (NSAppKitVersionNumber >= 1404) +#define OSX_SIERRA_AND_HIGHER (NSAppKitVersionNumber >= 1485) // Sierra only APIs #ifndef MAC_OS_X_VERSION_10_12 diff --git a/modules/gui/macosx/NSScreen+VLCAdditions.m b/modules/gui/macosx/NSScreen+VLCAdditions.m index 5074d280c6..5c4aeca1a3 100644 --- a/modules/gui/macosx/NSScreen+VLCAdditions.m +++ b/modules/gui/macosx/NSScreen+VLCAdditions.m @@ -37,7 +37,7 @@ static bool b_old_spaces_style = YES; /* init our fake object attribute */ blackoutWindows = [[NSMutableArray alloc] initWithCapacity:1]; - if (!OSX_LION && !OSX_MOUNTAIN_LION) { + if (OSX_MAVERICKS_AND_HIGHER) { NSUserDefaults *userDefaults = [[NSUserDefaults alloc] init]; [userDefaults addSuiteNamed:@"com.apple.spaces"]; /* this is system settings -> mission control -> monitors using different spaces */ diff --git a/modules/gui/macosx/VLCAboutWindowController.m b/modules/gui/macosx/VLCAboutWindowController.m index 27e3fad8e3..edfea03273 100644 --- a/modules/gui/macosx/VLCAboutWindowController.m +++ b/modules/gui/macosx/VLCAboutWindowController.m @@ -141,7 +141,7 @@ "\"http://www.videolan.org/contribute/\"><span style=\" text-decoration: " "underline; color:#0057ae;\">Help and join us!</span></a>")); - NSString *fontfamily = (OSX_YOSEMITE) ? @"Helvetica Neue" : @"Lucida Grande"; + NSString *fontfamily = (OSX_YOSEMITE_AND_HIGHER) ? @"Helvetica Neue" : @"Lucida Grande"; NSString *joinUsWithStyle = [NSString stringWithFormat:@"<div style=\"text-align:left;font-family: -apple-system, %@;\">%@</div>", fontfamily, joinus]; NSAttributedString *joinus_readytorender = [[NSAttributedString alloc] initWithHTML:[joinUsWithStyle dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES] options:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:NSUTF8StringEncoding] forKey:NSCharacterEncodingDocumentOption] documentAttributes:NULL]; diff --git a/modules/gui/macosx/VLCFSPanelController.m b/modules/gui/macosx/VLCFSPanelController.m index 4400a113eb..5ea3842218 100644 --- a/modules/gui/macosx/VLCFSPanelController.m +++ b/modules/gui/macosx/VLCFSPanelController.m @@ -82,7 +82,7 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect #ifdef MAC_OS_X_VERSION_10_10 /* Inject correct background view depending on OS support */ - if (OSX_YOSEMITE_OR_HIGHER) { + if (OSX_YOSEMITE_AND_HIGHER) { [self injectVisualEffectView]; } else { [self injectBackgroundView]; diff --git a/modules/gui/macosx/VLCHelpWindowController.m b/modules/gui/macosx/VLCHelpWindowController.m index 43d7ad6a3a..ed973de85e 100644 --- a/modules/gui/macosx/VLCHelpWindowController.m +++ b/modules/gui/macosx/VLCHelpWindowController.m @@ -60,7 +60,7 @@ { NSString *htmlWithStyle = [NSString stringWithFormat:@"<style>body { font-family: -apple-system, %@; }</style>%@", - ((OSX_YOSEMITE) ? @"Helvetica Neue" : @"Lucida Grande"), _NS(I_LONGHELP)]; + ((OSX_YOSEMITE_AND_HIGHER) ? @"Helvetica Neue" : @"Lucida Grande"), _NS(I_LONGHELP)]; [[helpWebView mainFrame] loadHTMLString:htmlWithStyle baseURL:[NSURL URLWithString:@"http://videolan.org"]]; diff --git a/modules/gui/macosx/VLCMainWindowTitleView.m b/modules/gui/macosx/VLCMainWindowTitleView.m index e59edff64a..0f347d21e5 100644 --- a/modules/gui/macosx/VLCMainWindowTitleView.m +++ b/modules/gui/macosx/VLCMainWindowTitleView.m @@ -89,7 +89,7 @@ { b_nativeFullscreenMode = var_InheritBool(getIntf(), "macosx-nativefullscreenmode"); - if (!b_nativeFullscreenMode || OSX_YOSEMITE || OSX_EL_CAPITAN || OSX_SIERRA) { + if (!b_nativeFullscreenMode || OSX_YOSEMITE_AND_HIGHER) { [_fullscreenButton setHidden: YES]; } @@ -123,9 +123,9 @@ - (NSImage *)getButtonImage:(NSString *)o_id { NSString *o_name = @""; - if (OSX_YOSEMITE || OSX_EL_CAPITAN) { + if (OSX_YOSEMITE_AND_HIGHER) { o_name = @"yosemite-"; - } else { // OSX_LION, OSX_MOUNTAIN_LION, OSX_MAVERICKS + } else { // OSX_LION_AND_HIGHER, OSX_MOUNTAIN_LION_AND_HIGHER, OSX_MAVERICKS_AND_HIGHER o_name = @"lion-"; } @@ -151,7 +151,7 @@ _greenOnClickImage = [self getButtonImage:@"window-zoom-on"]; // these files are only available in the yosemite variant - if (OSX_YOSEMITE || OSX_EL_CAPITAN) { + if (OSX_YOSEMITE_AND_HIGHER) { _fullscreenImage = [self getButtonImage:@"window-fullscreen"]; _fullscreenHoverImage = [self getButtonImage:@"window-fullscreen-over"]; _fullscreenOnClickImage = [self getButtonImage:@"window-fullscreen-on"]; @@ -186,7 +186,7 @@ { // default image for old version, or if native fullscreen is // disabled on yosemite, or if alt key is pressed - if (!(OSX_YOSEMITE || OSX_EL_CAPITAN) || !b_nativeFullscreenMode || b_alt_pressed) { + if (!OSX_YOSEMITE_AND_HIGHER || !b_nativeFullscreenMode || b_alt_pressed) { if (b_mouse_over) { [_greenButton setImage: _greenHoverImage]; @@ -219,7 +219,7 @@ else if (sender == _yellowButton) [[self window] miniaturize: sender]; else if (sender == _greenButton) { - if ((OSX_YOSEMITE || OSX_EL_CAPITAN) && b_nativeFullscreenMode && !b_alt_pressed) { + if (OSX_YOSEMITE_AND_HIGHER && b_nativeFullscreenMode && !b_alt_pressed) { [[self window] toggleFullScreen:self]; } else { [[self window] performZoom: sender]; diff --git a/modules/gui/macosx/VLCStatusBarIcon.m b/modules/gui/macosx/VLCStatusBarIcon.m index 09f34740c0..b5aca4db59 100644 --- a/modules/gui/macosx/VLCStatusBarIcon.m +++ b/modules/gui/macosx/VLCStatusBarIcon.m @@ -175,7 +175,7 @@ // Visibility is 10.12+ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - if (OSX_SIERRA) { + if (OSX_SIERRA_AND_HIGHER) { [self.statusItem setBehavior:NSStatusItemBehaviorRemovalAllowed]; [self.statusItem setAutosaveName:@"statusBarItem"]; [self.statusItem addObserver:self forKeyPath:NSStringFromSelector(@selector(isVisible)) @@ -183,7 +183,7 @@ } } - if (OSX_SIERRA) { + if (OSX_SIERRA_AND_HIGHER) { // Sync VLC setting with status bar visibility setting (10.12 runtime only) [self.statusItem setVisible:YES]; } @@ -195,7 +195,7 @@ return; // Lets keep alive the object in Sierra, and destroy it in older OS versions - if (OSX_SIERRA) { + if (OSX_SIERRA_AND_HIGHER) { self.statusItem.visible = NO; } else { [[NSStatusBar systemStatusBar] removeStatusItem:self.statusItem]; diff --git a/modules/gui/macosx/VLCStringUtility.m b/modules/gui/macosx/VLCStringUtility.m index 561b2e60a2..16b80ebb10 100644 --- a/modules/gui/macosx/VLCStringUtility.m +++ b/modules/gui/macosx/VLCStringUtility.m @@ -533,7 +533,7 @@ NSString *toNSStr(const char *str) { NSImage *imageFromRes(NSString *o_id) { NSString *result = @""; - if (OSX_YOSEMITE || OSX_EL_CAPITAN || OSX_SIERRA) { + if (OSX_YOSEMITE_AND_HIGHER) { result = [result stringByAppendingString:@"ys-"]; } diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m index e9b36bcbe9..98da2ba8e7 100644 --- a/modules/gui/macosx/Windows.m +++ b/modules/gui/macosx/Windows.m @@ -182,7 +182,7 @@ BOOL b_inFullscreen = [self fullscreen] || ([self respondsToSelector:@selector(inFullscreenTransition)] && [(VLCVideoWindowCommon *)self inFullscreenTransition]); - if((OSX_MAVERICKS) && b_inFullscreen && constrainedRect.size.width == screenRect.size.width + if((OSX_MAVERICKS_AND_HIGHER && !OSX_YOSEMITE_AND_HIGHER) && b_inFullscreen && constrainedRect.size.width == screenRect.size.width && constrainedRect.size.height != screenRect.size.height && fabs(screenRect.size.height - constrainedRect.size.height) <= 25.) { @@ -258,7 +258,7 @@ if (b_nativeFullscreenMode) { [self setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary]; - } else if (OSX_EL_CAPITAN || OSX_SIERRA) { + } else if (OSX_EL_CAPITAN_AND_HIGHER) { // Native fullscreen seems to be default on El Capitan, this disables it explicitely [self setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary]; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
