From fd5fa397a0a46470e034bb23789f7a17592cb070 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Wed, 18 Oct 2017 17:00:53 +0200 Subject: OSX implement direct timeout processing Basically works in the same way then in the Windows backend. Change-Id: If48e2b55f037563839a5e716830ce75ed78381e4 Reviewed-on: https://gerrit.libreoffice.org/43530 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- vcl/osx/saltimer.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'vcl/osx/saltimer.cxx') diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx index 34d46f08728a..3d74da42a3dc 100644 --- a/vcl/osx/saltimer.cxx +++ b/vcl/osx/saltimer.cxx @@ -74,6 +74,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP void AquaSalTimer::queueDispatchTimerEvent( bool bAtStart ) { Stop(); + m_bDirectTimeout = true; ImplNSAppPostEvent( AquaSalInstance::DispatchTimerEvent, bAtStart, GetNextEventVersion() ); } @@ -88,8 +89,9 @@ void AquaSalTimer::Start( sal_uLong nMS ) return; } - if ( 0 == nMS && !pSalData->mpInstance->mbIsLiveResize ) - queueDispatchTimerEvent( NO ); + m_bDirectTimeout = (0 == nMS) && !pSalData->mpInstance->mbIsLiveResize; + if ( m_bDirectTimeout ) + Stop(); else { NSTimeInterval aTI = double(nMS) / 1000.0; @@ -139,13 +141,14 @@ void AquaSalTimer::callTimerCallback() { ImplSVData* pSVData = ImplGetSVData(); SolarMutexGuard aGuard; + m_bDirectTimeout = false; if( pSVData->maSchedCtx.mpSalTimer ) pSVData->maSchedCtx.mpSalTimer->CallCallback(); } void AquaSalTimer::handleTimerElapsed() { - if ( GetSalData()->mpInstance->mbIsLiveResize ) + if ( m_bDirectTimeout || GetSalData()->mpInstance->mbIsLiveResize ) { // Stop the timer, as it is just invalidated after the firing function Stop(); @@ -155,10 +158,12 @@ void AquaSalTimer::handleTimerElapsed() queueDispatchTimerEvent( YES ); } -void AquaSalTimer::handleDispatchTimerEvent( NSEvent *pEvent ) +bool AquaSalTimer::handleDispatchTimerEvent( NSEvent *pEvent ) { - if ( IsValidEventVersion( [pEvent data1] ) ) + bool bIsValidEvent = IsValidEventVersion( [pEvent data1] ); + if ( bIsValidEvent ) callTimerCallback(); + return bIsValidEvent; } void AquaSalTimer::handleStartTimerEvent( NSEvent* pEvent ) @@ -177,8 +182,8 @@ void AquaSalTimer::handleStartTimerEvent( NSEvent* pEvent ) bool AquaSalTimer::IsTimerElapsed() const { - assert( !(ExistsValidEvent() && m_pRunningTimer) ); - if ( ExistsValidEvent() ) + assert( !((ExistsValidEvent() || m_bDirectTimeout) && m_pRunningTimer) ); + if ( ExistsValidEvent() || m_bDirectTimeout ) return true; if ( !m_pRunningTimer ) return false; -- cgit