X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmainloop.c;h=9676f07e1d3512b375013c813dffe3ac77001ac7;hb=b2b8ad92bfbc60392737fe9945e719b238d34933;hp=2e7c190be27de20405c2dc5b993d501e7f445c87;hpb=f6ba1f27b9790f56bda1e5831069e2dd7e2c96a2;p=chaz%2Fopenbox diff --git a/openbox/mainloop.c b/openbox/mainloop.c index 2e7c190b..9676f07e 100644 --- a/openbox/mainloop.c +++ b/openbox/mainloop.c @@ -1,6 +1,7 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- mainloop.c for the Openbox window manager + Copyright (c) 2004 Mikael Magnusson Copyright (c) 2003 Ben Jansens This program is free software; you can redistribute it and/or modify @@ -293,7 +294,7 @@ void ob_main_loop_run(ObMainLoop *loop) for (i = 0; i < NUM_SIGNALS; ++i) { while (loop->signals_fired[i]) { for (it = loop->signal_handlers[i]; - it; it = g_slist_next(it)) { + it; it = g_slist_next(it)) { ObMainLoopSignalHandlerType *h = it->data; h->func(i, h->data); } @@ -313,9 +314,9 @@ void ob_main_loop_run(ObMainLoop *loop) } } while (XPending(loop->display)); } else if (loop->action_queue) { - /* only fire off one action at a time, then go back for more - X events, since the action might cause some X events (like - FocusIn :) */ + /* only fire off one action at a time, then go back for more + X events, since the action might cause some X events (like + FocusIn :) */ do { act = loop->action_queue->data; @@ -324,7 +325,7 @@ void ob_main_loop_run(ObMainLoop *loop) { loop->action_queue = g_slist_delete_link(loop->action_queue, - loop->action_queue); + loop->action_queue); action_unref(act); act = NULL; } @@ -553,9 +554,9 @@ void ob_main_loop_fd_remove(ObMainLoop *loop, #define NEAREST_TIMEOUT(loop) \ (((ObMainLoopTimer*)(loop)->timers->data)->timeout) -static long timecompare(GTimeVal *a, GTimeVal *b) +static glong timecompare(GTimeVal *a, GTimeVal *b) { - long r; + glong r; if ((r = b->tv_sec - a->tv_sec)) return r; return b->tv_usec - a->tv_usec; @@ -662,10 +663,12 @@ static void timer_dispatch(ObMainLoop *loop, GTimeVal **wait) if (curr->del_me) { /* delete the top */ loop->timers = g_slist_delete_link(loop->timers, it); + if (curr->destroy) + curr->destroy(curr->data); g_free(curr); continue; } - + /* the queue is sorted, so if this timer shouldn't fire, none are ready */ if (timecompare(&NEAREST_TIMEOUT(loop), &loop->now) < 0)