From 66a9e55f3b1e94ba69e75508e8a7c6bdb0ea7151 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 3 Jan 2019 17:49:20 +0100 Subject: [PATCH] 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 --- src/osx/cocoa/utils.mm | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index d41809fd1a..0efbf083ab 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -68,6 +68,7 @@ void wxBell() - (void)applicationDidFinishLaunching:(NSNotification *)notification { + [NSApp stop:nil]; wxTheApp->OSXOnDidFinishLaunching(); } @@ -325,7 +326,6 @@ void wxBell() // here we subclass NSApplication, for the purpose of being able to override sendEvent. @interface wxNSApplication : NSApplication { - BOOL firstPass; } - (id)init; @@ -340,7 +340,7 @@ void wxBell() { if ( self = [super init] ) { - firstPass = YES; + // further init } return self; } @@ -370,14 +370,7 @@ void wxBell() if ([anEvent type] == NSKeyUp && ([anEvent modifierFlags] & NSCommandKeyMask)) [[self keyWindow] sendEvent:anEvent]; else - [super sendEvent:anEvent]; - - if ( firstPass ) - { - [NSApp stop:nil]; - firstPass = NO; - return; - } + [super sendEvent:anEvent]; } @end @@ -416,12 +409,6 @@ bool wxApp::DoInitGui() appcontroller = OSXCreateAppController(); [[NSApplication sharedApplication] setDelegate:(id )appcontroller]; [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];