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
This commit is contained in:
Thomas Lübking 2016-07-25 17:47:42 +02:00 committed by Mathias Gumz
parent 6defd9391d
commit bccb185cd9
4 changed files with 33 additions and 0 deletions

View file

@ -250,6 +250,7 @@ SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) {
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();
}

View file

@ -248,6 +248,7 @@ public:
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(); }

View file

@ -56,6 +56,7 @@
#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 @@ void Fluxbox::reconfigure() {
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() {

View file

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