]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/app.cpp
rtti api mods added
[wxWidgets.git] / src / mac / app.cpp
index 04f3eee3b5bdde44b4d312b43e340a6b35eede28..8529b9e59ba7f985f4c5e7a27d456639646504e3 100644 (file)
@@ -322,12 +322,12 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
                           &menuRef);
 #endif // 0
 
-        wxMenuEvent event(GetEventKind(event) == kEventMenuOpening
+        wxMenuEvent wxevent(GetEventKind(event) == kEventMenuOpening
                         ? wxEVT_MENU_OPEN
                         : wxEVT_MENU_CLOSE);
-        event.SetEventObject(win);
+        wxevent.SetEventObject(win);
 
-        (void)win->GetEventHandler()->ProcessEvent(event);
+        (void)win->GetEventHandler()->ProcessEvent(wxevent);
     }
 
     return eventNotHandledErr;
@@ -970,14 +970,11 @@ pascal OSStatus wxMacApplicationEventHandler( EventHandlerCallRef handler , Even
 
 wxApp::wxApp()
 {
-  m_topWindow = NULL;
-  wxTheApp = this;
-
-  argc = 0;
-  argv = NULL;
-
   m_printMode = wxPRINT_WINDOWS;
   m_auto3D = TRUE;
+
+  m_macCurrentEvent = NULL ;
+  m_macCurrentEventHandlerCallRef = NULL ;
 }
 
 bool wxApp::Initialized()
@@ -1025,33 +1022,13 @@ void wxApp::Dispatch()
 
 void wxApp::OnIdle(wxIdleEvent& event)
 {
-    // Avoid recursion (via ProcessEvent default case)
-    if ( s_inOnIdle )
-        return;
-
-
-  s_inOnIdle = TRUE;
-
-  // 'Garbage' collection of windows deleted with Close().
-  DeletePendingObjects();
-
-  // flush the logged messages if any
-  wxLog *pLog = wxLog::GetActiveTarget();
-  if ( pLog != NULL && pLog->HasPendingMessages() )
-    pLog->Flush();
-
-  // Send OnIdle events to all windows
-  bool needMore = SendIdleEvents();
-
-  if (needMore)
-    event.RequestMore(TRUE);
-
+    wxAppBase::OnIdle(event);
+    
     // If they are pending events, we must process them: pending events are
     // either events to the threads other than main or events posted with
     // wxPostEvent() functions
     wxMacProcessNotifierAndPendingEvents();
 
-  s_inOnIdle = FALSE;
   if(!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar())
     wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar();
 }
@@ -1384,6 +1361,12 @@ void wxApp::MacHandleModifierEvents( WXEVENTREF evr )
             event.SetEventType( ( ev->modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
             focus->GetEventHandler()->ProcessEvent( event ) ;
         }
+        if ( ev->modifiers ^ s_lastModifiers ) & cmdKey )
+        {
+            event.m_keyCode = WXK_COMMAND ;
+            event.SetEventType( ( ev->modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+            focus->GetEventHandler()->ProcessEvent( event ) ;
+        }
         s_lastModifiers = ev->modifiers ;
     }
 }
@@ -1718,6 +1701,8 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
 
         if ( MacSendKeyDownEvent( focus , ev->message , ev->modifiers , ev->when , ev->where.h , ev->where.v ) == false )
         {
+#if 0
+            // we must handle control keys the other way round, otherwise text content is updated too late
             // has not been handled -> perform default
             wxControl* control = wxDynamicCast( focus , wxControl ) ;
             if ( control &&  control->GetMacControl() != NULL )
@@ -1728,6 +1713,7 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
                 keycode = short(ev->message & keyCodeMask) >> 8 ;
                 ::HandleControlKey( (ControlHandle) control->GetMacControl() , keycode , keychar , ev->modifiers ) ;
             }
+#endif
         }
     }
 }