diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-07-25 15:47:42 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2016-07-30 16:22:49 (GMT) |
commit | bccb185cd9e4efd1db2e5244ba1a1956f750f9cd (patch) | |
tree | 69a1756061719eaf0764479942f1139f8694d2e5 | |
parent | 6defd9391d16fe99422d12c2ab5475929087c11f (diff) | |
download | fluxbox-bccb185cd9e4efd1db2e5244ba1a1956f750f9cd.zip fluxbox-bccb185cd9e4efd1db2e5244ba1a1956f750f9cd.tar.bz2 |
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
-rw-r--r-- | src/FbCommands.cc | 1 | ||||
-rw-r--r-- | src/Screen.hh | 1 | ||||
-rw-r--r-- | src/fluxbox.cc | 30 | ||||
-rw-r--r-- | src/fluxbox.hh | 1 |
4 files changed, 33 insertions, 0 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 89b8eaf..bc4b1e9 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc | |||
@@ -250,6 +250,7 @@ SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) { | |||
250 | void SetStyleCmd::execute() { | 250 | void SetStyleCmd::execute() { |
251 | if (FbTk::ThemeManager::instance().load(m_filename, | 251 | if (FbTk::ThemeManager::instance().load(m_filename, |
252 | Fluxbox::instance()->getStyleOverlayFilename())) { | 252 | Fluxbox::instance()->getStyleOverlayFilename())) { |
253 | Fluxbox::instance()->reconfigThemes(); | ||
253 | Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); | 254 | Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); |
254 | Fluxbox::instance()->save_rc(); | 255 | Fluxbox::instance()->save_rc(); |
255 | } | 256 | } |
diff --git a/src/Screen.hh b/src/Screen.hh index 1aeac91..ae279f3 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -248,6 +248,7 @@ public: | |||
248 | FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() { return *m_menutheme.get(); } | 248 | FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() { return *m_menutheme.get(); } |
249 | const FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() const { return *m_menutheme.get(); } | 249 | const FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() const { return *m_menutheme.get(); } |
250 | const FbTk::ThemeProxy<RootTheme> &rootTheme() const { return *m_root_theme.get(); } | 250 | const FbTk::ThemeProxy<RootTheme> &rootTheme() const { return *m_root_theme.get(); } |
251 | FbTk::ThemeProxy<RootTheme> &rootTheme() { return *m_root_theme.get(); } | ||
251 | 252 | ||
252 | FbTk::ThemeProxy<WinButtonTheme> &focusedWinButtonTheme() { return *m_focused_winbutton_theme.get(); } | 253 | FbTk::ThemeProxy<WinButtonTheme> &focusedWinButtonTheme() { return *m_focused_winbutton_theme.get(); } |
253 | const FbTk::ThemeProxy<WinButtonTheme> &focusedWinButtonTheme() const { return *m_focused_winbutton_theme.get(); } | 254 | const FbTk::ThemeProxy<WinButtonTheme> &focusedWinButtonTheme() const { return *m_focused_winbutton_theme.get(); } |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 492b64d..3907d29 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "FbTk/Compose.hh" | 56 | #include "FbTk/Compose.hh" |
57 | #include "FbTk/KeyUtil.hh" | 57 | #include "FbTk/KeyUtil.hh" |
58 | #include "FbTk/MemFun.hh" | 58 | #include "FbTk/MemFun.hh" |
59 | #include "FbTk/MenuItem.hh" | ||
59 | 60 | ||
60 | #ifdef USE_EWMH | 61 | #ifdef USE_EWMH |
61 | #include "Ewmh.hh" | 62 | #include "Ewmh.hh" |
@@ -1261,6 +1262,35 @@ void Fluxbox::reconfigure() { | |||
1261 | m_reconfig_timer.start(); | 1262 | m_reconfig_timer.start(); |
1262 | } | 1263 | } |
1263 | 1264 | ||
1265 | // TODO: once c++11 is required, make this a local var and a closure | ||
1266 | static std::list<FbTk::Menu*> s_seenMenus; | ||
1267 | static void rec_reconfigMenu(FbTk::Menu *menu) { | ||
1268 | if (!menu || std::find(s_seenMenus.begin(), s_seenMenus.end(), menu) != s_seenMenus.end()) | ||
1269 | return; | ||
1270 | s_seenMenus.push_back(menu); | ||
1271 | menu->reconfigure(); | ||
1272 | for (size_t i = 0; i < menu->numberOfItems(); ++i) | ||
1273 | rec_reconfigMenu(menu->find(i)->submenu()); | ||
1274 | } | ||
1275 | |||
1276 | |||
1277 | void Fluxbox::reconfigThemes() { | ||
1278 | for (ScreenList::iterator it = m_screens.begin(), end = m_screens.end(); it != end; ++it) { | ||
1279 | (*it)->focusedWinFrameTheme()->reconfigTheme(); | ||
1280 | (*it)->unfocusedWinFrameTheme()->reconfigTheme(); | ||
1281 | (*it)->menuTheme()->reconfigTheme(); | ||
1282 | (*it)->rootTheme()->reconfigTheme(); | ||
1283 | (*it)->focusedWinButtonTheme()->reconfigTheme(); | ||
1284 | (*it)->unfocusedWinButtonTheme()->reconfigTheme(); | ||
1285 | (*it)->pressedWinButtonTheme()->reconfigTheme(); | ||
1286 | |||
1287 | rec_reconfigMenu(&(*it)->rootMenu()); | ||
1288 | rec_reconfigMenu(&(*it)->configMenu()); | ||
1289 | rec_reconfigMenu(&(*it)->windowMenu()); | ||
1290 | rec_reconfigMenu(&(*it)->workspaceMenu()); | ||
1291 | s_seenMenus.clear(); | ||
1292 | } | ||
1293 | } | ||
1264 | 1294 | ||
1265 | void Fluxbox::real_reconfigure() { | 1295 | void Fluxbox::real_reconfigure() { |
1266 | 1296 | ||
diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 2d2e670..86c3103 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh | |||
@@ -151,6 +151,7 @@ public: | |||
151 | void removeGroupSearch(Window win); | 151 | void removeGroupSearch(Window win); |
152 | void restart(const char *command = 0); | 152 | void restart(const char *command = 0); |
153 | void reconfigure(); | 153 | void reconfigure(); |
154 | void reconfigThemes(); | ||
154 | 155 | ||
155 | /// todo, remove this. just temporary | 156 | /// todo, remove this. just temporary |
156 | void updateFrameExtents(FluxboxWindow &win); | 157 | void updateFrameExtents(FluxboxWindow &win); |