Add conditionals to maintain backwards compatibility with OSX 10.5

This commit is contained in:
twinaphex 2018-08-30 16:22:02 +02:00
parent d7899c51aa
commit 1222192afb

View File

@ -42,6 +42,7 @@
#import <MetalKit/MetalKit.h>
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
@interface WindowListener : NSResponder<NSWindowDelegate>
@end
@ -59,6 +60,7 @@
{}
@end
#endif
id<ApplePlatform> apple_platform;
@ -72,7 +74,9 @@ 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
WindowListener *_listener;
#endif
}
@property (nonatomic, retain) NSWindow IBOutlet* window;
@ -264,11 +268,15 @@ static char** waiting_argv;
}
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
_listener = [WindowListener new];
#endif
[self.window setAcceptsMouseMovedEvents: YES];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
[self.window setNextResponder:_listener];
self.window.delegate = _listener;
#endif
[[self.window contentView] setAutoresizesSubviews:YES];
@ -286,8 +294,10 @@ static char** waiting_argv;
waiting_argc = 0;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
[self.window makeMainWindow];
[self.window makeKeyWindow];
#endif
[self performSelectorOnMainThread:@selector(rarch_main) withObject:nil waitUntilDone:NO];
}
@ -305,7 +315,9 @@ 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
self.window.contentView = nil;
#endif
_renderView = nil;
}
@ -336,8 +348,13 @@ 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
self.window.contentView = _renderView;
[self.window.contentView setNextResponder:_listener];
#else
[self.window.contentView addSubview:_renderView];
[self.window makeFirstResponder:_renderView];
#endif
}
- (apple_view_type_t)viewType {