summaryrefslogtreecommitdiff
path: root/openbox/event.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-01-04 15:07:10 -0500
committerDana Jansens <danakj@orodu.net>2010-01-06 17:13:03 -0500
commitb88cf22bc0084bc611453443b5d8355edbe33bfa (patch)
tree65814bef5a14262548df071664d03fcbfb2c775e /openbox/event.c
parent8968b38338529cd0a7f2ad08a7c2e0d2e76b6e62 (diff)
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
Diffstat (limited to 'openbox/event.c')
-rw-r--r--openbox/event.c23
1 files changed, 19 insertions, 4 deletions
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: