From 832dba7d16b77f786b34347cf5dd6c36bd69f586 Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 20 Jan 2007 18:26:55 +0000 Subject: let styles override rootCommand in init, plus removing some code I accidentally left in --- ChangeLog | 3 +++ src/RootTheme.cc | 33 ++------------------------------- src/RootTheme.hh | 4 +--- src/Screen.cc | 11 ++++++++--- 4 files changed, 14 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index d95da39..278219f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 1.0rc3: *07/01/20: + * Let styles override rootCommand in init file -- for the old behavior, add + `background: none' to the overlay file (Mark) + RootTheme.cc/hh Screen.cc * Don't place windows over toolbar at the top of the screen (Mark) CascadePlacement.cc *07/01/16: diff --git a/src/RootTheme.cc b/src/RootTheme.cc index eeb95f9..98d9067 100644 --- a/src/RootTheme.cc +++ b/src/RootTheme.cc @@ -85,29 +85,11 @@ public: (mod_y.length() == 2 && (mod_y[1] < '0' || mod_y[1] > '9'))) mod_y = "1"; - // check if any of our values have changed - if (mod_x != m_mod_x) { - m_changed = true; - m_mod_x = mod_x; - } - if (mod_y != m_mod_y) { - m_changed = true; - m_mod_y = mod_y; - } - // these aren't quite right, but I don't care - if (color_name != m_color) { - m_changed = true; - m_color = color_name; - } - if (colorto_name != m_color_to) { - m_changed = true; - m_color_to = colorto_name; - } - // remove whitespace from filename FbTk::StringUtil::removeFirstWhitespace(pixmap_name); FbTk::StringUtil::removeTrailingWhitespace(pixmap_name); + // check if the background has been changed if (mod_x != m_mod_x || mod_y != m_mod_y || pixmap_name != m_filename || color_name != m_color || colorto_name != m_color_to) { m_changed = true; @@ -159,12 +141,10 @@ private: }; -RootTheme::RootTheme(const std::string &root_command, - FbTk::ImageControl &image_control): +RootTheme::RootTheme(FbTk::ImageControl &image_control): FbTk::Theme(image_control.screenNumber()), m_background(new BackgroundItem(*this, "background", "Background")), m_opgc(RootWindow(FbTk::App::instance()->display(), image_control.screenNumber())), - m_root_command(root_command), m_image_ctrl(image_control) { Display *disp = FbTk::App::instance()->display(); @@ -207,19 +187,10 @@ void RootTheme::reconfigTheme() { m_background->setApplied(); - // if user specified background in the config then use it - // instead of style background - if (!m_root_command.empty()) { - FbCommands::ExecuteCmd cmd(m_root_command, screenNum()); - cmd.execute(); - return; - } - // style doesn't wish to change the background if (strstr(m_background->options().c_str(), "none") != 0) return; - // // Else parse background from style // diff --git a/src/RootTheme.hh b/src/RootTheme.hh index aee6d85..abfea7c 100644 --- a/src/RootTheme.hh +++ b/src/RootTheme.hh @@ -45,8 +45,7 @@ public: /// constructor /// @param resmanager resource manager for finding specific resources /// @param image_control for rendering background texture - RootTheme(const std::string &root_command, - FbTk::ImageControl &image_control); + RootTheme(FbTk::ImageControl &image_control); ~RootTheme(); bool fallback(FbTk::ThemeItem_base &item); @@ -64,7 +63,6 @@ public: private: BackgroundItem *m_background;///< background image/texture FbTk::GContext m_opgc; - const std::string &m_root_command; FbTk::ImageControl &m_image_ctrl; ///< image control for rendering background texture }; diff --git a/src/Screen.cc b/src/Screen.cc index 2bb243f..a50d1ba 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -62,7 +62,7 @@ #include "CommandParser.hh" #include "AtomHandler.hh" #include "HeadArea.hh" - +#include "FbCommands.hh" #include "FbTk/I18n.hh" #include "FbTk/Subject.hh" @@ -430,7 +430,13 @@ BScreen::BScreen(FbTk::ResourceManager &rm, imageControl().installRootColormap(); root_colormap_installed = true; - m_root_theme.reset(new RootTheme(*resource.rootcommand, imageControl())); + // if user specified background in the config then use it + if (!resource.rootcommand->empty()) { + FbCommands::ExecuteCmd cmd(*resource.rootcommand, screenNumber()); + cmd.execute(); + } + + m_root_theme.reset(new RootTheme(imageControl())); m_windowtheme->setFocusedAlpha(*resource.focused_alpha); m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha); @@ -505,7 +511,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, // FbTk::ThemeManager::instance().loadTheme(*m_windowtheme.get()); //!! TODO: For some strange reason we must load everything, // else the focus label doesn't get updated - // So we lock root theme temporary so it doesn't uses RootTheme::reconfigTheme // This must be fixed in the future. FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(), fluxbox->getStyleOverlayFilename(), -- cgit v0.11.2