X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce00f59b5b169752d2f05ce3bb1a88ddc1b38b4c..235a997f9aea9d80774e296d314682e99e0c46f1:/include/wx/osx/evtloop.h diff --git a/include/wx/osx/evtloop.h b/include/wx/osx/evtloop.h index 4e45db718c..efbb220918 100644 --- a/include/wx/osx/evtloop.h +++ b/include/wx/osx/evtloop.h @@ -17,8 +17,11 @@ DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoop ); DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopObserver ); +class WXDLLIMPEXP_BASE wxCFEventLoopPauseIdleEvents; + class WXDLLIMPEXP_BASE wxCFEventLoop : public wxEventLoopBase { + friend class wxCFEventLoopPauseIdleEvents; public: wxCFEventLoop(); virtual ~wxCFEventLoop(); @@ -53,9 +56,16 @@ public: AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags); #endif // wxUSE_EVENTLOOP_SOURCE - void ObserverCallBack(CFRunLoopObserverRef observer, int activity); - protected: + void CommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity); + void DefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity); + + // set to false to avoid idling at unexpected moments - eg when having native message boxes + void SetProcessIdleEvents(bool process) { m_processIdleEvents = process; } + + static void OSXCommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info); + static void OSXDefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info); + // get the currently executing CFRunLoop virtual CFRunLoopRef CFGetCurrentRunLoop() const; @@ -74,8 +84,14 @@ protected: // cfrunloop CFRunLoopRef m_runLoop; - // runloop observer - CFRunLoopObserverRef m_runLoopObserver; + // common modes runloop observer + CFRunLoopObserverRef m_commonModeRunLoopObserver; + + // default mode runloop observer + CFRunLoopObserverRef m_defaultModeRunLoopObserver; + + // set to false to avoid idling at unexpected moments - eg when having native message boxes + bool m_processIdleEvents; private: // process all already pending events and dispatch a new one (blocking @@ -83,6 +99,15 @@ private: // // returns the return value of DoDispatchTimeout() int DoProcessEvents(); + + wxDECLARE_NO_COPY_CLASS(wxCFEventLoop); +}; + +class WXDLLIMPEXP_BASE wxCFEventLoopPauseIdleEvents : public wxObject +{ +public: + wxCFEventLoopPauseIdleEvents(); + virtual ~wxCFEventLoopPauseIdleEvents(); }; #if wxUSE_GUI