aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Menu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Menu.cc')
-rw-r--r--src/FbTk/Menu.cc28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index cf735d6..8f795ac 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -356,13 +356,6 @@ void Menu::enterSubmenu() {
356 submenu->cycleItems(false); 356 submenu->cycleItems(false);
357} 357}
358 358
359void Menu::enterParent() {
360 internal_hide();
361 // return focus to parent
362 if (parent())
363 parent()->grabInputFocus();
364}
365
366void Menu::disableTitle() { 359void Menu::disableTitle() {
367 setTitleVisibility(false); 360 setTitleVisibility(false);
368} 361}
@@ -583,11 +576,11 @@ void Menu::redrawFrame(FbDrawable &drawable) {
583 576
584} 577}
585 578
586void Menu::internal_hide() { 579void Menu::internal_hide(bool first) {
587 580
588 if (validIndex(m_which_sub)) { 581 if (validIndex(m_which_sub)) {
589 MenuItem *tmp = menuitems[m_which_sub]; 582 MenuItem *tmp = menuitems[m_which_sub];
590 tmp->submenu()->internal_hide(); 583 tmp->submenu()->internal_hide(false);
591 } 584 }
592 585
593 // if we have an active index we need to redraw it 586 // if we have an active index we need to redraw it
@@ -596,12 +589,20 @@ void Menu::internal_hide() {
596 m_active_index = -1; 589 m_active_index = -1;
597 clearItem(old); // clear old area from highlight 590 clearItem(old); // clear old area from highlight
598 591
599 if (shown && shown->menu.window == menu.window) 592 if (shown && shown->menu.window == menu.window) {
600 shown = (Menu *) 0; 593 if (m_parent && m_parent->isVisible())
594 shown = m_parent;
595 else
596 shown = (Menu *) 0;
597 }
601 598
602 m_torn = m_visible = false; 599 m_torn = m_visible = false;
603 m_which_sub = -1; 600 m_which_sub = -1;
604 601
602 if (first && m_parent && m_parent->isVisible() &&
603 s_focused && !s_focused->isVisible())
604 m_parent->grabInputFocus();
605
605 menu.window.hide(); 606 menu.window.hide();
606} 607}
607 608
@@ -1023,7 +1024,7 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1023 break; 1024 break;
1024 case XK_Left: // enter parent if we have one 1025 case XK_Left: // enter parent if we have one
1025 resetTypeAhead(); 1026 resetTypeAhead();
1026 enterParent(); 1027 internal_hide();
1027 break; 1028 break;
1028 case XK_Right: // enter submenu if we have one 1029 case XK_Right: // enter submenu if we have one
1029 resetTypeAhead(); 1030 resetTypeAhead();
@@ -1031,11 +1032,12 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1031 break; 1032 break;
1032 case XK_Escape: // close menu 1033 case XK_Escape: // close menu
1033 m_type_ahead.reset(); 1034 m_type_ahead.reset();
1035 m_torn = false;
1034 hide(); 1036 hide();
1035 break; 1037 break;
1036 case XK_BackSpace: 1038 case XK_BackSpace:
1037 if (m_type_ahead.stringSize() == 0) { 1039 if (m_type_ahead.stringSize() == 0) {
1038 enterParent(); 1040 internal_hide();
1039 break; 1041 break;
1040 } 1042 }
1041 1043