fix Mac build with Xcode 8
Small issues in GHOST
- use NSApplicationDelegate protocol for our app delegate
- make sure NSApp is initialized before using
(cherry picked from commit df7be04ca6
)
This commit is contained in:
@@ -285,7 +285,7 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
|
||||
* CocoaAppDelegate
|
||||
* ObjC object to capture applicationShouldTerminate, and send quit event
|
||||
**/
|
||||
@interface CocoaAppDelegate : NSObject <NSFileManagerDelegate> {
|
||||
@interface CocoaAppDelegate : NSObject <NSApplicationDelegate> {
|
||||
GHOST_SystemCocoa *systemCocoa;
|
||||
}
|
||||
- (void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa;
|
||||
@@ -412,8 +412,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
||||
}*/
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
if (NSApp == nil) {
|
||||
[NSApplication sharedApplication];
|
||||
[NSApplication sharedApplication]; // initializes NSApp
|
||||
|
||||
if ([NSApp mainMenu] == nil) {
|
||||
NSMenu *mainMenubar = [[NSMenu alloc] init];
|
||||
@@ -470,7 +469,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
[windowMenu release];
|
||||
}
|
||||
}
|
||||
|
||||
if ([NSApp delegate] == nil) {
|
||||
CocoaAppDelegate *appDelegate = [[CocoaAppDelegate alloc] init];
|
||||
[appDelegate setSystemCocoa:this];
|
||||
|
Reference in New Issue
Block a user