[Libreoffice-commits] .: vcl/unx

Michael Meeks michael at kemper.freedesktop.org
Tue Nov 1 06:01:31 PDT 2011


 vcl/unx/gtk/app/gtkdata.cxx |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit fc1116452095e95616210bde60de0c0d6ed3e953
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Nov 1 13:01:33 2011 +0000

    gtk: fix cpu burn when inactive - broken timeout calculation

diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 4599ec4..17f1796 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -836,13 +836,9 @@ extern "C" {
         GTimeVal aTimeNow;
         g_source_get_current_time( pSource, &aTimeNow );
 
-        if( pTSource->aFireTime.tv_sec > aTimeNow.tv_sec )
-            return FALSE;
-        if( pTSource->aFireTime.tv_sec < aTimeNow.tv_sec )
-            return TRUE;
-        if( pTSource->aFireTime.tv_usec < aTimeNow.tv_usec )
-            return FALSE;
-        return TRUE;
+        return ( pTSource->aFireTime.tv_sec < aTimeNow.tv_sec ||
+                 ( pTSource->aFireTime.tv_sec == aTimeNow.tv_sec &&
+                   pTSource->aFireTime.tv_usec < aTimeNow.tv_usec ) );
     }
 
     static gboolean sal_gtk_timeout_dispatch( GSource *pSource, GSourceFunc, gpointer )
@@ -921,7 +917,7 @@ bool GtkSalTimer::Expired()
 void GtkSalTimer::Start( sal_uLong nMS )
 {
     m_nTimeoutMS = nMS; // for restarting
-    Stop();
+    Stop(); // FIXME: ideally re-use an existing m_pTimeout
     m_pTimeout = create_sal_gtk_timeout( this );
 }
 


More information about the Libreoffice-commits mailing list