X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/175e9d71cde772ef56aa5d022392f39e63040d32..6178debcd342963974dbdce6ac2ddb2fbe89e42a:/src/osx/cocoa/utils.mm diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index d14be5cd19..e8d122f171 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -45,35 +45,6 @@ void wxBell() NSBeep(); } -// ---------------------------------------------------------------------------- -// Common Event Support -// ---------------------------------------------------------------------------- - -void wxMacWakeUp() -{ - // ensure that we have an auto release pool in place because the event will - // be autoreleased from NSEvent:otherEventWithType and we might not have a - // global pool during startup or shutdown and we actually never have it if - // we're called from another thread - // - // FIXME: we can't use wxMacAutoreleasePool here because it's in core and - // we're in base - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - NSEvent* wakeupEvent = [NSEvent otherEventWithType:NSApplicationDefined - location:NSZeroPoint - modifierFlags:NSAnyEventMask - timestamp:0 - windowNumber:0 - context:nil - subtype:0 - data1:0 - data2:0]; - [NSApp postEvent:wakeupEvent atStart:NO]; - - [pool release]; -} - #endif // wxUSE_BASE #if wxUSE_GUI @@ -99,7 +70,6 @@ void wxMacWakeUp() - (void)applicationWillFinishLaunching:(NSApplication *)application { wxUnusedVar(application); - wxTheApp->OnInit(); } - (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename; @@ -227,14 +197,6 @@ void wxMacWakeUp() } @end -bool wxApp::CallOnInit() -{ - if ( sm_isEmbedded ) - return OnInit(); - - return true; -} - bool wxApp::DoInitGui() { wxMacAutoreleasePool pool; @@ -243,11 +205,17 @@ bool wxApp::DoInitGui() if (!sm_isEmbedded) { wxNSAppController* controller = [[wxNSAppController alloc] init]; - [[NSApplication sharedApplication] setDelegate:controller]; + [NSApp setDelegate:controller]; NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; [appleEventManager setEventHandler:controller andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; + + // 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 } return true; }