]> Dogcows Code - chaz/openbox/commitdiff
allow more than one timer to process at a time
authorDana Jansens <danakj@orodu.net>
Mon, 15 Sep 2003 02:56:41 +0000 (02:56 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 15 Sep 2003 02:56:41 +0000 (02:56 +0000)
openbox/mainloop.c

index 4dce047ee9dd79cc48aa9f56e687067988591ffb..041c67f4e39b5aba24e18cf85d0be65655c263d2 100644 (file)
@@ -566,6 +566,8 @@ static gboolean nearest_timeout_wait(ObMainLoop *loop, GTimeVal *tm)
 
 static void timer_dispatch(ObMainLoop *loop, GTimeVal **wait)
 {
+    gboolean fired = FALSE;
+
     g_get_current_time(&loop->now);
 
     while (loop->timers != NULL) {
@@ -600,15 +602,16 @@ static void timer_dispatch(ObMainLoop *loop, GTimeVal **wait)
             g_free(curr);
         }
 
+        fired = TRUE;
+    }
+
+    if (fired) {
        /* if at least one timer fires, then don't wait on X events, as there
           may already be some in the queue from the timer callbacks.
        */
        loop->ret_wait.tv_sec = loop->ret_wait.tv_usec = 0;
        *wait = &loop->ret_wait;
-       return;
-    }
-
-    if (nearest_timeout_wait(loop, &loop->ret_wait))
+    } else if (nearest_timeout_wait(loop, &loop->ret_wait))
        *wait = &loop->ret_wait;
     else
        *wait = NULL;
This page took 0.022578 seconds and 4 git commands to generate.