Use constant values instead of MAC_OS_X_VERSION_ - might not be available on earlier OSX versions/xcode

This commit is contained in:
neville 2018-08-30 16:29:58 +02:00
parent 1222192afb
commit f35b578c42
2 changed files with 13 additions and 9 deletions

View File

@ -80,7 +80,7 @@ static enum ui_msg_window_response ui_msg_window_cocoa_dialog(ui_msg_window_stat
break;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
[alert beginSheetModalForWindow:(BRIDGE NSWindow *)ui_companion_driver_get_main_window()
completionHandler:^(NSModalResponse returnCode) {
[[NSApplication sharedApplication] stopModalWithCode:returnCode];

View File

@ -42,6 +42,10 @@
#import <MetalKit/MetalKit.h>
#endif
#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
@interface WindowListener : NSResponder<NSWindowDelegate>
@end
@ -74,7 +78,7 @@ id<ApplePlatform> apple_platform;
apple_view_type_t _vt;
NSView* _renderView;
id _sleepActivity;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
WindowListener *_listener;
#endif
}
@ -255,7 +259,7 @@ static char** waiting_argv;
{
unsigned i;
apple_platform = self;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
self.window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
#else
SEL selector = NSSelectorFromString(BOXSTRING("setCollectionBehavior:"));
@ -268,12 +272,12 @@ static char** waiting_argv;
}
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
_listener = [WindowListener new];
#endif
[self.window setAcceptsMouseMovedEvents: YES];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
[self.window setNextResponder:_listener];
self.window.delegate = _listener;
#endif
@ -294,7 +298,7 @@ static char** waiting_argv;
waiting_argc = 0;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
[self.window makeMainWindow];
[self.window makeKeyWindow];
#endif
@ -315,7 +319,7 @@ static char** waiting_argv;
_renderView.wantsLayer = NO;
_renderView.layer = nil;
[_renderView removeFromSuperview];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
self.window.contentView = nil;
#endif
_renderView = nil;
@ -348,7 +352,7 @@ static char** waiting_argv;
_renderView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
_renderView.frame = self.window.contentView.bounds;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
self.window.contentView = _renderView;
[self.window.contentView setNextResponder:_listener];
#else
@ -399,7 +403,7 @@ static char** waiting_argv;
- (bool)setDisableDisplaySleep:(bool)disable
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
if (disable && _sleepActivity == nil)
{
_sleepActivity = [NSProcessInfo.processInfo beginActivityWithOptions:NSActivityIdleDisplaySleepDisabled reason:@"disable screen saver"];