+
+ else if (sym == XK_Up) {
+ menu_frame_select_previous(frame);
+ ret = TRUE;
+ }
+
+ else if (sym == XK_Down) {
+ menu_frame_select_next(frame);
+ ret = TRUE;
+ }
+
+ else if (sym == XK_Home) {
+ menu_frame_select_first(frame);
+ ret = TRUE;
+ }
+
+ else if (sym == XK_End) {
+ menu_frame_select_last(frame);
+ ret = TRUE;
+ }
+
+ /* keyboard accelerator shortcuts. (if it was a valid key) */
+ else if (frame->entries &&
+ (unikey =
+ obt_keyboard_keypress_to_unichar(menu_frame_ic(frame),
+ ev)))
+ {
+ GList *start;
+ GList *it;
+ ObMenuEntryFrame *found = NULL;
+ guint num_found = 0;
+
+ /* start after the selected one */
+ start = frame->entries;
+ if (frame->selected) {
+ for (it = start; frame->selected != it->data;
+ it = g_list_next(it))
+ g_assert(it != NULL); /* nothing was selected? */
+ /* next with wraparound */
+ start = g_list_next(it);
+ if (start == NULL) start = frame->entries;
+ }
+
+ it = start;
+ do {
+ ObMenuEntryFrame *e = it->data;
+ gunichar entrykey = 0;
+
+ if (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL)
+ entrykey = e->entry->data.normal.shortcut;
+ else if (e->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)
+ entrykey = e->entry->data.submenu.submenu->shortcut;
+
+ if (unikey == entrykey) {
+ if (found == NULL) found = e;
+ ++num_found;
+ }
+
+ /* next with wraparound */
+ it = g_list_next(it);
+ if (it == NULL) it = frame->entries;
+ } while (it != start);
+
+ if (found) {
+ menu_frame_select(frame, found, TRUE);
+
+ if (num_found == 1) {
+ if (found->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) {
+ /* move focus to the child menu */
+ menu_frame_select_next(frame->child);
+ }
+ else {
+ frame->press_doexec = TRUE;
+ }
+ }
+ ret = TRUE;
+ }
+ }
+ }
+
+ /* Use KeyRelease events for running things so that the key release
+ doesn't get sent to the focused application.
+
+ Allow ControlMask only, and don't bother if the menu is empty */
+ else if (ev->type == KeyRelease && (mods & ~ControlMask) == 0) {
+ if (frame->press_keycode == ev->xkey.keycode &&
+ frame->got_press &&
+ frame->press_doexec)
+ {
+ if (frame->selected)
+ menu_entry_frame_execute(frame->selected, ev->xkey.state);
+ }
+ }