all repos — openbox @ 031e3c13b4333ae8def24f4ccb2f777779d4a3a5

openbox fork - make it a bit more like ryudo

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.
Mikael Magnusson mikachu@gmail.com
commit

031e3c13b4333ae8def24f4ccb2f777779d4a3a5

parent

69dc27ed779173d0475f11001ea5268087b4b306

5 files changed, 34 insertions(+), 25 deletions(-)

jump to
M openbox/dock.copenbox/dock.c

@@ -632,8 +632,6 @@ /* hide */

dock->hidden = TRUE; dock_configure(); - hide_timeout_id = 0; - return FALSE; /* don't repeat */ }

@@ -643,30 +641,32 @@ /* show */

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; } } }
M openbox/event.copenbox/event.c

@@ -2122,6 +2122,7 @@ event_curserial = d->serial;

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 @@ event_curtime = d->time;

event_curserial = d->serial; focus_nothing(); event_curtime = old; + return FALSE; /* no repeat */ }
M openbox/frame.copenbox/frame.c

@@ -1666,6 +1666,8 @@ ObFrame *self = 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 @@

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 @@ }

/* 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 @@ g_source_remove(self->iconify_animation_timer);

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 */
M openbox/frame.hopenbox/frame.h

@@ -265,7 +265,7 @@ /*! Start an animation for iconifying or restoring a frame. The callback

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)
M openbox/menuframe.copenbox/menuframe.c

@@ -1036,7 +1036,6 @@ */

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 @@ menu_entry_frame_show_submenu((ObMenuEntryFrame*)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 @@ menu_frame_hide((ObMenuFrame*)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 @@ selection back to that submenu */

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 @@ if (submenu_hide_timer) g_source_remove(submenu_hide_timer);

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 @@ submenu_show_timer =

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