void wxApp::MacDoOneEvent() { EventRef theEvent; s_inReceiveEvent = true ; OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ; s_inReceiveEvent = false ; if ( status == eventLoopTimedOutErr ) { if ( wxTheApp->ProcessIdle() ) sleepTime = kEventDurationNoWait ; else sleepTime = kEventDurationSecond; } else if ( status == eventLoopQuitErr ) { // according to QA1061 this may also occur when a WakeUp Process // is executed } else { MacHandleOneEvent( theEvent ) ; ReleaseEvent(theEvent); sleepTime = kEventDurationNoWait ; } // repeaters DeletePendingObjects() ; wxMacProcessNotifierAndPendingEvents() ; }
void wxApp::MacDoOneEvent() { wxMacAutoreleasePool autoreleasepool; EventRef theEvent; s_inReceiveEvent = true ; OSStatus status = ReceiveNextEvent(0, NULL, sleepTime, true, &theEvent) ; s_inReceiveEvent = false ; switch (status) { case eventLoopTimedOutErr : if ( wxTheApp->ProcessIdle() ) sleepTime = kEventDurationNoWait ; else sleepTime = kEventDurationSecond; break; case eventLoopQuitErr : // according to QA1061 this may also occur // when a WakeUp Process is executed break; default: MacHandleOneEvent( theEvent ) ; ReleaseEvent( theEvent ); sleepTime = kEventDurationNoWait ; break; } // repeaters DeletePendingObjects() ; wxMacProcessNotifierAndPendingEvents() ; }
bool wxApp::Yield(bool onlyIfNeeded) { if (s_inYield) { if ( !onlyIfNeeded ) { wxFAIL_MSG( wxT("wxYield called recursively" ) ); } return false; } #if wxUSE_THREADS // Yielding from a non-gui thread needs to bail out, otherwise we end up // possibly sending events in the thread too. if ( !wxThread::IsMain() ) { return true; } #endif // wxUSE_THREADS s_inYield = true; // by definition yield should handle all non-processed events EventRef theEvent; OSStatus status = noErr ; while ( status == noErr ) { s_inReceiveEvent = true ; status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ; s_inReceiveEvent = false ; if ( status == eventLoopTimedOutErr ) { // make sure next time the event loop will trigger idle events sleepTime = kEventDurationNoWait ; } else if ( status == eventLoopQuitErr ) { // according to QA1061 this may also occur when a WakeUp Process // is executed } else { MacHandleOneEvent( theEvent ) ; ReleaseEvent(theEvent); } } wxMacProcessNotifierAndPendingEvents() ; s_inYield = false; return true; }
void wxApp::OnIdle(wxIdleEvent& event) { wxAppBase::OnIdle(event); // If they are pending events, we must process them: pending events are // either events to the threads other than main or events posted with // wxPostEvent() functions wxMacProcessNotifierAndPendingEvents(); if(!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar()) wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar(); }
void wxApp::MacHandleOneEvent( WXEVENTREF evr ) { EventTargetRef theTarget; theTarget = GetEventDispatcherTarget(); m_macCurrentEvent = evr ; OSStatus status = SendEventToEventTarget ((EventRef) evr , theTarget); if(status == eventNotHandledErr) { MacHandleUnhandledEvent(evr); } wxMacProcessNotifierAndPendingEvents() ; #if wxUSE_THREADS wxMutexGuiLeaveOrEnter(); #endif // wxUSE_THREADS }
bool wxApp::Yield(bool onlyIfNeeded) { if (s_inYield) { if ( !onlyIfNeeded ) { wxFAIL_MSG( wxT("wxYield called recursively" ) ); } return FALSE; } s_inYield = TRUE; // by definition yield should handle all non-processed events EventRef theEvent; OSStatus status = noErr ; do { s_inReceiveEvent = true ; status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ; s_inReceiveEvent = false ; if ( status == eventLoopTimedOutErr ) { // make sure next time the event loop will trigger idle events sleepTime = kEventDurationNoWait ; } else if ( status == eventLoopQuitErr ) { // according to QA1061 this may also occur when a WakeUp Process // is executed } else { MacHandleOneEvent( theEvent ) ; ReleaseEvent(theEvent); } } while( status == noErr ) ; wxMacProcessNotifierAndPendingEvents() ; s_inYield = FALSE; return TRUE; }