all repos — fluxbox @ 734b99611b0937a94407df0536fcdcd7cad45d13

custom fork of the fluxbox windowmanager

fix menu redrawing, particularly so that selecting an option will update
properly upon selection, rather than subsequent movement
rathnor rathnor
commit

734b99611b0937a94407df0536fcdcd7cad45d13

parent

1741ac072dd6516b4dcfdf6dbe9099a335c7bc7d

4 files changed, 28 insertions(+), 21 deletions(-)

jump to
M BUGSBUGS

@@ -35,9 +35,6 @@ * Remember-patch grouping can change order on each restart. Need to

turn off remember functionality when restarting (only use it for first instance). - * If you toggle a setting in the configuration-menu the notch does not - indicate the change until you point to another option. - Other TODO: FAQ items for:

@@ -76,6 +73,10 @@ * Remember menu sometimes isn't present in window menu. Probably need

to add a signal for menu reconfigures (Screen::setupWindowActions) => Fixed, added "ExtraMenus" for windows that get added whenever it is rebuilt. + + * If you toggle a setting in the configuration-menu the notch does not + indicate the change until you point to another option. + => Fixed ------------------------------ Core dumps and notes
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.5: *03/07/20: + * Fix menu [re]drawing, particularly when selecting options (Simon) + Menu.hh/cc * Fix disappearing Remember menu, plus titles of sub-window menus -> can now use addExtraMenus for windows in extensions (Simon) Menu.hh/cc Window.hh/cc Screen.hh/cc Remember.cc
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.30 2003/07/20 08:12:36 rathnor Exp $ +// $Id: Menu.cc,v 1.31 2003/07/20 10:41:56 rathnor Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -384,7 +384,7 @@ void Menu::enableTitle() {

setTitleVisibility(true); } -void Menu::update() { +void Menu::update(int active_index) { if (menu.bevel_w > 10) // clamp to "normal" size menu.bevel_w = 10;

@@ -539,10 +539,10 @@

if (m_need_update) { for (unsigned int i = 0; visible && i < menuitems.size(); i++) { if (i == (unsigned int)which_sub) { - drawItem(i, true, false, false); + drawItem(i, true, true, false); drawSubmenu(i); } else - drawItem(i, false, false, false); + drawItem(i, (i == active_index), true, false); } if (m_parent && visible)

@@ -977,7 +977,6 @@ }

XSync(m_display, False); } - void Menu::setLabel(const char *labelstr) { //make sure we don't send 0 to std::string

@@ -1095,16 +1094,16 @@ w = (sbl * menu.persub) + i,

p = (which_sbl * menu.persub) + which_press; if (w < static_cast<int>(menuitems.size()) && w >= 0) { - drawItem(p, (p == which_sub), true, true); - if (p == w && isItemEnabled(w)) { if (re.x > ix && re.x < (signed) (ix + menu.item_w) && re.y > iy && re.y < (signed) (iy + menu.item_h)) { menuitems[w]->click(re.button, re.time); itemSelected(re.button, w); - - update(); // update any changed item + m_need_update = true; + update(w); // update any changed item } + } else { + drawItem(p, isItemEnabled(p) && (p == which_sub), true, true); } } else drawItem(p, false, true, true);

@@ -1147,12 +1146,15 @@ if (which_press != -1 && which_sbl != -1) {

int p = which_sbl * menu.persub + which_press; MenuItem *item = menuitems[p]; - drawItem(p, false, true, true); - if (item->submenu()) { - if (item->submenu()->isVisible() && - (! item->submenu()->isTorn())) { - item->submenu()->internal_hide(); - which_sub = -1; + // don't redraw disabled items on enter/leave + if (item->isEnabled()) { + drawItem(p, false, true, true); + if (item->submenu()) { + if (item->submenu()->isVisible() && + (! item->submenu()->isTorn())) { + item->submenu()->internal_hide(); + which_sub = -1; + } } } }

@@ -1165,7 +1167,8 @@

if (itmp->submenu()) drawSubmenu(w); else - drawItem(w, itmp->isEnabled(), true, true); + if (itmp->isEnabled()) + drawItem(w, true, true, true); } } }

@@ -1305,6 +1308,7 @@ // send fake button 1 click

if (which_press >= 0 && which_press < menuitems.size()) { menuitems[which_press]->click(1, event.time); itemSelected(1, which_press); + m_need_update = true; update(); } break;
M src/FbTk/Menu.hhsrc/FbTk/Menu.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.hh,v 1.20 2003/07/20 08:12:36 rathnor Exp $ +// $Id: Menu.hh,v 1.21 2003/07/20 10:41:56 rathnor Exp $ #ifndef FBTK_MENU_HH #define FBTK_MENU_HH

@@ -115,7 +115,7 @@ /// set label string

void setLabel(const char *labelstr); /// move menu to x,y void move(int x, int y); - void update(); + void update(int active_index = -1); void setItemSelected(unsigned int index, bool val); void setItemEnabled(unsigned int index, bool val); inline void setMinimumSublevels(int m) { menu.minsub = m; }