aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Menu.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index f4a3fe8..163fc83 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -352,21 +352,10 @@ void Menu::enterSubmenu() {
352} 352}
353 353
354void Menu::enterParent() { 354void Menu::enterParent() {
355 if (parent() == 0) 355 internal_hide();
356 return;
357
358 if (validIndex(m_active_index)) {
359 Menu *submenu = menuitems[m_active_index]->submenu();
360 if (submenu)
361 submenu->internal_hide();
362 }
363
364 m_active_index = -1;
365 // hide self
366 m_visible = false;
367 menu.window.hide();
368 // return focus to parent 356 // return focus to parent
369 parent()->grabInputFocus(); 357 if (parent())
358 parent()->grabInputFocus();
370} 359}
371 360
372void Menu::disableTitle() { 361void Menu::disableTitle() {
@@ -1038,6 +1027,11 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1038 hide(); 1027 hide();
1039 break; 1028 break;
1040 case XK_BackSpace: 1029 case XK_BackSpace:
1030 if (m_type_ahead.stringSize() == 0) {
1031 enterParent();
1032 break;
1033 }
1034
1041 m_type_ahead.putBackSpace(); 1035 m_type_ahead.putBackSpace();
1042 drawTypeAheadItems(); 1036 drawTypeAheadItems();
1043 break; 1037 break;
@@ -1059,8 +1053,14 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1059 break; 1053 break;
1060 case XK_Tab: 1054 case XK_Tab:
1061 case XK_ISO_Left_Tab: 1055 case XK_ISO_Left_Tab:
1062 m_type_ahead.seek(); 1056 if (validIndex(m_active_index) && isItemEnabled(m_active_index) &&
1063 cycleItems((bool)(event.state & ShiftMask)); 1057 menuitems[m_active_index]->submenu() && m_matches.size() == 1) {
1058 enterSubmenu();
1059 m_type_ahead.reset();
1060 } else {
1061 m_type_ahead.seek();
1062 cycleItems((bool)(event.state & ShiftMask));
1063 }
1064 drawTypeAheadItems(); 1064 drawTypeAheadItems();
1065 break; 1065 break;
1066 default: 1066 default: