macOS 10.14 adaption for launch-opening files

The previous way to stop the event loop for wx-like OnInit processing was too early for 10.14, opening files during launch was not possible, see #18305
This commit is contained in:
Stefan Csomor
2019-01-03 17:49:20 +01:00
parent 142234d009
commit 66a9e55f3b

View File

@@ -68,6 +68,7 @@ void wxBell()
- (void)applicationDidFinishLaunching:(NSNotification *)notification - (void)applicationDidFinishLaunching:(NSNotification *)notification
{ {
[NSApp stop:nil];
wxTheApp->OSXOnDidFinishLaunching(); wxTheApp->OSXOnDidFinishLaunching();
} }
@@ -325,7 +326,6 @@ void wxBell()
// here we subclass NSApplication, for the purpose of being able to override sendEvent. // here we subclass NSApplication, for the purpose of being able to override sendEvent.
@interface wxNSApplication : NSApplication @interface wxNSApplication : NSApplication
{ {
BOOL firstPass;
} }
- (id)init; - (id)init;
@@ -340,7 +340,7 @@ void wxBell()
{ {
if ( self = [super init] ) if ( self = [super init] )
{ {
firstPass = YES; // further init
} }
return self; return self;
} }
@@ -371,13 +371,6 @@ void wxBell()
[[self keyWindow] sendEvent:anEvent]; [[self keyWindow] sendEvent:anEvent];
else else
[super sendEvent:anEvent]; [super sendEvent:anEvent];
if ( firstPass )
{
[NSApp stop:nil];
firstPass = NO;
return;
}
} }
@end @end
@@ -416,12 +409,6 @@ bool wxApp::DoInitGui()
appcontroller = OSXCreateAppController(); appcontroller = OSXCreateAppController();
[[NSApplication sharedApplication] setDelegate:(id <NSApplicationDelegate>)appcontroller]; [[NSApplication sharedApplication] setDelegate:(id <NSApplicationDelegate>)appcontroller];
[NSColor setIgnoresAlpha:NO]; [NSColor setIgnoresAlpha:NO];
// calling finishLaunching so early before running the loop seems to trigger some 'MenuManager compatibility' which leads
// to the duplication of menus under 10.5 and a warning under 10.6
#if 0
[NSApp finishLaunching];
#endif
} }
gNSLayoutManager = [[NSLayoutManager alloc] init]; gNSLayoutManager = [[NSLayoutManager alloc] init];