diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-09-15 02:56:41 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-09-15 02:56:41 +0000 |
| commit | 48d0d4268589454a7c40917ea694a62dbbd56d90 (patch) | |
| tree | e3915f8af07fb0db77f523b011aabb45c7c46786 /openbox/mainloop.c | |
| parent | a9ae2f481ab444010dc34e1fde24839ff37d4fd3 (diff) | |
allow more than one timer to process at a time
Diffstat (limited to 'openbox/mainloop.c')
| -rw-r--r-- | openbox/mainloop.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/openbox/mainloop.c b/openbox/mainloop.c index 4dce047e..041c67f4 100644 --- a/openbox/mainloop.c +++ b/openbox/mainloop.c @@ -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; |
