Make sure to reset all the GSource timer ids

Avoids warnings like 'Source ID 8382 was not found when attempting to
remove it'. In particular some removals were missing in menuframe.c
resulting in a warning being printed every time a submenu was opened.
This commit is contained in:
Mikael Magnusson 2014-11-03 11:58:06 +01:00
parent 69dc27ed77
commit 031e3c13b4
5 changed files with 34 additions and 25 deletions

View file

@ -632,8 +632,6 @@ static gboolean hide_timeout(gpointer data)
dock->hidden = TRUE;
dock_configure();
hide_timeout_id = 0;
return FALSE; /* don't repeat */
}
@ -643,30 +641,32 @@ static gboolean show_timeout(gpointer data)
dock->hidden = FALSE;
dock_configure();
show_timeout_id = 0;
return FALSE; /* don't repeat */
}
static void destroy_timeout(gpointer data)
{
gint *id = data;
*id = 0;
}
void dock_hide(gboolean hide)
{
if (!hide) {
if (dock->hidden && config_dock_hide) {
show_timeout_id = g_timeout_add_full(G_PRIORITY_DEFAULT,
config_dock_show_delay,
show_timeout, NULL, NULL);
show_timeout, &show_timeout_id, destroy_timeout);
} else if (!dock->hidden && config_dock_hide && hide_timeout_id) {
if (hide_timeout_id) g_source_remove(hide_timeout_id);
hide_timeout_id = 0;
}
} else {
if (!dock->hidden && config_dock_hide) {
hide_timeout_id = g_timeout_add_full(G_PRIORITY_DEFAULT,
config_dock_hide_delay,
hide_timeout, NULL, NULL);
hide_timeout, &hide_timeout_id, destroy_timeout);
} else if (dock->hidden && config_dock_hide && show_timeout_id) {
if (show_timeout_id) g_source_remove(show_timeout_id);
show_timeout_id = 0;
}
}
}

View file

@ -2122,6 +2122,7 @@ static gboolean focus_delay_func(gpointer data)
if (client_focus(d->client) && config_focus_raise)
stacking_raise(CLIENT_AS_WINDOW(d->client));
event_curtime = old;
return FALSE; /* no repeat */
}
@ -2134,6 +2135,7 @@ static gboolean unfocus_delay_func(gpointer data)
event_curserial = d->serial;
focus_nothing();
event_curtime = old;
return FALSE; /* no repeat */
}

View file

@ -1666,6 +1666,8 @@ static void flash_done(gpointer data)
if (self->focused != self->flash_on)
frame_adjust_focus(self, self->focused);
self->flash_timer = 0;
}
static gboolean flash_timeout(gpointer data)
@ -1787,14 +1789,12 @@ static gboolean frame_animate_iconify(gpointer p)
XMoveResizeWindow(obt_display, self->window, x, y, w, h);
XFlush(obt_display);
if (time == 0)
frame_end_iconify_animation(self);
return time > 0; /* repeat until we're out of time */
}
void frame_end_iconify_animation(ObFrame *self)
void frame_end_iconify_animation(gpointer data)
{
ObFrame *self = data;
/* see if there is an animation going */
if (self->iconify_animation_going == 0) return;
@ -1811,6 +1811,7 @@ void frame_end_iconify_animation(ObFrame *self)
/* we're not animating any more ! */
self->iconify_animation_going = 0;
self->iconify_animation_timer = 0;
XMoveResizeWindow(obt_display, self->window,
self->area.x, self->area.y,
@ -1861,7 +1862,8 @@ void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying)
self->iconify_animation_timer =
g_timeout_add_full(G_PRIORITY_DEFAULT,
FRAME_ANIMATE_ICONIFY_STEP_TIME,
frame_animate_iconify, self, NULL);
frame_animate_iconify, self,
frame_end_iconify_animation);
/* do the first step */

View file

@ -265,7 +265,7 @@ void frame_flash_stop(ObFrame *self);
will be called when the animation finishes. But if another animation is
started in the meantime, the callback will never get called. */
void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying);
void frame_end_iconify_animation(ObFrame *self);
void frame_end_iconify_animation(gpointer data);
#define frame_iconify_animating(f) (f->iconify_animation_going != 0)

View file

@ -1036,7 +1036,6 @@ gboolean menu_frame_show_topmenu(ObMenuFrame *self, const GravityPoint *pos,
static void remove_submenu_hide_timeout(ObMenuFrame *child)
{
if (submenu_hide_timer) g_source_remove(submenu_hide_timer);
submenu_hide_timer = 0;
}
gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
@ -1134,11 +1133,9 @@ void menu_frame_hide_all(void)
{
GList *it;
if (config_submenu_show_delay) {
if (config_submenu_show_delay && submenu_show_timer)
/* remove any submenu open requests */
if (submenu_show_timer) g_source_remove(submenu_show_timer);
submenu_show_timer = 0;
}
g_source_remove(submenu_show_timer);
if ((it = g_list_last(menu_frame_visible)))
menu_frame_hide(it->data);
}
@ -1188,6 +1185,11 @@ static gboolean submenu_show_timeout(gpointer data)
return FALSE;
}
static void submenu_show_dest(gpointer data)
{
submenu_show_timer = 0;
}
static gboolean submenu_hide_timeout(gpointer data)
{
g_assert(menu_frame_visible);
@ -1195,6 +1197,11 @@ static gboolean submenu_hide_timeout(gpointer data)
return FALSE;
}
static void submenu_hide_dest(gpointer data)
{
submenu_hide_timer = 0;
}
void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry,
gboolean immediate)
{
@ -1216,11 +1223,9 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry,
if (!entry && oldchild_entry)
entry = oldchild_entry;
if (config_submenu_show_delay) {
if (config_submenu_show_delay && submenu_show_timer)
/* remove any submenu open requests */
if (submenu_show_timer) g_source_remove(submenu_show_timer);
submenu_show_timer = 0;
}
g_source_remove(submenu_show_timer);
self->selected = entry;
@ -1244,7 +1249,7 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry,
submenu_hide_timer =
g_timeout_add_full(G_PRIORITY_DEFAULT,
config_submenu_hide_delay,
submenu_hide_timeout, oldchild, NULL);
submenu_hide_timeout, oldchild, submenu_hide_dest);
}
}
}
@ -1264,7 +1269,7 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry,
g_timeout_add_full(G_PRIORITY_DEFAULT,
config_submenu_show_delay,
submenu_show_timeout,
self->selected, NULL);
self->selected, submenu_show_dest);
}
}
/* hide the grandchildren of this menu. and move the cursor to