X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b79aa5000fef6952836829a48f3ef060b9c10594..4de25822f373782dab54d09e1be978d94b97ca76:/src/osx/carbon/evtloop.cpp?ds=sidebyside diff --git a/src/osx/carbon/evtloop.cpp b/src/osx/carbon/evtloop.cpp index adc340a714..4a8238baa0 100644 --- a/src/osx/carbon/evtloop.cpp +++ b/src/osx/carbon/evtloop.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2006-01-12 -// RCS-ID: $Id$ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -60,7 +59,7 @@ static void DispatchAndReleaseEvent(EventRef theEvent) int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) { wxMacAutoreleasePool autoreleasepool; - + EventRef event; OSStatus status = ReceiveNextEvent(0, NULL, timeout/1000, true, &event); switch ( status ) @@ -83,13 +82,31 @@ int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) } } -void wxGUIEventLoop::DoRun() +void wxGUIEventLoop::WakeUp() +{ + OSStatus err = noErr; + wxMacCarbonEvent wakeupEvent; + wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(), + kEventAttributeNone ); + err = PostEventToQueue(GetMainEventQueue(), wakeupEvent, + kEventPriorityHigh ); +} + +void wxGUIEventLoop::OSXDoRun() { wxMacAutoreleasePool autoreleasepool; - RunApplicationEventLoop(); + + while (!m_shouldExit) + { + RunApplicationEventLoop(); + } + + // Force enclosing event loop to temporarily exit and check + // if it should be stopped. + QuitApplicationEventLoop(); } -void wxGUIEventLoop::DoStop() +void wxGUIEventLoop::OSXDoStop() { QuitApplicationEventLoop(); } @@ -117,7 +134,7 @@ wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow) // END move into a evtloop_osx.cpp -void wxModalEventLoop::DoRun() +void wxModalEventLoop::OSXDoRun() { wxWindowDisabler disabler(m_modalWindow); wxMacAutoreleasePool autoreleasepool; @@ -126,7 +143,7 @@ void wxModalEventLoop::DoRun() WindowGroupRef windowGroup = NULL; WindowGroupRef formerParentGroup = NULL; - + // make sure modal dialogs are in the right layer so that they are not covered if ( m_modalWindow != NULL ) { @@ -143,7 +160,7 @@ void wxModalEventLoop::DoRun() } m_modalWindow->SetFocus(); - + RunAppModalLoopForWindow(m_modalNativeWindow); if ( resetGroupParent ) @@ -153,7 +170,7 @@ void wxModalEventLoop::DoRun() } -void wxModalEventLoop::DoStop() +void wxModalEventLoop::OSXDoStop() { wxMacAutoreleasePool autoreleasepool; QuitAppModalLoopForWindow(m_modalNativeWindow);