#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<wxCFEventLoop *>(info);
if ( eventloop )
eventloop->ObserverCallBack(observer, activity);
}
-void wxCFEventLoop::ObserverCallBack(CFRunLoopObserverRef observer, int activity)
+void wxCFEventLoop::ObserverCallBack(CFRunLoopObserverRef WXUNUSED(observer), int activity)
{
if ( activity & kCFRunLoopBeforeTimers )
{
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);
}
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
int wxCFEventLoop::DoProcessEvents()
{
- return DispatchTimeout( 1000 );
+ return DispatchTimeout( 0 );
}
bool wxCFEventLoop::Dispatch()