aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-09-07 14:57:49 (GMT)
committerrathnor <rathnor>2003-09-07 14:57:49 (GMT)
commit4da8af73fa5fc2a866dc4461a2c0737976e75eaf (patch)
treede16addf31a69bc7034ba5047645a89aea7bfca5 /src
parent8a85867a6966f69c2fc112456c88c8ef7baaf951 (diff)
downloadfluxbox_pavel-4da8af73fa5fc2a866dc4461a2c0737976e75eaf.zip
fluxbox_pavel-4da8af73fa5fc2a866dc4461a2c0737976e75eaf.tar.bz2
fix drawing bug when selecting, plus an unnecessary redraw of the
submenu when entering parent on active submenu item
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Menu.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 7800cd3..199fa77 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Menu.cc,v 1.37 2003/08/30 01:03:48 fluxgen Exp $ 25// $Id: Menu.cc,v 1.38 2003/09/07 14:57:49 rathnor Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -524,8 +524,8 @@ void Menu::update(int active_index) {
524 524
525 if (title_vis && visible) 525 if (title_vis && visible)
526 redrawTitle(); 526 redrawTitle();
527 /* 527
528 if (m_need_update) { 528 if (active_index >= 0) {
529 for (unsigned int i = 0; visible && i < menuitems.size(); i++) { 529 for (unsigned int i = 0; visible && i < menuitems.size(); i++) {
530 if (i == (unsigned int)which_sub) { 530 if (i == (unsigned int)which_sub) {
531 drawItem(i, true, true, false); 531 drawItem(i, true, true, false);
@@ -536,7 +536,7 @@ void Menu::update(int active_index) {
536 if (m_parent && visible) 536 if (m_parent && visible)
537 m_parent->drawSubmenu(m_parent->which_sub); 537 m_parent->drawSubmenu(m_parent->which_sub);
538 } 538 }
539 */ 539
540 menu.window.clear(); 540 menu.window.clear();
541 renderTransFrame(); 541 renderTransFrame();
542 542
@@ -1067,9 +1067,10 @@ void Menu::buttonPressEvent(XButtonEvent &be) {
1067 1067
1068 MenuItem *item = menuitems[w]; 1068 MenuItem *item = menuitems[w];
1069 1069
1070 if (item->submenu()) 1070 if (item->submenu()) {
1071 drawSubmenu(w); 1071 if (!item->submenu()->isVisible())
1072 else 1072 drawSubmenu(w);
1073 } else
1073 drawItem(w, item->isEnabled(), true, true); 1074 drawItem(w, item->isEnabled(), true, true);
1074 } 1075 }
1075 } else { 1076 } else {
@@ -1109,6 +1110,9 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) {
1109 re.y > iy && re.y < (signed) (iy + menu.item_h)) { 1110 re.y > iy && re.y < (signed) (iy + menu.item_h)) {
1110 menuitems[w]->click(re.button, re.time); 1111 menuitems[w]->click(re.button, re.time);
1111 itemSelected(re.button, w); 1112 itemSelected(re.button, w);
1113 // redraw whole menu as enableds for any item
1114 // may have changed
1115 update(w);
1112 } 1116 }
1113 } else { 1117 } else {
1114 drawItem(p, isItemEnabled(p) && (p == which_sub), true, true); 1118 drawItem(p, isItemEnabled(p) && (p == which_sub), true, true);
@@ -1172,9 +1176,10 @@ void Menu::motionNotifyEvent(XMotionEvent &me) {
1172 1176
1173 MenuItem *itmp = menuitems[w]; 1177 MenuItem *itmp = menuitems[w];
1174 1178
1175 if (itmp->submenu()) 1179 if (itmp->submenu()) {
1176 drawSubmenu(w); 1180 if (!itmp->submenu()->isVisible())
1177 else 1181 drawSubmenu(w);
1182 } else
1178 if (itmp->isEnabled()) 1183 if (itmp->isEnabled())
1179 drawItem(w, true, true, true); 1184 drawItem(w, true, true, true);
1180 } 1185 }