diff options
author | Michael Meeks <michael.meeks@suse.com> | 2011-11-01 13:01:33 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-11-01 13:01:33 +0000 |
commit | fc1116452095e95616210bde60de0c0d6ed3e953 (patch) | |
tree | cd1bab25830bdc86ddce723b3cd1f45987be3324 | |
parent | 54c7480a6cdb049a5b0c907fa86af42068dcae16 (diff) |
gtk: fix cpu burn when inactive - broken timeout calculation
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 4599ec4ee317..17f179623544 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 ); } |