- if (oldchild) {
- /* there is an open submenu */
-
- if (config_submenu_show_delay && !immediate) {
- if (entry == self->open_submenu) {
- /* we moved onto the entry that has an open submenu, so stop
- trying to close the submenu */
- obt_main_loop_timeout_remove
- (ob_main_loop,
- menu_entry_frame_submenu_hide_timeout);
- }
- else if (old == self->open_submenu) {
- /* we just moved off the entry with an open submenu, so
- close the open submenu after a delay */
- obt_main_loop_timeout_add
- (ob_main_loop,
- config_submenu_show_delay * 1000,
- menu_entry_frame_submenu_hide_timeout,
- self->child, g_direct_equal,
- NULL);
+ if (oldchild_entry) {
+ /* There is an open submenu */
+ if (oldchild_entry == self->selected) {
+ /* The open submenu has been reselected, so stop hiding the
+ submenu */
+ remove_submenu_hide_timeout(oldchild);
+ }
+ else if (oldchild_entry == old) {
+ /* The open submenu was selected and is no longer, so hide the
+ submenu */
+ if (immediate || config_submenu_hide_delay == 0)
+ menu_frame_hide(oldchild);
+ else if (config_submenu_hide_delay > 0) {
+ 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);