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
|
* CocoaAppDelegate
|
||||||
* ObjC object to capture applicationShouldTerminate, and send quit event
|
* ObjC object to capture applicationShouldTerminate, and send quit event
|
||||||
**/
|
**/
|
||||||
@interface CocoaAppDelegate : NSObject <NSFileManagerDelegate> {
|
@interface CocoaAppDelegate : NSObject <NSApplicationDelegate> {
|
||||||
GHOST_SystemCocoa *systemCocoa;
|
GHOST_SystemCocoa *systemCocoa;
|
||||||
}
|
}
|
||||||
- (void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa;
|
- (void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa;
|
||||||
@@ -412,8 +412,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
if (NSApp == nil) {
|
[NSApplication sharedApplication]; // initializes NSApp
|
||||||
[NSApplication sharedApplication];
|
|
||||||
|
|
||||||
if ([NSApp mainMenu] == nil) {
|
if ([NSApp mainMenu] == nil) {
|
||||||
NSMenu *mainMenubar = [[NSMenu alloc] init];
|
NSMenu *mainMenubar = [[NSMenu alloc] init];
|
||||||
@@ -470,7 +469,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
|||||||
[NSApp setWindowsMenu:windowMenu];
|
[NSApp setWindowsMenu:windowMenu];
|
||||||
[windowMenu release];
|
[windowMenu release];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ([NSApp delegate] == nil) {
|
if ([NSApp delegate] == nil) {
|
||||||
CocoaAppDelegate *appDelegate = [[CocoaAppDelegate alloc] init];
|
CocoaAppDelegate *appDelegate = [[CocoaAppDelegate alloc] init];
|
||||||
[appDelegate setSystemCocoa:this];
|
[appDelegate setSystemCocoa:this];
|
||||||
|
Reference in New Issue
Block a user