diff options
| author | Dana Jansens <danakj@orodu.net> | 2007-04-22 04:16:00 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2007-04-22 04:16:00 +0000 |
| commit | 939fbcfd31e07a6e0f1cdbfcef9b04f63e6af700 (patch) | |
| tree | fb5ba9c9de6eb445cac162c50b220a2a091345eb /openbox/mainloop.c | |
| parent | 8612fcfb99f4ed97f49c3617fd2ae291877c8c8e (diff) | |
add a comparitor to timers. use this in event.c to let you remove timers from the queue selectively for delayed focus
Diffstat (limited to 'openbox/mainloop.c')
| -rw-r--r-- | openbox/mainloop.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/openbox/mainloop.c b/openbox/mainloop.c index e6914f89..62261dde 100644 --- a/openbox/mainloop.c +++ b/openbox/mainloop.c @@ -99,6 +99,7 @@ struct _ObMainLoopTimer gulong delay; GSourceFunc func; gpointer data; + GEqualFunc equal; GDestroyNotify destroy; /* The timer needs to be freed */ @@ -585,12 +586,14 @@ void ob_main_loop_timeout_add(ObMainLoop *loop, gulong microseconds, GSourceFunc handler, gpointer data, + GEqualFunc cmp, GDestroyNotify notify) { ObMainLoopTimer *t = g_new(ObMainLoopTimer, 1); t->delay = microseconds; t->func = handler; t->data = data; + t->equal = cmp; t->destroy = notify; t->del_me = FALSE; g_get_current_time(&loop->now); @@ -619,7 +622,7 @@ void ob_main_loop_timeout_remove_data(ObMainLoop *loop, GSourceFunc handler, for (it = loop->timers; it; it = g_slist_next(it)) { ObMainLoopTimer *t = it->data; - if (t->func == handler && t->data == data) { + if (t->func == handler && t->equal(t->data, data)) { t->del_me = TRUE; if (cancel_dest) t->destroy = NULL; |
