X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cfb0ef701eb4d8043b91822931ca0e6e3af5fddc..ff534ba469473a9ace193e736ca131144df307f9:/src/osx/carbon/evtloop.cpp diff --git a/src/osx/carbon/evtloop.cpp b/src/osx/carbon/evtloop.cpp index 4ca136ca90..d263effec7 100644 --- a/src/osx/carbon/evtloop.cpp +++ b/src/osx/carbon/evtloop.cpp @@ -60,7 +60,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,6 +83,16 @@ int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) } } +void wxGUIEventLoop::WakeUp() +{ + OSStatus err = noErr; + wxMacCarbonEvent wakeupEvent; + wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(), + kEventAttributeNone ); + err = PostEventToQueue(GetMainEventQueue(), wakeupEvent, + kEventPriorityHigh ); +} + void wxGUIEventLoop::DoRun() { wxMacAutoreleasePool autoreleasepool; @@ -94,11 +104,16 @@ void wxGUIEventLoop::DoStop() QuitApplicationEventLoop(); } +CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const +{ + return wxCFEventLoop::CFGetCurrentRunLoop(); +} + // TODO move into a evtloop_osx.cpp wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow) { - m_modalWindow = dynamic_cast (modalWindow); + m_modalWindow = wxDynamicCast(modalWindow, wxNonOwnedWindow); wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" ); m_modalNativeWindow = m_modalWindow->GetWXWindow(); } @@ -114,13 +129,14 @@ wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow) void wxModalEventLoop::DoRun() { + wxWindowDisabler disabler(m_modalWindow); wxMacAutoreleasePool autoreleasepool; bool resetGroupParent = false; 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 ) { @@ -137,7 +153,7 @@ void wxModalEventLoop::DoRun() } m_modalWindow->SetFocus(); - + RunAppModalLoopForWindow(m_modalNativeWindow); if ( resetGroupParent )