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.cc38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 25c000e..3aa88b0 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -447,7 +447,7 @@ void Menu::updateMenu(int active_index) {
447 // the rest can wait until the end 447 // the rest can wait until the end
448 menu.window.resize(new_width, new_height); 448 menu.window.resize(new_width, new_height);
449 449
450 if (!m_visible) 450 if (!isVisible())
451 return; 451 return;
452 452
453 if (menu.frame.alpha() != alpha()) 453 if (menu.frame.alpha() != alpha())
@@ -524,18 +524,17 @@ void Menu::updateMenu(int active_index) {
524 524
525void Menu::show() { 525void Menu::show() {
526 526
527 if (m_visible) 527 if (isVisible())
528 return; 528 return;
529 529
530 if (m_need_update) { 530 m_visible = true;
531 m_visible = true; 531
532 if (m_need_update)
532 updateMenu(); 533 updateMenu();
533 }
534 534
535 menu.window.showSubwindows(); 535 menu.window.showSubwindows();
536 menu.window.show(); 536 menu.window.show();
537 raise(); 537 raise();
538 m_visible = true;
539 538
540 if (! m_parent && shown != this) { 539 if (! m_parent && shown != this) {
541 if (shown && (! shown->m_torn)) 540 if (shown && (! shown->m_torn))
@@ -552,7 +551,6 @@ void Menu::hide() {
552 if (!isVisible()) 551 if (!isVisible())
553 return; 552 return;
554 553
555
556 // if not m_torn and parent is m_visible, go to first parent 554 // if not m_torn and parent is m_visible, go to first parent
557 // and hide it 555 // and hide it
558 if (!m_torn && m_parent && m_parent->isVisible()) { 556 if (!m_torn && m_parent && m_parent->isVisible()) {
@@ -675,10 +673,11 @@ void Menu::drawSubmenu(unsigned int index) {
675 if (index >= menuitems.size()) 673 if (index >= menuitems.size())
676 return; 674 return;
677 675
676
678 MenuItem *item = menuitems[index]; 677 MenuItem *item = menuitems[index];
679 if (item->submenu() && m_visible && (! item->submenu()->isTorn()) && 678 if (item->submenu() && isVisible() && (! item->submenu()->isTorn()) &&
680 item->isEnabled()) { 679 item->isEnabled()) {
681 680
682 if (item->submenu()->m_parent != this) 681 if (item->submenu()->m_parent != this)
683 item->submenu()->m_parent = this; 682 item->submenu()->m_parent = this;
684 683
@@ -951,16 +950,17 @@ void Menu::motionNotifyEvent(XMotionEvent &me) {
951 950
952 if (w == m_active_index) 951 if (w == m_active_index)
953 return; 952 return;
954
955 if (validIndex(m_active_index) && w != m_active_index) {
956 953
957 int old = m_active_index; 954
955
956 if (validIndex(m_active_index) && w != m_active_index) {
957 int old_active_index = m_active_index;
958 m_active_index = -1; 958 m_active_index = -1;
959 MenuItem *item = menuitems[old]; 959 MenuItem *item = menuitems[old_active_index];
960 960
961 if (item != 0) { 961 if (item != 0) {
962 962
963 clearItem(old); 963 clearItem(old_active_index);
964 964
965 if (item->submenu()) { 965 if (item->submenu()) {
966 if (item->submenu()->isVisible() && 966 if (item->submenu()->isVisible() &&
@@ -1006,7 +1006,6 @@ void Menu::motionNotifyEvent(XMotionEvent &me) {
1006 timeout.tv_usec = theme().delayOpen() * 1000; // transformed to usec 1006 timeout.tv_usec = theme().delayOpen() * 1000; // transformed to usec
1007 m_submenu_timer.setTimeout(timeout); 1007 m_submenu_timer.setTimeout(timeout);
1008 m_submenu_timer.start(); 1008 m_submenu_timer.start();
1009
1010 } 1009 }
1011 1010
1012 } else if (isItemSelectable(w)){ 1011 } else if (isItemSelectable(w)){
@@ -1172,6 +1171,7 @@ void Menu::reconfigure() {
1172 1171
1173 1172
1174void Menu::openSubmenu() { 1173void Menu::openSubmenu() {
1174
1175 if (!isVisible() || ! validIndex(m_which_press) || 1175 if (!isVisible() || ! validIndex(m_which_press) ||
1176 ! validIndex(m_which_sbl)) 1176 ! validIndex(m_which_sbl))
1177 return; 1177 return;
@@ -1181,8 +1181,14 @@ void Menu::openSubmenu() {
1181 return; 1181 return;
1182 1182
1183 clearItem(item); 1183 clearItem(item);
1184 if (menuitems[item]->submenu() != 0 && !menuitems[item]->submenu()->isVisible()) 1184
1185 if (menuitems[item]->submenu() != 0) {
1186 // stop hide timer, so it doesnt hides the menu if we
1187 // have the same submenu as the last shown submenu
1188 // (window menu for clients inside workspacemenu for example)
1189 menuitems[item]->submenu()->m_hide_timer.stop();
1185 drawSubmenu(item); 1190 drawSubmenu(item);
1191 }
1186 1192
1187} 1193}
1188 1194