#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()
{
+ if ( m_shouldWaitForEvent )
+ {
+ int handled = DispatchTimeout( 10000 );
+ wxASSERT_MSG( handled == 1, "No Event Available");
+ m_shouldWaitForEvent = false;
+ }
return DispatchTimeout( 0 );
}
DoStop();
}
-wxCFEventLoopPauseObservers::wxCFEventLoopPauseObservers()
+wxCFEventLoopPauseIdleEvents::wxCFEventLoopPauseIdleEvents()
{
wxCFEventLoop* cfl = dynamic_cast<wxCFEventLoop*>(wxEventLoopBase::GetActive());
if ( cfl )
+ {
+ m_formerState = cfl->ShouldProcessIdleEvents();
cfl->SetProcessIdleEvents(false);
+ }
+ else
+ m_formerState = true;
}
-wxCFEventLoopPauseObservers::~wxCFEventLoopPauseObservers()
+wxCFEventLoopPauseIdleEvents::~wxCFEventLoopPauseIdleEvents()
{
wxCFEventLoop* cfl = dynamic_cast<wxCFEventLoop*>(wxEventLoopBase::GetActive());
if ( cfl )
- cfl->SetProcessIdleEvents(true);
+ cfl->SetProcessIdleEvents(m_formerState);
}
// TODO Move to thread_osx.cpp