]> Dogcows Code - chaz/openbox/commitdiff
insert timers in the correct order
authorDana Jansens <danakj@orodu.net>
Wed, 24 Sep 2003 16:56:46 +0000 (16:56 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 24 Sep 2003 16:56:46 +0000 (16:56 +0000)
openbox/mainloop.c

index 6b931957b073b85ca2b8781b95c704a7f29d29c0..284de04bcd41a21f6d7685a1528d984c27f1d162 100644 (file)
@@ -507,14 +507,14 @@ static void insert_timer(ObMainLoop *loop, ObMainLoopTimer *ins)
 {
     GSList *it;
     for (it = loop->timers; it; it = g_slist_next(it)) {
-       ObMainLoopTimer *t = it->data;
-        if (timecompare(&ins->timeout, &t->timeout) <= 0) {
-           loop->timers = g_slist_insert_before(loop->timers, it, ins);
-           break;
-       }
+        ObMainLoopTimer *t = it->data;
+        if (timecompare(&ins->timeout, &t->timeout) >= 0) {
+            loop->timers = g_slist_insert_before(loop->timers, it, ins);
+            break;
+        }
     }
     if (it == NULL) /* didnt fit anywhere in the list */
-       loop->timers = g_slist_append(loop->timers, ins);
+        loop->timers = g_slist_append(loop->timers, ins);
 }
 
 void ob_main_loop_timeout_add(ObMainLoop *loop,
@@ -609,7 +609,7 @@ static void timer_dispatch(ObMainLoop *loop, GTimeVal **wait)
        
         /* the queue is sorted, so if this timer shouldn't fire, none are 
            ready */
-        if (timecompare(&NEAREST_TIMEOUT(loop), &loop->now) <= 0)
+        if (timecompare(&NEAREST_TIMEOUT(loop), &loop->now) < 0)
             break;
 
         /* we set the last fired time to delay msec after the previous firing,
This page took 0.02609 seconds and 4 git commands to generate.