- /* keyboard accelerator shortcuts. (allow controlmask) */
- else if ((ev->xkey.state & ~ControlMask) == 0 &&
- /* was it a valid key? */
- unikey != 0 &&
- /* don't bother if the menu is empty. */
- frame->entries)
- {
- 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;
+ Allow ControlMask only, and don't bother if the menu is empty */
+ else if ((ev->xkey.state & ~ControlMask) == 0 && frame->entries) {
+ if (keycode == ob_keycode(OB_KEY_RETURN)) {
+ /* Enter runs the active item or goes into the submenu.
+ Control-Enter runs it without closing the menu. */
+ if (frame->child)
+ menu_frame_select_next(frame->child);
+ else if (frame->selected)
+ menu_entry_frame_execute(frame->selected, state);
+
+ ret = TRUE;