]> Dogcows Code - chaz/openbox/blobdiff - openbox/mainloop.c
add a comparitor to timers. use this in event.c to let you remove timers from the...
[chaz/openbox] / openbox / mainloop.c
index e6914f89e8f446b26f71cf3eee0973163262a5f9..62261dde0af6e52dd2b215aea6a12f8c659e8cd2 100644 (file)
@@ -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;
This page took 0.022088 seconds and 4 git commands to generate.