Some fixes for the submenu hide delay code When nothing in a menu is selected, go back to selecting the open submenu. Adjust the LeaveNotify event handling to only respond when there is not a EnterNotify coming for the same menu frame. Change the default submenu show/hide delays. Have the default values for submenu show/hide match the default rc.xml
Dana Jansens danakj@orodu.net
5 files changed,
72 insertions(+),
87 deletions(-)
M
data/rc.xml
→
data/rc.xml
@@ -632,7 +632,7 @@ <!-- if a press-release lasts longer than this setting (in milliseconds), the
menu is hidden again --> <middle>no</middle> <!-- center submenus vertically about the parent entry --> - <submenuShowDelay>100</submenuShowDelay> + <submenuShowDelay>200</submenuShowDelay> <!-- this one is easy, time to delay before showing a submenu after hovering over the parent entry --> <submenuHideDelay>400</submenuHideDelay>
M
openbox/config.c
→
openbox/config.c
@@ -1018,8 +1018,8 @@ parse_register(i, "resistance", parse_resistance, NULL);
config_menu_hide_delay = 250; config_menu_middle = FALSE; - config_submenu_show_delay = 0; - config_submenu_hide_delay = 750; + config_submenu_show_delay = 200; + config_submenu_hide_delay = 400; config_menu_client_list_icons = TRUE; config_menu_manage_desktops = TRUE; config_menu_files = NULL;
M
openbox/event.c
→
openbox/event.c
@@ -1800,6 +1800,15 @@
return ret; } +static Bool event_look_for_menu_enter(Display *d, XEvent *ev, XPointer arg) +{ + ObMenuFrame *f = (ObMenuFrame*)arg; + ObMenuEntryFrame *e; + return ev->type == EnterNotify && + (e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) && + !e->ignore_enters && e->frame == f; +} + static gboolean event_handle_menu(XEvent *ev) { ObMenuFrame *f;@@ -1837,11 +1846,17 @@ /*ignore leaves when we're already in the window */
if (ev->xcrossing.detail == NotifyInferior) break; - if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) && - (f = find_active_menu()) && f->selected == e && - e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU) + if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window))) { - menu_frame_select(e->frame, NULL, FALSE); + XEvent ce; + + /* check if an EnterNotify event is coming, and if not, then select + nothing in the menu */ + if (XCheckIfEvent(ob_display, &ce, event_look_for_menu_enter, + (XPointer)e->frame)) + XPutBackEvent(ob_display, &ce); + else + menu_frame_select(e->frame, NULL, FALSE); } break; case MotionNotify: