X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fevent.c;h=2ebea6bacd7ceea6b02ae7db4a9fde50d2875acf;hb=bafd9e9edcff0e18a03ef6f4e73d673e12a7c7ed;hp=881c9f8fa935d3e09c8b1179bd0463993a4232cf;hpb=d55f4b41c6ebf00e36a5e91ddc962a753f6c9ef8;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 881c9f8f..2ebea6ba 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1700,14 +1700,23 @@ 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; } else if (ob_keycode_match(keycode, OB_KEY_RIGHT)) { /* Right goes to the selected submenu */ - if (frame->child) menu_frame_select_next(frame->child); + if (frame->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { + /* make sure it is visible */ + menu_frame_select(frame, frame->selected, TRUE); + menu_frame_select_next(frame->child); + } ret = TRUE; } @@ -1720,6 +1729,16 @@ static gboolean event_handle_menu_keyboard(XEvent *ev) menu_frame_select_next(frame); ret = TRUE; } + + else if (ob_keycode_match(keycode, OB_KEY_HOME)) { + menu_frame_select_first(frame); + ret = TRUE; + } + + else if (ob_keycode_match(keycode, OB_KEY_END)) { + menu_frame_select_last(frame); + ret = TRUE; + } } /* Use KeyRelease events for running things so that the key release doesn't @@ -1800,6 +1819,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 +1865,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: @@ -1913,9 +1947,6 @@ static gboolean focus_delay_func(gpointer data) ObFocusDelayData *d = data; Time old = event_curtime; - /* don't move focus and kill the menu or the move/resize */ - if (menu_frame_visible || moveresize_in_progress) return FALSE; - event_curtime = d->time; event_curserial = d->serial; if (client_focus(d->client) && config_focus_raise)