diff --git a/source/platform/macos/osxbits.h b/source/platform/macos/osxbits.h index 8a35e14df..639e48869 100644 --- a/source/platform/macos/osxbits.h +++ b/source/platform/macos/osxbits.h @@ -2,6 +2,9 @@ #define osxbits_h_ #include +void osx_preopen(void); +void osx_postopen(void); + int osx_msgbox(const char *name, const char *msg); int osx_ynbox(const char *name, const char *msg); diff --git a/source/platform/macos/osxbits.mm b/source/platform/macos/osxbits.mm index 613d6b554..16f04ec01 100644 --- a/source/platform/macos/osxbits.mm +++ b/source/platform/macos/osxbits.mm @@ -23,6 +23,20 @@ # define MAC_OS_VERSION_10_3 1030 #endif +id nsapp; + +void osx_preopen(void) +{ + // fix for "ld: absolute address to symbol _NSApp in a different linkage unit not supported" + // (OS X 10.6) when building for PPC + nsapp = [NSApplication sharedApplication]; +} + +void osx_postopen(void) +{ + [nsapp finishLaunching]; +} + int osx_msgbox(const char *name, const char *msg) { NSString *mmsg = [[NSString alloc] initWithUTF8String:msg]; diff --git a/source/platform/macos/startosx.game.mm b/source/platform/macos/startosx.game.mm index 731a4634f..b88b589e8 100644 --- a/source/platform/macos/startosx.game.mm +++ b/source/platform/macos/startosx.game.mm @@ -11,6 +11,7 @@ #include "compat.h" #include "baselayer.h" #include "grpscan.h" +#include "osxbits.h" #import "GrpFile.game.h" #import "GameListSource.game.h" @@ -105,8 +106,6 @@ static NSPopUpButton * makeComboBox(void) return comboBox; } -static id nsapp; - /* setAppleMenu disappeared from the headers in 10.4 */ @interface NSApplication(NSAppleMenu) - (void)setAppleMenu:(NSMenu *)menu; @@ -599,10 +598,6 @@ static StartupWindow *startwin = nil; int startwin_open(void) { - // fix for "ld: absolute address to symbol _NSApp in a different linkage unit not supported" - // (OS X 10.6) when building for PPC - nsapp = [NSApplication sharedApplication]; - if (startwin != nil) return 1; startwin = [[StartupWindow alloc] init]; @@ -610,8 +605,6 @@ int startwin_open(void) [startwin setupMessagesMode]; - [nsapp finishLaunching]; - [startwin center]; [startwin makeKeyAndOrderFront:nil];