diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-09-29 21:02:17 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-10-04 14:53:33 +0200 |
commit | da5cdcdeddf7bc21606b4cb64d8b1fc412146935 (patch) | |
tree | e887175264e671a241e735763100e40adaa15e7c /vcl/osx | |
parent | 96e67461c8b451f3a313bcc973ac49c5e49537c0 (diff) |
Convert tick-based timer events to versioned ones
Instead of storing the system ticks in the timer event message
simply store a version.
Moves the version handling code into a VersionedEvent class,
inherited by WinSalTimer and AquaSalTimer.
Change-Id: I5add85031d36b3424a26a9ef798294cbfb00b2e4
Reviewed-on: https://gerrit.libreoffice.org/42959
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/osx')
-rw-r--r-- | vcl/osx/saltimer.cxx | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx index 30ef9ef60055..877fdfae85b5 100644 --- a/vcl/osx/saltimer.cxx +++ b/vcl/osx/saltimer.cxx @@ -74,10 +74,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP void AquaSalTimer::queueDispatchTimerEvent( bool bAtStart ) { Stop(); - m_nTimerStartTicks = tools::Time::GetMonotonicTicks() % SAL_MAX_INT32; - if ( 0 == m_nTimerStartTicks ) - m_nTimerStartTicks++; - ImplNSAppPostEvent( AquaSalInstance::DispatchTimerEvent, bAtStart, m_nTimerStartTicks ); + ImplNSAppPostEvent( AquaSalInstance::DispatchTimerEvent, + bAtStart, GetNextEventVersion() ); } void AquaSalTimer::Start( sal_uLong nMS ) @@ -134,7 +132,7 @@ void AquaSalTimer::Stop() [m_pRunningTimer release]; m_pRunningTimer = nil; } - m_nTimerStartTicks = 0; + InvalidateEvent(); } void AquaSalTimer::callTimerCallback() @@ -147,18 +145,19 @@ void AquaSalTimer::callTimerCallback() void AquaSalTimer::handleTimerElapsed() { - // Stop the timer, as it is just invalidated after the firing function - Stop(); - if ( GetSalData()->mpInstance->mbIsLiveResize ) + { + // Stop the timer, as it is just invalidated after the firing function + Stop(); callTimerCallback(); + } else queueDispatchTimerEvent( YES ); } void AquaSalTimer::handleDispatchTimerEvent( NSEvent *pEvent ) { - if (m_nTimerStartTicks == [pEvent data1]) + if ( IsValidEventVersion( [pEvent data1] ) ) callTimerCallback(); } @@ -178,8 +177,8 @@ void AquaSalTimer::handleStartTimerEvent( NSEvent* pEvent ) bool AquaSalTimer::IsTimerElapsed() const { - assert( !(m_nTimerStartTicks && m_pRunningTimer) ); - if ( 0 != m_nTimerStartTicks ) + assert( !(ExistsValidEvent() && m_pRunningTimer) ); + if ( ExistsValidEvent() ) return true; if ( !m_pRunningTimer ) return false; @@ -189,7 +188,6 @@ bool AquaSalTimer::IsTimerElapsed() const AquaSalTimer::AquaSalTimer( ) : m_pRunningTimer( nil ) - , m_nTimerStartTicks( 0 ) { } |