]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/app.cpp
The code in wxMac's listbox was too ambitious in filtering
[wxWidgets.git] / src / mac / carbon / app.cpp
index eafd5536c67690d9eeaba2de9e3c3ce9d2416567..b27475c3f1b1006ba86adc35a53e8c03102551e7 100644 (file)
@@ -661,24 +661,23 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
 
     wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
 
-#ifdef __WXMAC__
-  argc = 0 ; // currently we don't support files as parameters
+#ifndef __DARWIN__
+    argc = 0 ; // currently we don't support files as parameters
 #endif
+    // we could try to get the open apple events here to adjust argc and argv better
 
-  wxTheApp->argc = argc;
-  wxTheApp->argv = argv;
-
-  // GUI-specific initialization, such as creating an app context.
-  wxEntryInitGui();
+    wxTheApp->argc = argc;
+    wxTheApp->argv = argv;
 
-  // we could try to get the open apple events here to adjust argc and argv better
+    // GUI-specific initialization, such as creating an app context.
+    wxEntryInitGui();
 
 
-  // Here frames insert themselves automatically
-  // into wxTopLevelWindows by getting created
-  // in OnInit().
+    // Here frames insert themselves automatically
+    // into wxTopLevelWindows by getting created
+    // in OnInit().
 
-  int retValue = 0;
+    int retValue = 0;
 
     if ( wxTheApp->OnInit() )
     {
@@ -1014,11 +1013,11 @@ void wxApp::MacDoOneEvent()
 {
   EventRecord event ;
 
-    long sleepTime = 1 ; // GetCaretTime() / 4 ;
+    long sleepTime = 1; // GetCaretTime() / 4 ;
 
-    if (WaitNextEvent(everyEvent, &event,sleepTime, s_macCursorRgn))
+    if (WaitNextEvent(everyEvent, &event, sleepTime, s_macCursorRgn))
     {
-    MacHandleOneEvent( &event );
+        MacHandleOneEvent( &event );
     }
     else
     {
@@ -1034,7 +1033,7 @@ void wxApp::MacDoOneEvent()
 
     // repeaters
 
-  DeletePendingObjects() ;
+    DeletePendingObjects() ;
     wxMacProcessNotifierAndPendingEvents() ;
 }
 
@@ -1692,9 +1691,20 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
                         break ;
                     default:
                         {
-                            if ( s_lastMouseDown == 0 )
-                                ev->modifiers |= btnState ;
-
+                            // if ( s_lastMouseDown == 0 )
+                            //     ev->modifiers |= btnState ;
+                                
+                            // Calling GetNextEvent with a zero event mask will always
+                            // pass back a null event. However, it fills the EventRecord
+                            // with the state of the modifier keys. This is needed since
+                            // the modifier state returned by WaitForNextEvent often is
+                            // wrong mouse move events. The attempt above to correct this
+                            // didn't always work (under OS X at least).
+            
+                            EventRecord tmp;
+                            ::GetNextEvent(0, &tmp);
+                            ev->modifiers = tmp.modifiers;
+                            
                             wxWindow* win = wxFindWinFromMacWindow( window ) ;
                             if ( win )
                                 win->MacMouseMoved( ev , windowPart ) ;