]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/utils.mm
Set focus to generic wxDataViewCtrl when clicking with any mouse button, not just...
[wxWidgets.git] / src / osx / cocoa / utils.mm
index d14be5cd19be785938e80df34d80e9332b47e937..fb325bd19c89048cf701abdea4a80f33937273c5 100644 (file)
@@ -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;
 }
@@ -258,7 +226,7 @@ void wxApp::DoCleanUp()
 
 void wxClientDisplayRect(int *x, int *y, int *width, int *height)
 {
-    NSRect displayRect = [[NSScreen mainScreen] visibleFrame];
+    NSRect displayRect = [wxOSXGetMenuScreen() visibleFrame];
     wxRect r = wxFromNSRect( NULL, displayRect );
     if ( x )
         *x = r.x;