From 53e2a8297d317d8c74a20c4f5c29bc989ec8ba83 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 3 Dec 2019 09:45:05 +0000 Subject: [PATCH] Fix STARTUP_WINDOW=0 on modern macOS git-svn-id: https://svn.eduke32.com/eduke32@8351 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/sdlayer.cpp # source/build/src/startosx.editor.mm # source/platform/macos/osxbits.h # source/platform/macos/startosx.game.mm --- source/platform/macos/osxbits.h | 3 +++ source/platform/macos/osxbits.mm | 14 ++++++++++++++ source/platform/macos/startosx.game.mm | 9 +-------- 3 files changed, 18 insertions(+), 8 deletions(-) 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];