From 775f60852a82930e870102a3b3b5a073c3ad6401 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 22 Dec 2009 09:31:24 -0500 Subject: Revert "A fix for delayed hiding of submenus." This reverts commit 1fb198410e9d3ca660d91d1049249db0f2f47732. --- openbox/event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openbox/event.c') diff --git a/openbox/event.c b/openbox/event.c index bbe7038e..a0d26ab7 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1838,7 +1838,8 @@ static gboolean event_handle_menu(XEvent *ev) break; if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) && - (f = find_active_menu()) && f->selected == e) + (f = find_active_menu()) && f->selected == e && + e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU) { ObMenuEntryFrame *u = menu_entry_frame_under(ev->xcrossing.x_root, ev->xcrossing.y_root); -- cgit v1.2.3 From e04522772694682ccd11fc465d861b169675312b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 22 Dec 2009 09:31:50 -0500 Subject: Revert "Don't hide submenus immediately when unselecting the parent's entry" This reverts commit 828c095c8b5a2df96a38faaeb8a0df504e68e70f. --- openbox/event.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'openbox/event.c') diff --git a/openbox/event.c b/openbox/event.c index a0d26ab7..41f8eb16 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1841,12 +1841,7 @@ static gboolean event_handle_menu(XEvent *ev) (f = find_active_menu()) && f->selected == e && e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU) { - ObMenuEntryFrame *u = menu_entry_frame_under(ev->xcrossing.x_root, - ev->xcrossing.y_root); - /* if we're just going from one entry in the menu to the next, - don't unselect stuff first */ - if (!u || e->frame != u->frame) - menu_frame_select(e->frame, NULL, FALSE); + menu_frame_select(e->frame, NULL, FALSE); } break; case MotionNotify: -- cgit v1.2.3 From b88cf22bc0084bc611453443b5d8355edbe33bfa Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 4 Jan 2010 15:07:10 -0500 Subject: 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 --- openbox/event.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'openbox/event.c') diff --git a/openbox/event.c b/openbox/event.c index 41f8eb16..c77d968a 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1800,6 +1800,15 @@ static gboolean event_handle_menu_keyboard(XEvent *ev) 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 @@ static gboolean event_handle_menu(XEvent *ev) 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: -- cgit v1.2.3 From f3285a3d0bf118ce0eba0014ea53b11f47d710d6 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 6 Jan 2010 17:30:42 -0500 Subject: Improved menu behaviour Make 'left' key in a menu close it's visible child menu and move to the parent properly. Make clicking on a menu item in a menu close any of its grandchildren and remove focus from its children, effectively focusing the menu item you clicked on. --- openbox/event.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'openbox/event.c') diff --git a/openbox/event.c b/openbox/event.c index c77d968a..ad9dade6 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1700,8 +1700,13 @@ static gboolean event_handle_menu_keyboard(XEvent *ev) else if (ob_keycode_match(keycode, OB_KEY_LEFT)) { /* Left goes to the parent menu */ - if (frame->parent) + if (frame->parent) { + /* remove focus from the child */ menu_frame_select(frame, NULL, TRUE); + /* and put it in the parent */ + menu_frame_select(frame->parent, frame->parent->selected, + TRUE); + } ret = TRUE; } -- cgit v1.2.3