summaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc20
-rw-r--r--src/FbTk/Menu.hh2
2 files changed, 14 insertions, 8 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index cf735d6..491ad76 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -358,9 +358,6 @@ void Menu::enterSubmenu() {
358 358
359void Menu::enterParent() { 359void Menu::enterParent() {
360 internal_hide(); 360 internal_hide();
361 // return focus to parent
362 if (parent())
363 parent()->grabInputFocus();
364} 361}
365 362
366void Menu::disableTitle() { 363void Menu::disableTitle() {
@@ -583,11 +580,11 @@ void Menu::redrawFrame(FbDrawable &drawable) {
583 580
584} 581}
585 582
586void Menu::internal_hide() { 583void Menu::internal_hide(bool first) {
587 584
588 if (validIndex(m_which_sub)) { 585 if (validIndex(m_which_sub)) {
589 MenuItem *tmp = menuitems[m_which_sub]; 586 MenuItem *tmp = menuitems[m_which_sub];
590 tmp->submenu()->internal_hide(); 587 tmp->submenu()->internal_hide(false);
591 } 588 }
592 589
593 // if we have an active index we need to redraw it 590 // if we have an active index we need to redraw it
@@ -596,12 +593,20 @@ void Menu::internal_hide() {
596 m_active_index = -1; 593 m_active_index = -1;
597 clearItem(old); // clear old area from highlight 594 clearItem(old); // clear old area from highlight
598 595
599 if (shown && shown->menu.window == menu.window) 596 if (shown && shown->menu.window == menu.window) {
600 shown = (Menu *) 0; 597 if (m_parent && m_parent->isVisible())
598 shown = m_parent;
599 else
600 shown = (Menu *) 0;
601 }
601 602
602 m_torn = m_visible = false; 603 m_torn = m_visible = false;
603 m_which_sub = -1; 604 m_which_sub = -1;
604 605
606 if (first && m_parent && m_parent->isVisible() &&
607 s_focused && !s_focused->isVisible())
608 m_parent->grabInputFocus();
609
605 menu.window.hide(); 610 menu.window.hide();
606} 611}
607 612
@@ -1031,6 +1036,7 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1031 break; 1036 break;
1032 case XK_Escape: // close menu 1037 case XK_Escape: // close menu
1033 m_type_ahead.reset(); 1038 m_type_ahead.reset();
1039 m_torn = false;
1034 hide(); 1040 hide();
1035 break; 1041 break;
1036 case XK_BackSpace: 1042 case XK_BackSpace:
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index e6c249d..576c9f3 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -191,7 +191,7 @@ protected:
191 virtual void redrawTitle(FbDrawable &pm); 191 virtual void redrawTitle(FbDrawable &pm);
192 virtual void redrawFrame(FbDrawable &pm); 192 virtual void redrawFrame(FbDrawable &pm);
193 193
194 virtual void internal_hide(); 194 virtual void internal_hide(bool first = true);
195 195
196 void update(FbTk::Subject *); 196 void update(FbTk::Subject *);
197 197