Exemple #1
0
int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout)
{
    wxMacAutoreleasePool autoreleasepool;

    EventRef event;
    OSStatus status = ReceiveNextEvent(0, NULL, timeout/1000, true, &event);
    switch ( status )
    {
        default:
            wxFAIL_MSG( "unexpected ReceiveNextEvent() error" );
            // fall through

        case eventLoopTimedOutErr:
            return -1;

        case eventLoopQuitErr:
            // according to QA1061 this may also occur
            // when a WakeUp Process is executed
            return 0;

        case noErr:
            DispatchAndReleaseEvent(event);
            return 1;
    }
}
Exemple #2
0
int wxGUIEventLoop::DispatchTimeout(unsigned long timeout)
{
    EventRef event;
    OSStatus status = ReceiveNextEvent(0, NULL, timeout/1000, true, &event);
    switch ( status )
    {
        default:
            wxFAIL_MSG( "unexpected ReceiveNextEvent() error" );
            // fall through

        case eventLoopTimedOutErr:
            return -1;

        case eventLoopQuitErr:
            return 0;

        case noErr:
            DispatchAndReleaseEvent(event);
            return 1;
    }
}
Exemple #3
0
bool wxGUIEventLoop::Dispatch()
{
    if ( !wxTheApp )
        return false;

    wxMacAutoreleasePool autoreleasepool;

    EventRef theEvent;

    OSStatus status = ReceiveNextEvent(0, NULL, m_sleepTime, true, &theEvent) ;

    switch (status)
    {
        case eventLoopTimedOutErr :
            if ( wxTheApp->ProcessIdle() )
                m_sleepTime = kEventDurationNoWait ;
            else
            {
                m_sleepTime = kEventDurationSecond;
#if wxUSE_THREADS
                wxMutexGuiLeave();
                wxMilliSleep(20);
                wxMutexGuiEnter();
#endif
            }
            break;

        case eventLoopQuitErr :
            // according to QA1061 this may also occur
            // when a WakeUp Process is executed
            break;

        default:
            DispatchAndReleaseEvent(theEvent);
            m_sleepTime = kEventDurationNoWait ;
            break;
    }

    return true;
}