Commit 508ce668 authored by David Fuhrmann's avatar 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.
parent 0f1e36e4
......@@ -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
......
......@@ -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 */
......
......@@ -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];
......
......@@ -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];
......
......@@ -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"]];
......
......@@ -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];
......
......@@ -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];
......
......@@ -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-"];
}
......
......@@ -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];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment