all repos — fluxbox @ bccb185cd9e4efd1db2e5244ba1a1956f750f9cd

custom fork of the fluxbox windowmanager

reconfigTheme's on loading a new style

Also reconfigure menus (recursively) on style load
The most critical call is the shape update - the menus often become
cut-off, preventing mouse interaction with lower items, but also colors
are not applied correctly to menus w/o updating them.

BUG 1022 is most likely this and only a misinterpretation (for the
mentioned items are those with lacking color updates on style updates)

BUG: 1146
BUG: 1017
CCBUG: 1022
Thomas Lübking thomas.luebking@gmail.com
commit

bccb185cd9e4efd1db2e5244ba1a1956f750f9cd

parent

6defd9391d16fe99422d12c2ab5475929087c11f

4 files changed, 33 insertions(+), 0 deletions(-)

jump to
M src/FbCommands.ccsrc/FbCommands.cc

@@ -250,6 +250,7 @@

void SetStyleCmd::execute() { if (FbTk::ThemeManager::instance().load(m_filename, Fluxbox::instance()->getStyleOverlayFilename())) { + Fluxbox::instance()->reconfigThemes(); Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); Fluxbox::instance()->save_rc(); }
M src/Screen.hhsrc/Screen.hh

@@ -248,6 +248,7 @@

FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() { return *m_menutheme.get(); } const FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() const { return *m_menutheme.get(); } const FbTk::ThemeProxy<RootTheme> &rootTheme() const { return *m_root_theme.get(); } + FbTk::ThemeProxy<RootTheme> &rootTheme() { return *m_root_theme.get(); } FbTk::ThemeProxy<WinButtonTheme> &focusedWinButtonTheme() { return *m_focused_winbutton_theme.get(); } const FbTk::ThemeProxy<WinButtonTheme> &focusedWinButtonTheme() const { return *m_focused_winbutton_theme.get(); }
M src/fluxbox.ccsrc/fluxbox.cc

@@ -56,6 +56,7 @@ #include "FbTk/Select2nd.hh"

#include "FbTk/Compose.hh" #include "FbTk/KeyUtil.hh" #include "FbTk/MemFun.hh" +#include "FbTk/MenuItem.hh" #ifdef USE_EWMH #include "Ewmh.hh"

@@ -1261,6 +1262,35 @@ m_reconfigure_wait = true;

m_reconfig_timer.start(); } +// TODO: once c++11 is required, make this a local var and a closure +static std::list<FbTk::Menu*> s_seenMenus; +static void rec_reconfigMenu(FbTk::Menu *menu) { + if (!menu || std::find(s_seenMenus.begin(), s_seenMenus.end(), menu) != s_seenMenus.end()) + return; + s_seenMenus.push_back(menu); + menu->reconfigure(); + for (size_t i = 0; i < menu->numberOfItems(); ++i) + rec_reconfigMenu(menu->find(i)->submenu()); +} + + +void Fluxbox::reconfigThemes() { + for (ScreenList::iterator it = m_screens.begin(), end = m_screens.end(); it != end; ++it) { + (*it)->focusedWinFrameTheme()->reconfigTheme(); + (*it)->unfocusedWinFrameTheme()->reconfigTheme(); + (*it)->menuTheme()->reconfigTheme(); + (*it)->rootTheme()->reconfigTheme(); + (*it)->focusedWinButtonTheme()->reconfigTheme(); + (*it)->unfocusedWinButtonTheme()->reconfigTheme(); + (*it)->pressedWinButtonTheme()->reconfigTheme(); + + rec_reconfigMenu(&(*it)->rootMenu()); + rec_reconfigMenu(&(*it)->configMenu()); + rec_reconfigMenu(&(*it)->windowMenu()); + rec_reconfigMenu(&(*it)->workspaceMenu()); + s_seenMenus.clear(); + } +} void Fluxbox::real_reconfigure() {
M src/fluxbox.hhsrc/fluxbox.hh

@@ -151,6 +151,7 @@ void removeWindowSearchGroup(Window win);

void removeGroupSearch(Window win); void restart(const char *command = 0); void reconfigure(); + void reconfigThemes(); /// todo, remove this. just temporary void updateFrameExtents(FluxboxWindow &win);