add a means to tell the timer destroy function not to fire when for example freeing its client frame

This commit is contained in:
Mikael Magnusson 2006-08-17 20:16:02 +00:00
parent 1b4ff4e93f
commit 7b7f158088
5 changed files with 12 additions and 9 deletions

View file

@ -724,7 +724,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
if (config_focus_follow && config_focus_delay) if (config_focus_follow && config_focus_delay)
ob_main_loop_timeout_remove_data(ob_main_loop, ob_main_loop_timeout_remove_data(ob_main_loop,
focus_delay_func, focus_delay_func,
client); client, TRUE);
break; break;
default: default:
break; break;
@ -1287,7 +1287,7 @@ static gboolean focus_delay_func(gpointer data)
static void focus_delay_client_dest(ObClient *client, 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) static void event_client_dest(ObClient *client, gpointer data)

View file

@ -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->tlresize);
g_hash_table_remove(window_map, &self->trresize); 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); frame_free(self);
} }

View file

@ -608,16 +608,18 @@ void ob_main_loop_timeout_remove(ObMainLoop *loop,
} }
} }
void ob_main_loop_timeout_remove_data(ObMainLoop *loop, void ob_main_loop_timeout_remove_data(ObMainLoop *loop, GSourceFunc handler,
GSourceFunc handler, gpointer data, gboolean cancel_dest)
gpointer data)
{ {
GSList *it; GSList *it;
for (it = loop->timers; it; it = g_slist_next(it)) { for (it = loop->timers; it; it = g_slist_next(it)) {
ObMainLoopTimer *t = it->data; ObMainLoopTimer *t = it->data;
if (t->func == handler && t->data == data) if (t->func == handler && t->data == data) {
t->del_me = TRUE; t->del_me = TRUE;
if (cancel_dest)
t->destroy = NULL;
}
} }
} }

View file

@ -65,7 +65,8 @@ void ob_main_loop_timeout_remove(ObMainLoop *loop,
GSourceFunc handler); GSourceFunc handler);
void ob_main_loop_timeout_remove_data(ObMainLoop *loop, void ob_main_loop_timeout_remove_data(ObMainLoop *loop,
GSourceFunc handler, GSourceFunc handler,
gpointer data); gpointer data,
gboolean cancel_dest);
struct _ObAction; struct _ObAction;

View file

@ -176,7 +176,7 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data)
case SN_MONITOR_EVENT_CANCELED: case SN_MONITOR_EVENT_CANCELED:
if ((d = wait_find(sn_startup_sequence_get_id(seq)))) { if ((d = wait_find(sn_startup_sequence_get_id(seq)))) {
d->feedback = FALSE; 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; change = TRUE;
} }
break; break;