From 20bac0772c548fe1e41eed21d55849bad2f34b2f Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 1 Jun 2002 17:14:32 +0000 Subject: [PATCH] on reconfigure, save all of the open submenus instead of just one, and then reopen them all as best as possible. --- src/Basemenu.hh | 2 +- src/Screen.cc | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Basemenu.hh b/src/Basemenu.hh index 87592ec5..46a8d528 100644 --- a/src/Basemenu.hh +++ b/src/Basemenu.hh @@ -67,7 +67,6 @@ private: Basemenu& operator=(const Basemenu&); protected: - BasemenuItem *find(int index); inline void setTitleVisibility(bool b) { title_vis = b; } inline void setMovable(bool b) { movable = b; } inline void setHideTree(bool h) { hide_tree = h; } @@ -106,6 +105,7 @@ public: inline int getY(void) const { return menu.y; } inline unsigned int getCount(void) { return menuitems.size(); } inline int getCurrentSubmenu(void) const { return which_sub; } + BasemenuItem *find(int index); inline unsigned int getWidth(void) const { return menu.width; } inline unsigned int getHeight(void) const { return menu.height; } diff --git a/src/Screen.cc b/src/Screen.cc index 3b2b4cb9..8bdf9480 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -681,11 +681,31 @@ void BScreen::reconfigure(void) { workspacemenu->reconfigure(); iconmenu->reconfigure(); - int remember_sub = rootmenu->getCurrentSubmenu(); + typedef std::vector SubList; + SubList remember_subs; + + // save the current open menus + Basemenu *menu = rootmenu; + int submenu; + while ((submenu = menu->getCurrentSubmenu()) >= 0) { + remember_subs.push_back(submenu); + menu = menu->find(submenu)->submenu(); + assert(menu); + } + InitMenu(); raiseWindows(0, 0); rootmenu->reconfigure(); - rootmenu->drawSubmenu(remember_sub); + + // reopen the saved menus + menu = rootmenu; + const SubList::iterator subs_end = remember_subs.end(); + for (SubList::iterator it = remember_subs.begin(); it != subs_end; ++it) { + menu->drawSubmenu(*it); + menu = menu->find(*it)->submenu(); + if (! menu) + break; + } configmenu->reconfigure(); -- 2.45.2