From 6ab2a90d72b5350b5e6b410da611fe3ad2a771a9 Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Sun, 2 May 2004 20:48:16 +0000
Subject: initMenus after we add screen to our list. Added find screen by
 number.

---
 src/fluxbox.cc | 26 ++++++++++++++++++++++----
 src/fluxbox.hh |  5 +++--
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 11ecb16..9f0f24e 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: fluxbox.cc,v 1.241 2004/04/26 09:25:42 fluxgen Exp $
+// $Id: fluxbox.cc,v 1.242 2004/05/02 20:48:16 fluxgen Exp $
 
 #include "fluxbox.hh"
 
@@ -535,7 +535,11 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
             delete screen;			
             continue;
         }
-        // now it's safe to create windows
+        // add to our list
+        m_screen_list.push_back(screen);
+
+        // now we can create menus (which needs this screen to be in screen_list)
+        screen->initMenus();
         screen->initWindows();
 
 #ifdef HAVE_GETPID
@@ -559,10 +563,11 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
 
 #endif // HAVE_RANDR
 
-        m_screen_list.push_back(screen);
+
 #ifdef USE_TOOLBAR
         m_toolbars.push_back(new Toolbar(*screen, 
-                                         *screen->layerManager().getLayer(Fluxbox::instance()->getNormalLayer())));
+                                         *screen->layerManager().
+                                         getLayer(Fluxbox::instance()->getNormalLayer())));
 #endif // USE_TOOLBAR
         // must do this after systray is created
         screen->setupKdeDockapps();
@@ -1840,6 +1845,19 @@ void Fluxbox::real_reconfigure() {
 
 }
 
+BScreen *Fluxbox::findScreen(int id) {
+    ScreenList::iterator it = m_screen_list.begin();
+    ScreenList::iterator it_end = m_screen_list.end();
+    for (; it != it_end; ++it) {
+        if ((*it)->screenNumber() == id)
+            break;
+    }
+
+    if (it == m_screen_list.end())
+        return 0;
+
+    return *it;
+}
 
 bool Fluxbox::menuTimestampsChanged() const {
     std::list<MenuTimestamp *>::const_iterator it = m_menu_timestamps.begin();
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index ea10e5d..9651e8c 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -22,7 +22,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: fluxbox.hh,v 1.87 2004/04/22 21:07:57 fluxgen Exp $
+// $Id: fluxbox.hh,v 1.88 2004/05/02 20:48:16 fluxgen Exp $
 
 #ifndef	 FLUXBOX_HH
 #define	 FLUXBOX_HH
@@ -199,7 +199,8 @@ public:
 
     bool isStartup() const { return m_starting; }
 
-
+    /// get screen from number
+    BScreen *findScreen(int num);
 
     typedef std::vector<Fluxbox::Titlebar> TitlebarList;
     /// @return whether the timestamps on the menu changed
-- 
cgit v0.11.2