load style before loading theme objects, remove duplicate theme load
@@ -39,6 +39,7 @@ m_scale(*this, name + ".scale", alt_name + ".Scale"),
m_name(name), m_fallbackname(extra_fallback), m_altfallbackname(extra_fallback_alt) { + FbTk::ThemeManager::instance().loadTheme(*this); } bool ButtonTheme::fallback(FbTk::ThemeItem_base &item) {
@@ -98,6 +98,7 @@ h_text_gc.setForeground(*h_text);
d_text_gc.setForeground(*d_text); hilite_gc.setForeground(hilite->color()); + ThemeManager::instance().loadTheme(*this); } MenuTheme::~MenuTheme() {
@@ -97,12 +97,14 @@
// valid screen num? if (m_max_screens < tm.screenNum() || tm.screenNum() < 0) return false; - // TODO: use find and return false if it's already there - // instead of unique - m_themes[tm.screenNum()].push_back(&tm); - m_themes[tm.screenNum()].unique(); - return true; + ThemeList::const_iterator it = m_themes[tm.screenNum()].begin(), + it_end = m_themes[tm.screenNum()].end(); + if (std::find(it, it_end, &tm) == it_end) { + m_themes[tm.screenNum()].push_back(&tm); + return true; + } + return false; } bool ThemeManager::unregisterTheme(Theme &tm) {
@@ -74,6 +74,7 @@ m_cursor_top_side = XCreateFontCursor(disp, XC_top_side);
m_cursor_right_side = XCreateFontCursor(disp, XC_right_side); m_cursor_bottom_side = XCreateFontCursor(disp, XC_bottom_side); + FbTk::ThemeManager::instance().loadTheme(*this); reconfigTheme(); }
@@ -55,4 +55,5 @@ } // end namespace FbTk
MenuTheme::MenuTheme(int screen_num):FbTk::MenuTheme(screen_num), m_shapeplace(*this, "menu.roundCorners", "Menu.RoundCorners") { *m_shapeplace = Shape::NONE; + FbTk::ThemeManager::instance().loadTheme(*this); }
@@ -159,6 +159,7 @@ m_opgc.setForeground(WhitePixel(disp, screenNum())^BlackPixel(disp, screenNum()));
m_opgc.setFunction(GXxor); m_opgc.setSubwindowMode(IncludeInferiors); m_opgc.setLineAttributes(1, LineSolid, CapNotLast, JoinMiter); + FbTk::ThemeManager::instance().loadTheme(*this); } RootTheme::~RootTheme() {
@@ -525,12 +525,6 @@ // we need to load win frame theme before we create any fluxbox window
// and after we've load the resources // else we get some bad handle/grip height/width // FbTk::ThemeManager::instance().loadTheme(*m_windowtheme.get()); - //!! TODO: For some strange reason we must load everything, - // else the focus label doesn't get updated - // This must be fixed in the future. - FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(), - fluxbox->getStyleOverlayFilename(), - m_root_theme->screenNum()); m_root_theme->setLineAttributes(*resource.gc_line_width, *resource.gc_line_style, *resource.gc_cap_style,
@@ -34,6 +34,7 @@ m_bevel_width.setDefaultValue();
m_border_color.setDefaultValue(); // default texture type m_texture->setType(FbTk::Texture::SOLID); + FbTk::ThemeManager::instance().loadTheme(*this); }
@@ -31,6 +31,7 @@ m_texture(*this, name, altname),
m_border(*this, name, altname), m_alpha(255) { + FbTk::ThemeManager::instance().loadTheme(*this); } ToolTheme::~ToolTheme() {
@@ -42,6 +42,7 @@ *m_bevel_width = 0;
*m_shape = false; *m_height = 0; *m_button_size = -1; + FbTk::ThemeManager::instance().loadTheme(*this); } ToolbarTheme::~ToolbarTheme() {
@@ -58,6 +58,7 @@ m_stuck_pm(*this, "window.stuck.pixmap", "Window.Stuck.Pixmap"),
m_stuck_unfocus_pm(*this, "window.stuck.unfocus.pixmap", "Window.Stuck.Unfocus.Pixmap"), m_frame_theme(frame_theme) { + FbTk::ThemeManager::instance().loadTheme(*this); } WinButtonTheme::~WinButtonTheme() {
@@ -318,6 +318,9 @@ m_fluxbox_pid = XInternAtom(disp, "_BLACKBOX_PID", False);
#endif // HAVE_GETPID + // setup theme manager to have our style file ready to be scanned + FbTk::ThemeManager::instance().load(getStyleFilename(), getStyleOverlayFilename()); + // Create keybindings handler and load keys file // Note: this needs to be done before creating screens m_key.reset(new Keys);@@ -409,9 +412,6 @@ for(; it != it_end; ++it)
initScreen(*it); XAllowEvents(disp, ReplayPointer, CurrentTime); - - // setup theme manager to have our style file ready to be scanned - FbTk::ThemeManager::instance().load(getStyleFilename(), getStyleOverlayFilename()); //XSynchronize(disp, False); sync(false);