From d60957aac53d7057bd5d72b9f66d3df89b3f9e5b Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 11 Jun 2013 17:54:07 +0000 Subject: [PATCH] better support for ui action simulation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/core/evtloop.h | 10 ++++++++++ src/osx/core/evtloop_cf.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/wx/osx/core/evtloop.h b/include/wx/osx/core/evtloop.h index 600c2056cd..c5bb71b643 100644 --- a/include/wx/osx/core/evtloop.h +++ b/include/wx/osx/core/evtloop.h @@ -55,6 +55,13 @@ public: #endif // wxUSE_EVENTLOOP_SOURCE bool ShouldProcessIdleEvents() const { return m_processIdleEvents ; } + +#if wxUSE_UIACTIONSIMULATOR + // notifies Yield and Dispatch to wait for at least one event before + // returning, this is necessary, because the synthesized events need to be + // converted by the OS before being available on the native event queue + void SetShouldWaitForEvent(bool should) { m_shouldWaitForEvent = should; } +#endif protected: void CommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity); void DefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity); @@ -92,6 +99,9 @@ protected: // set to false to avoid idling at unexpected moments - eg when having native message boxes bool m_processIdleEvents; +#if wxUSE_UIACTIONSIMULATOR + bool m_shouldWaitForEvent; +#endif private: // process all already pending events and dispatch a new one (blocking // until it appears in the event queue if necessary) diff --git a/src/osx/core/evtloop_cf.cpp b/src/osx/core/evtloop_cf.cpp index 8d3ef5f843..19b10e4911 100644 --- a/src/osx/core/evtloop_cf.cpp +++ b/src/osx/core/evtloop_cf.cpp @@ -203,6 +203,10 @@ wxCFEventLoop::wxCFEventLoop() m_shouldExit = false; m_processIdleEvents = true; +#if wxUSE_UIACTIONSIMULATOR + m_shouldWaitForEvent = false; +#endif + m_runLoop = CFGetCurrentRunLoop(); CFRunLoopObserverContext ctxt; @@ -298,6 +302,12 @@ bool wxCFEventLoop::Pending() const int wxCFEventLoop::DoProcessEvents() { + if ( m_shouldWaitForEvent ) + { + int handled = DispatchTimeout( 10000 ); + wxASSERT_MSG( handled == 1, "No Event Available"); + m_shouldWaitForEvent = false; + } return DispatchTimeout( 0 ); } -- 2.45.2