From 2a9e8e27826f57068c32c159c9b5a16824dd04b1 Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 15 Jan 2007 18:53:45 +0000 Subject: fix rootmenu disappearing on reconfigure -- I can't tell that the code I removed here did anything useful; it's probably a remnant of an old menu implementation --- ChangeLog | 3 +++ src/Screen.cc | 52 +++++++++------------------------------------------- 2 files changed, 12 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60563ab..3393cb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0rc3: +*07/01/15: + * Fix rootmenu disappearing on reconfigure (Mark) + Screen.cc *07/01/14: * Stay on the same workspace after a restart (Mark) Screen.cc diff --git a/src/Screen.cc b/src/Screen.cc index 252df9c..ab1d718 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -862,6 +862,15 @@ void BScreen::reconfigure() { } } + // if timestamp hasn't changed, then just a reconfigure is fine + // and that seems to happen somewhere else, anyway + if (fluxbox->menuTimestampsChanged()) { + // all bets are off, so just hide the menu and reset the filenames + fluxbox->clearMenuFilenames(); + m_rootmenu->hide(); + rereadMenu(); + } + //reconfigure menus m_workspacemenu->reconfigure(); m_configmenu->reconfigure(); @@ -869,49 +878,6 @@ void BScreen::reconfigure() { m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber())); m_windowmenu->setInternalMenu(); - // We need to check to see if the timestamps - // changed before we actually can restore the menus - // in the same way, since we can't really say if - // any submenu is in the same place as before if the - // menu changed. - - // if timestamp changed then no restoring - bool restore_menus = ! fluxbox->menuTimestampsChanged(); - - // destroy old timestamps - fluxbox->clearMenuFilenames(); - - // save submenu index so we can restore them afterwards - vector remember_sub; - if (restore_menus) { - FbTk::Menu *menu = m_rootmenu.get(); - while (menu) { - int r = menu->currentSubmenu(); - if (r < 0) break; - remember_sub.push_back(r); - menu = menu->find(r)->submenu(); - } - } - - rereadMenu(); - - if (restore_menus) { - // restore submenus, no timestamp changed - FbTk::Menu *menu = m_rootmenu.get(); - for (size_t i = 0; i < remember_sub.size(); i++ ) { - int sub = remember_sub[i]; - if (!menu || sub < 0) - break; - FbTk::MenuItem *item = menu->find(sub); - if (item != 0) { - menu->drawSubmenu(sub); - menu = item->submenu(); - } else - menu = 0; - - } - } - // reconfigure workspaces for_each(m_workspaces_list.begin(), m_workspaces_list.end(), -- cgit v0.11.2