X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d17efa94e68c37fb415cf530daa558692ab7c2d..a71dec776e22b9bdaa73027d67ec5c0c7d0b21df:/src/mac/carbon/app.cpp diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index bcff118fb6..2a536b339b 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -607,6 +607,16 @@ pascal static void wxMacAssertOutputHandler(OSType componentSignature, UInt32 op #endif //__WXDEBUG__ +#ifdef __WXMAC_OSX__ +extern "C" { + /* m_macEventPosted run loop source callback: */ + void macPostedEventCallback(void *unused); +} + +void macPostedEventCallback(void *unused) { + wxTheApp->ProcessPendingEvents(); } +#endif + bool wxApp::Initialize(int& argc, wxChar **argv) { // Mac-specific @@ -674,6 +684,15 @@ bool wxApp::Initialize(int& argc, wxChar **argv) wxMacCreateNotifierTable() ; +#ifdef __WXMAC_OSX__ + /* connect posted events to common-mode run loop so that wxPostEvent events + are handled even while we're in the menu or on a scrollbar */ + CFRunLoopSourceContext event_posted_context = {0}; + event_posted_context.perform = macPostedEventCallback; + m_macEventPosted = CFRunLoopSourceCreate(NULL,0,&event_posted_context); + CFRunLoopAddSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes); +#endif + UMAShowArrowCursor() ; return true; @@ -721,6 +740,14 @@ void wxApp::CleanUp() wxToolTip::RemoveToolTips() ; #endif +#ifdef __WXMAC_OSX__ + if (m_macEventPosted) + { + CFRelease(m_macEventPosted); + } + m_macEventPosted = NULL; +#endif + // One last chance for pending objects to be cleaned up wxTheApp->DeletePendingObjects(); @@ -853,10 +880,13 @@ bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) wxApp::wxApp() { - m_printMode = wxPRINT_WINDOWS; + m_printMode = wxPRINT_WINDOWS; - m_macCurrentEvent = NULL ; - m_macCurrentEventHandlerCallRef = NULL ; + m_macCurrentEvent = NULL ; + m_macCurrentEventHandlerCallRef = NULL ; +#ifdef __WXMAC_OSX__ + m_macEventPosted = NULL ; +#endif } int wxApp::MainLoop() @@ -913,6 +943,12 @@ void wxApp::OnIdle(wxIdleEvent& event) void wxApp::WakeUpIdle() { +#ifdef __WXMAC_OSX__ + if (m_macEventPosted) + { + CFRunLoopSourceSignal(m_macEventPosted); + } +#endif wxMacWakeUp() ; } @@ -1184,6 +1220,9 @@ int wxMacKeyCodeToModifier(wxKeyCode key) #ifndef __DARWIN__ bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below { + wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key != + WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons")); + //if OS X > 10.2 (i.e. 10.2.x) //a known apple bug prevents the system from determining led //states with GetKeys... can only determine caps lock led