#include "wx/evtloop.h"
-#if wxUSE_EVENTLOOP_SOURCE
-
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/app.h"
// wxCFEventLoopSource and wxCFEventLoop implementation
// ============================================================================
+#if wxUSE_EVENTLOOP_SOURCE
+
namespace
{
// and this input is only removed from it when pending event handlers are
// executed)
- if ( wxTheApp )
+ if ( wxTheApp && ShouldProcessIdleEvents() )
wxTheApp->ProcessPendingEvents();
}
if ( activity & kCFRunLoopBeforeWaiting )
{
- if ( m_processIdleEvents && ProcessIdle() )
+ if ( ShouldProcessIdleEvents() && ProcessIdle() )
{
WakeUp();
}
m_shouldExit = false;
m_processIdleEvents = true;
+#if wxUSE_UIACTIONSIMULATOR
+ m_shouldWaitForEvent = false;
+#endif
+
m_runLoop = CFGetCurrentRunLoop();
CFRunLoopObserverContext ctxt;
int wxCFEventLoop::DoProcessEvents()
{
- return DispatchTimeout( 0 );
+ if ( m_shouldWaitForEvent )
+ {
+ int handled = DispatchTimeout( 1000 );
+ wxASSERT_MSG( handled == 1, "No Event Available");
+ m_shouldWaitForEvent = false;
+ return handled;
+ }
+ else
+ return DispatchTimeout( 0 );
}
bool wxCFEventLoop::Dispatch()
{
wxCFEventLoop* cfl = dynamic_cast<wxCFEventLoop*>(wxEventLoopBase::GetActive());
if ( cfl )
+ {
+ m_formerState = cfl->ShouldProcessIdleEvents();
cfl->SetProcessIdleEvents(false);
+ }
+ else
+ m_formerState = true;
}
wxCFEventLoopPauseIdleEvents::~wxCFEventLoopPauseIdleEvents()
{
wxCFEventLoop* cfl = dynamic_cast<wxCFEventLoop*>(wxEventLoopBase::GetActive());
if ( cfl )
- cfl->SetProcessIdleEvents(true);
+ cfl->SetProcessIdleEvents(m_formerState);
}
// TODO Move to thread_osx.cpp