From 56a323877e6f7fe063902e4c4d467c69fabad0b9 Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Tue, 9 Sep 2008 23:14:52 +0000 Subject: [PATCH] fix kwin-composite lockup at time of day == 00:00:00. also note that compositeRate is misnamed, it is an interval. CCMAIL:l.lunak@kde.org svn path=/trunk/KDE/kdebase/workspace/; revision=859300 --- composite.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composite.cpp b/composite.cpp index 387f73ee1e..ea9f79a188 100644 --- a/composite.cpp +++ b/composite.cpp @@ -183,7 +183,7 @@ void Workspace::setupCompositing() if( rate <= 0 ) rate = 50; // QTimer gives us 1msec (1000Hz) at best, so we ignore anything higher; - // however, additional throttling makes prevents very high rates from taking place anyway + // however, additional throttling prevents very high rates from taking place anyway else if( rate > 1000 ) rate = 1000; kDebug( 1212 ) << "Refresh rate " << rate << "Hz"; @@ -406,9 +406,9 @@ void Workspace::setCompositeTimer() { if( !compositing()) // should not really happen, but there may be e.g. some damage events still pending return; - // Last paint set nextPaintReference as a reference time from which multiples of compositeRate - // should be added for the next paint. - compositeTimer.start( nextPaintReference.msecsTo( QTime::currentTime()) % compositeRate ); + // The last paint set nextPaintReference as a reference time to which multiples of compositeRate + // should be added for the next paint. qMax() is a guard against negative moduli when the day changes. + compositeTimer.start( qMax ( 0, nextPaintReference.msecsTo( QTime::currentTime()) % compositeRate ) ); } bool Workspace::createOverlay()