X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/de5361faf303dac842068f28c81f084cfc86101d..b70ee0382a1aff1ed5b78d2c88311f7f6b922c64:/src/osx/core/evtloop_cf.cpp diff --git a/src/osx/core/evtloop_cf.cpp b/src/osx/core/evtloop_cf.cpp index 4e4dcd0aca..6dc470f817 100644 --- a/src/osx/core/evtloop_cf.cpp +++ b/src/osx/core/evtloop_cf.cpp @@ -146,7 +146,7 @@ wxCFEventLoop::AddSourceForFD(int WXUNUSED(fd), #endif // wxUSE_EVENTLOOP_SOURCE -void wxObserverCallBack(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) +extern "C" void wxObserverCallBack(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) { wxCFEventLoop * eventloop = static_cast(info); if ( eventloop ) @@ -196,13 +196,14 @@ wxCFEventLoop::wxCFEventLoop() bzero( &ctxt, sizeof(ctxt) ); ctxt.info = this; m_runLoopObserver = CFRunLoopObserverCreate( kCFAllocatorDefault, kCFRunLoopBeforeTimers | kCFRunLoopBeforeWaiting , true /* repeats */, 0, - wxObserverCallBack, &ctxt ); - CFRunLoopAddObserver(m_runLoop, m_runLoopObserver, kCFRunLoopDefaultMode); + wxObserverCallBack, &ctxt ); + CFRunLoopAddObserver(m_runLoop, m_runLoopObserver, kCFRunLoopCommonModes); + CFRelease(m_runLoopObserver); } wxCFEventLoop::~wxCFEventLoop() { - CFRunLoopRemoveObserver(m_runLoop, m_runLoopObserver, kCFRunLoopDefaultMode); + CFRunLoopRemoveObserver(m_runLoop, m_runLoopObserver, kCFRunLoopCommonModes); } @@ -213,11 +214,21 @@ CFRunLoopRef wxCFEventLoop::CFGetCurrentRunLoop() const void wxCFEventLoop::WakeUp() { - extern void wxMacWakeUp(); + CFRunLoopWakeUp(m_runLoop); +} + +#if wxUSE_BASE - wxMacWakeUp(); +void wxMacWakeUp() +{ + wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); + + if ( loop ) + loop->WakeUp(); } +#endif + bool wxCFEventLoop::YieldFor(long eventsToProcess) { #if wxUSE_THREADS @@ -267,7 +278,7 @@ bool wxCFEventLoop::Pending() const int wxCFEventLoop::DoProcessEvents() { - return DispatchTimeout( 1000 ); + return DispatchTimeout( 0 ); } bool wxCFEventLoop::Dispatch()