From: Mikael Magnusson Date: Thu, 17 Aug 2006 20:16:02 +0000 (+0000) Subject: add a means to tell the timer destroy function not to fire when for example freeing... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=7b7f158088fa548791922b7cf133e507d3873656;p=chaz%2Fopenbox add a means to tell the timer destroy function not to fire when for example freeing its client frame --- diff --git a/openbox/event.c b/openbox/event.c index 7717e25f..1efccdbe 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -724,7 +724,7 @@ static void event_handle_client(ObClient *client, XEvent *e) if (config_focus_follow && config_focus_delay) ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func, - client); + client, TRUE); break; default: break; @@ -1287,7 +1287,7 @@ static gboolean focus_delay_func(gpointer data) static void focus_delay_client_dest(ObClient *client, gpointer data) { - ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func, client); + ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func, client, TRUE); } static void event_client_dest(ObClient *client, gpointer data) diff --git a/openbox/frame.c b/openbox/frame.c index c55ff290..881387b6 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -556,7 +556,7 @@ void frame_release_client(ObFrame *self, ObClient *client) g_hash_table_remove(window_map, &self->tlresize); g_hash_table_remove(window_map, &self->trresize); - ob_main_loop_timeout_remove_data(ob_main_loop, flash_timeout, self); + ob_main_loop_timeout_remove_data(ob_main_loop, flash_timeout, self, TRUE); frame_free(self); } diff --git a/openbox/mainloop.c b/openbox/mainloop.c index 9676f07e..b59564a2 100644 --- a/openbox/mainloop.c +++ b/openbox/mainloop.c @@ -608,16 +608,18 @@ void ob_main_loop_timeout_remove(ObMainLoop *loop, } } -void ob_main_loop_timeout_remove_data(ObMainLoop *loop, - GSourceFunc handler, - gpointer data) +void ob_main_loop_timeout_remove_data(ObMainLoop *loop, GSourceFunc handler, + gpointer data, gboolean cancel_dest) { GSList *it; 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->data == data) { t->del_me = TRUE; + if (cancel_dest) + t->destroy = NULL; + } } } diff --git a/openbox/mainloop.h b/openbox/mainloop.h index 82aa70ca..45cef182 100644 --- a/openbox/mainloop.h +++ b/openbox/mainloop.h @@ -65,7 +65,8 @@ void ob_main_loop_timeout_remove(ObMainLoop *loop, GSourceFunc handler); void ob_main_loop_timeout_remove_data(ObMainLoop *loop, GSourceFunc handler, - gpointer data); + gpointer data, + gboolean cancel_dest); struct _ObAction; diff --git a/openbox/startupnotify.c b/openbox/startupnotify.c index f296c76d..0bf15d4a 100644 --- a/openbox/startupnotify.c +++ b/openbox/startupnotify.c @@ -176,7 +176,7 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data) case SN_MONITOR_EVENT_CANCELED: if ((d = wait_find(sn_startup_sequence_get_id(seq)))) { d->feedback = FALSE; - ob_main_loop_timeout_remove_data(ob_main_loop, sn_wait_timeout, d); + ob_main_loop_timeout_remove_data(ob_main_loop, sn_wait_timeout, d, FALSE); change = TRUE; } break;