From 4da8af73fa5fc2a866dc4461a2c0737976e75eaf Mon Sep 17 00:00:00 2001 From: rathnor Date: Sun, 7 Sep 2003 14:57:49 +0000 Subject: fix drawing bug when selecting, plus an unnecessary redraw of the submenu when entering parent on active submenu item --- ChangeLog | 3 +++ src/FbTk/Menu.cc | 25 +++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index fdd6e3e..f7a8381 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.6: +*03/09/08: + * Fix when selecting + unneeded submenu redraw on enter+motion (Simon) + Menu.cc *03/09/06: * Added Resize x y as command (Thanks Mathias Gumz) FbCommands.cc/hh, FbCommandFactory.cc 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.37 2003/08/30 01:03:48 fluxgen Exp $ +// $Id: Menu.cc,v 1.38 2003/09/07 14:57:49 rathnor Exp $ //use GNU extensions #ifndef _GNU_SOURCE @@ -524,8 +524,8 @@ void Menu::update(int active_index) { if (title_vis && visible) redrawTitle(); - /* - if (m_need_update) { + + if (active_index >= 0) { for (unsigned int i = 0; visible && i < menuitems.size(); i++) { if (i == (unsigned int)which_sub) { drawItem(i, true, true, false); @@ -536,7 +536,7 @@ void Menu::update(int active_index) { if (m_parent && visible) m_parent->drawSubmenu(m_parent->which_sub); } - */ + menu.window.clear(); renderTransFrame(); @@ -1067,9 +1067,10 @@ void Menu::buttonPressEvent(XButtonEvent &be) { MenuItem *item = menuitems[w]; - if (item->submenu()) - drawSubmenu(w); - else + if (item->submenu()) { + if (!item->submenu()->isVisible()) + drawSubmenu(w); + } else drawItem(w, item->isEnabled(), true, true); } } else { @@ -1109,6 +1110,9 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) { re.y > iy && re.y < (signed) (iy + menu.item_h)) { menuitems[w]->click(re.button, re.time); itemSelected(re.button, w); + // redraw whole menu as enableds for any item + // may have changed + update(w); } } else { drawItem(p, isItemEnabled(p) && (p == which_sub), true, true); @@ -1172,9 +1176,10 @@ void Menu::motionNotifyEvent(XMotionEvent &me) { MenuItem *itmp = menuitems[w]; - if (itmp->submenu()) - drawSubmenu(w); - else + if (itmp->submenu()) { + if (!itmp->submenu()->isVisible()) + drawSubmenu(w); + } else if (itmp->isEnabled()) drawItem(w, true, true, true); } -- cgit v0.11.2