diff options
| author | Dana Jansens <danakj@orodu.net> | 2010-11-08 13:07:02 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2011-01-24 14:19:23 -0500 |
| commit | 2e82715a4a53fbab6d359c76aa58581c4087ddaf (patch) | |
| tree | fa0ddedccec06e33456c18704b15a0732e625d90 | |
| parent | f14bf9cac2a6a98e34f81c195d4e4bece5df5f16 (diff) | |
Show the submenu and move focus there with the enter key when the submenu isn't shown yet.
| -rw-r--r-- | openbox/event.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/openbox/event.c b/openbox/event.c index ecd20f92..ba39ef9f 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1859,14 +1859,23 @@ static gboolean event_handle_menu_input(XEvent *ev) ret = TRUE; } - else if (sym == XK_Right) { - /* Right goes to the selected submenu */ - if (frame->selected && - 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); + else if (sym == XK_Right || sym == XK_Return || sym == XK_KP_Enter) + { + /* Right and enter goes to the selected submenu. + Enter executes instead if it's not on a submenu. */ + + if (frame->selected) { + const ObMenuEntryType t = frame->selected->entry->type; + + if (t == OB_MENU_ENTRY_TYPE_SUBMENU) { + /* make sure it is visible */ + menu_frame_select(frame, frame->selected, TRUE); + /* move focus to the child menu */ + menu_frame_select_next(frame->child); + } + else if (sym != XK_Right) { + frame->press_doexec = TRUE; + } } ret = TRUE; } @@ -1891,11 +1900,6 @@ static gboolean event_handle_menu_input(XEvent *ev) ret = TRUE; } - else if (sym == XK_Return || sym == XK_KP_Enter) { - frame->press_doexec = TRUE; - ret = TRUE; - } - /* keyboard accelerator shortcuts. (if it was a valid key) */ else if (frame->entries && (unikey = @@ -1957,9 +1961,7 @@ static gboolean event_handle_menu_input(XEvent *ev) frame->got_press && frame->press_doexec) { - if (frame->child) - menu_frame_select_next(frame->child); - else if (frame->selected) + if (frame->selected) menu_entry_frame_execute(frame->selected, ev->xkey.state); } } |
