X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/56869c5423170499f9b816c7c2a5a43773e073c7..33820d94285c0004acce756e7d10d9698e6387d1:/src/osx/core/timer.cpp diff --git a/src/osx/core/timer.cpp b/src/osx/core/timer.cpp index 2a18cd7ff3..ce0d98d598 100644 --- a/src/osx/core/timer.cpp +++ b/src/osx/core/timer.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: sec/osx/core/timer.cpp +// Name: src/osx/core/timer.cpp // Purpose: wxTimer implementation using CoreFoundation // Author: Stefan Csomor // Modified by: @@ -69,7 +69,7 @@ bool wxOSXTimerImpl::Start( int milliseconds, bool mode ) wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeout") ); wxCHECK_MSG( m_info->m_timerRef == NULL, false, wxT("attempting to restart a timer") ); - + CFGregorianUnits gumilli ; memset(&gumilli,0,sizeof(gumilli) ); gumilli.seconds = m_milli / 1000.0; @@ -81,15 +81,20 @@ bool wxOSXTimerImpl::Start( int milliseconds, bool mode ) m_info->m_timer = this; m_info->m_timerRef = CFRunLoopTimerCreate( - kCFAllocatorDefault, + kCFAllocatorDefault, CFAbsoluteTimeAddGregorianUnits( CFAbsoluteTimeGetCurrent() , NULL, gumilli ), IsOneShot() ? 0 : CFTimeInterval( m_milli / 1000.0 ) , 0, 0, wxProcessTimer, &ctx); - + wxASSERT_MSG( m_info->m_timerRef != NULL, wxT("unable to create timer")); - - CFRunLoopAddTimer( CFRunLoopGetMain() // or CFRunLoopGetCurrent() ? - , m_info->m_timerRef, kCFRunLoopCommonModes) ; + + CFRunLoopRef runLoop = 0; +#if wxOSX_USE_IPHONE + runLoop = CFRunLoopGetMain(); +#else + runLoop = CFRunLoopGetCurrent(); +#endif + CFRunLoopAddTimer( runLoop, m_info->m_timerRef, kCFRunLoopCommonModes) ; return true;