Simplify applicationDidFinishLaunching code for OSX 10.7 and up

This commit is contained in:
twinaphex 2021-01-18 00:08:21 +01:00
parent c506871208
commit 5c0aafe6e2

View File

@ -207,27 +207,22 @@ static char **waiting_argv;
unsigned i;
apple_platform = self;
[self.window setAcceptsMouseMovedEvents: YES];
#ifdef HAVE_COCOA_METAL
self.window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
#if MAC_OS_X_VERSION_10_7
self.window.collectionBehavior = NS_WINDOW_COLLECTION_BEHAVIOR_FULLSCREEN_PRIMARY;
#endif
#ifdef HAVE_COCOA_METAL
_listener = [WindowListener new];
[self.window setNextResponder:_listener];
self.window.delegate = _listener;
[[self.window contentView] setAutoresizesSubviews:YES];
#else
SEL selector = NSSelectorFromString(BOXSTRING("setCollectionBehavior:"));
SEL fsselector = NSSelectorFromString(BOXSTRING("toggleFullScreen:"));
if ([self.window respondsToSelector:selector])
{
if ([self.window respondsToSelector:fsselector])
[self.window setCollectionBehavior:NS_WINDOW_COLLECTION_BEHAVIOR_FULLSCREEN_PRIMARY];
}
[[CocoaView get] setFrame: [[self.window contentView] bounds]];
#endif
[[self.window contentView] setAutoresizesSubviews:YES];
#ifndef HAVE_COCOA_METAL
[[self.window contentView] addSubview:[CocoaView get]];
[self.window makeFirstResponder:[CocoaView get]];
#endif