From 35ec8c519fdc7b74061b38f446384e63e3e2d010 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 27 Apr 2019 19:07:57 +0200 Subject: [PATCH] only execute app-startup behaviour if we are not a plug-in --- src/osx/cocoa/utils.mm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 8010c2038a..de24c5484e 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -427,23 +427,26 @@ bool wxApp::CallOnInit() m_onInitResult = false; m_inited = false; - // Feed the upcoming event loop with a dummy event. Without this, - // [NSApp run] below wouldn't return, as we expect it to, if the - // application was launched without being activated and would block - // until the dock icon was clicked - delaying OnInit() call too. - NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined + if ( !sm_isEmbedded ) + { + // Feed the upcoming event loop with a dummy event. Without this, + // [NSApp run] below wouldn't return, as we expect it to, if the + // application was launched without being activated and would block + // until the dock icon was clicked - delaying OnInit() call too. + NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined location:NSMakePoint(0.0, 0.0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]; - [NSApp postEvent:event atStart:FALSE]; - [NSApp run]; + [NSApp postEvent:event atStart:FALSE]; + [NSApp run]; + } m_onInitResult = OnInit(); m_inited = true; - if ( m_onInitResult ) + if ( !sm_isEmbedded && m_onInitResult ) { if ( m_openFiles.GetCount() > 0 ) MacOpenFiles(m_openFiles);