From b766418c4f4867b802eb34967433d0738449522c Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Fri, 2 Jan 2004 22:55:35 +0000
Subject: init m_max_screens later

---
 src/FbTk/Theme.cc | 9 +++++++--
 src/FbTk/Theme.hh | 4 ++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/FbTk/Theme.cc b/src/FbTk/Theme.cc
index ddc68ec..5e9bc03 100644
--- a/src/FbTk/Theme.cc
+++ b/src/FbTk/Theme.cc
@@ -19,7 +19,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: Theme.cc,v 1.23 2003/12/29 11:04:09 fluxgen Exp $
+// $Id: Theme.cc,v 1.24 2004/01/02 22:55:35 fluxgen Exp $
 
 #include "Theme.hh"
 
@@ -51,13 +51,18 @@ ThemeManager &ThemeManager::instance() {
 }
 
 ThemeManager::ThemeManager():
-    m_max_screens(ScreenCount(FbTk::App::instance()->display())),
+    // max_screens: we initialize this later so we can set m_verbose 
+    // without having a display connection
+    m_max_screens(-1), 
     m_verbose(false),
     m_themelocation("") {
 
 }
 
 bool ThemeManager::registerTheme(Theme &tm) {
+    if (m_max_screens < 0)
+        m_max_screens = ScreenCount(FbTk::App::instance()->display());
+
     // valid screen num?
     if (m_max_screens < tm.screenNum() || tm.screenNum() < 0)
         return false;
diff --git a/src/FbTk/Theme.hh b/src/FbTk/Theme.hh
index c9262f5..105d860 100644
--- a/src/FbTk/Theme.hh
+++ b/src/FbTk/Theme.hh
@@ -19,7 +19,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: Theme.hh,v 1.14 2003/12/29 11:04:09 fluxgen Exp $
+// $Id: Theme.hh,v 1.15 2004/01/02 22:55:15 fluxgen Exp $
 
 /**
  @file holds ThemeItem<T>, Theme and ThemeManager which is the base for any theme
@@ -147,7 +147,7 @@ private:
     /// map each theme manager to a screen
     typedef std::list<FbTk::Theme *> ThemeList;
     ThemeList m_themelist;
-    const int m_max_screens;
+    int m_max_screens;
     XrmDatabaseHelper m_database;
     bool m_verbose;
 
-- 
cgit v0.11.2