From 345ef845c94bb4d77ed210e2c7a2c252d3068d59 Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Fri, 2 Jan 2004 13:29:01 +0000
Subject: lock roottheme so it doesn't get run twice

---
 src/RootTheme.cc | 12 ++++++++----
 src/RootTheme.hh |  6 ++++--
 src/Screen.cc    | 11 +++++++++--
 3 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/RootTheme.cc b/src/RootTheme.cc
index 15723ac..03eb8b1 100644
--- a/src/RootTheme.cc
+++ b/src/RootTheme.cc
@@ -19,19 +19,20 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: RootTheme.cc,v 1.6 2003/09/12 23:33:13 fluxgen Exp $
+// $Id: RootTheme.cc,v 1.7 2004/01/02 13:28:38 fluxgen Exp $
 
 #include "RootTheme.hh"
 
 #include "FbCommands.hh"
-#include "App.hh"
+#include "FbTk/App.hh"
 
 RootTheme::RootTheme(int screen_num, std::string &screen_root_command):
     FbTk::Theme(screen_num),
     m_root_command(*this, "rootCommand", "RootCommand"), 
     m_screen_root_command(screen_root_command),
-    m_opgc(RootWindow(FbTk::App::instance()->display(), screen_num)) {
-
+    m_opgc(RootWindow(FbTk::App::instance()->display(), screen_num)),
+    m_lock(false) {
+    
     Display *disp = FbTk::App::instance()->display();
     m_opgc.setForeground(WhitePixel(disp, screen_num)^BlackPixel(disp, screen_num));
     m_opgc.setFunction(GXxor);
@@ -43,6 +44,9 @@ RootTheme::~RootTheme() {
 }
 
 void RootTheme::reconfigTheme() {
+    if (m_lock)
+        return;
+
     // override resource root command?
     if (m_screen_root_command == "") { 
         // do root command
diff --git a/src/RootTheme.hh b/src/RootTheme.hh
index 3f12358..686a4ed 100644
--- a/src/RootTheme.hh
+++ b/src/RootTheme.hh
@@ -19,7 +19,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: RootTheme.hh,v 1.5 2003/09/12 23:33:13 fluxgen Exp $
+// $Id: RootTheme.hh,v 1.6 2004/01/02 13:28:38 fluxgen Exp $
 
 #ifndef ROOTTHEME_HH
 #define ROOTTHEME_HH
@@ -44,11 +44,13 @@ public:
     void reconfigTheme();
 
     GC opGC() const { return m_opgc.gc(); }
-
+    //!! TODO we should need this later
+    void lock(bool value) { m_lock = value; }
 private:
     FbTk::ThemeItem<std::string> m_root_command;
     std::string &m_screen_root_command; ///< string to execute and override theme rootCommand
     FbTk::GContext m_opgc;
+    bool m_lock;
 };
 
 #endif // ROOTTHEME_HH
diff --git a/src/Screen.cc b/src/Screen.cc
index fb4ee34..1e5d94d 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: Screen.cc,v 1.256 2003/12/31 00:38:40 fluxgen Exp $
+// $Id: Screen.cc,v 1.257 2004/01/02 13:29:01 fluxgen Exp $
 
 
 #include "Screen.hh"
@@ -558,7 +558,14 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
     // 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());
+    //    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.
+    m_root_theme->lock(true);
+    FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename());
+    m_root_theme->lock(false);
 
     int i;
     unsigned int nchild;
-- 
cgit v0.11.2