- if ( s_lastMouseDown == 0 )
- ev->modifiers |= btnState ;
-
- wxWindow* win = wxFindWinFromMacWindow( window ) ;
+ // 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;
+
+ wxTopLevelWindowMac* win = wxFindWinFromMacWindow( window ) ;