diff --git a/vcl/inc/osx/vclnsapp.h b/vcl/inc/osx/vclnsapp.h index 38ad251e8bf2..541b509946a1 100644 --- a/vcl/inc/osx/vclnsapp.h +++ b/vcl/inc/osx/vclnsapp.h @@ -38,6 +38,7 @@ class AquaSalFrame; @interface VCL_NSApplication : NSApplication { } +-(void)applicationDidFinishLaunching:(NSNotification*)pNotification; -(void)sendEvent:(NSEvent*)pEvent; -(void)sendSuperEvent:(NSEvent*)pEvent; -(NSMenu*)applicationDockMenu:(NSApplication *)sender; diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index fcec7b6a5c92..f0e6b3459a52 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -194,37 +194,19 @@ sal_Bool ImplSVMainHook( int * pnInit ) bNoSVMain = false; initNSApp(); - NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined - location: NSZeroPoint - modifierFlags: 0 - timestamp: 0 - windowNumber: 0 - context: nil - subtype: AquaSalInstance::AppExecuteSVMain - data1: 0 - data2: 0 ]; - if( pEvent ) - { - [NSApp postEvent: pEvent atStart: NO]; - - OUString aExeURL, aExe; - osl_getExecutableFile( &aExeURL.pData ); - osl_getSystemPathFromFileURL( aExeURL.pData, &aExe.pData ); - OString aByteExe( OUStringToOString( aExe, osl_getThreadTextEncoding() ) ); + OUString aExeURL, aExe; + osl_getExecutableFile( &aExeURL.pData ); + osl_getSystemPathFromFileURL( aExeURL.pData, &aExe.pData ); + OString aByteExe( OUStringToOString( aExe, osl_getThreadTextEncoding() ) ); #ifdef DEBUG - aByteExe += OString ( " NSAccessibilityDebugLogLevel 1" ); - const char* pArgv[] = { aByteExe.getStr(), NULL }; - NSApplicationMain( 3, pArgv ); + aByteExe += OString ( " NSAccessibilityDebugLogLevel 1" ); + const char* pArgv[] = { aByteExe.getStr(), NULL }; + NSApplicationMain( 3, pArgv ); #else - const char* pArgv[] = { aByteExe.getStr(), NULL }; - NSApplicationMain( 1, pArgv ); + const char* pArgv[] = { aByteExe.getStr(), NULL }; + NSApplicationMain( 1, pArgv ); #endif - } - else - { - OSL_FAIL( "NSApplication initialization could not be done" ); - } return TRUE; // indicate that ImplSVMainHook is implemented } diff --git a/vcl/osx/vclnsapp.mm b/vcl/osx/vclnsapp.mm index bd85aa760e00..531125a5efc2 100644 --- a/vcl/osx/vclnsapp.mm +++ b/vcl/osx/vclnsapp.mm @@ -57,6 +57,24 @@ // desktop/macosx/Info.plist has the value VCL_NSApplication. @implementation VCL_NSApplication + +-(void)applicationDidFinishLaunching:(NSNotification*)pNotification +{ + (void)pNotification; + + NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined + location: NSZeroPoint + modifierFlags: 0 + timestamp: 0 + windowNumber: 0 + context: nil + subtype: AquaSalInstance::AppExecuteSVMain + data1: 0 + data2: 0 ]; + if( pEvent ) + [NSApp postEvent: pEvent atStart: NO]; +} + -(void)sendEvent:(NSEvent*)pEvent { NSEventType eType = [pEvent type];