Resolves: #i119006# delay Mac initial event until the app has launched
delaying the initial event prevents complaints from OSX>=10.7's "windows restore" feature to recur infinitely. Apparently OSX cleans things up for us just before we get the applicationDidFinishLaunching() callback. (cherry picked from commit 0f3712ff654c740f3593b9580f34cdfe21ac3250) Conflicts: vcl/osx/salinst.cxx Change-Id: I0f1d59f03ffe4efc7c9a73fa881151fa06af5424
This commit is contained in:
committed by
Caolán McNamara
parent
03bdbcb42a
commit
2c7528552d
@@ -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;
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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];
|
||||
|
Reference in New Issue
Block a user