From d6a3af53ffacbcd89e8161b5a5908ad468285b9a Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 1 Jan 2007 01:44:35 +0000 Subject: don't run [startup] items if fluxbox fails to load --- ChangeLog | 2 ++ src/fluxbox.cc | 56 +++++++++++++++++++++++++++++++------------------------- src/fluxbox.hh | 2 +- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3fc642..940dd40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Changes for 1.0rc3: *07/01/01: * Happy New Year! + * Don't run [startup] items in apps file if fluxbox fails to start (Mark) + fluxbox.cc/hh * Don't run [startup] items in apps file on reconfigure (Mark) Remember.cc * Fix data type of data passed to set _NET_FRAME_EXTENTS (Simon) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 9fe22f7..16e27b8 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -314,9 +314,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile load_rc(); // setup atom handlers before we create any windows -#ifdef REMEMBER - addAtomHandler(new Remember(), "remember"); // for remembering window attribs -#endif // REMEMBER #ifdef USE_NEWWMSPEC addAtomHandler(new Ewmh(), "ewmh"); // for Extended window manager atom support #endif // USE_NEWWMSPEC @@ -382,12 +379,24 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile } } - // init all "screens" - for(size_t s = 0; s < screens.size(); s++) - initScreen(screens[s]); - - XAllowEvents(disp, ReplayPointer, CurrentTime); + // create screens + for (size_t s = 0; s < screens.size(); s++) { + char scrname[128], altscrname[128]; + sprintf(scrname, "session.screen%d", screens[s]); + sprintf(altscrname, "session.Screen%d", screens[s]); + BScreen *screen = new BScreen(m_screen_rm.lock(), + scrname, altscrname, + screens[s], getNumberOfLayers()); + + // already handled + if (! screen->isScreenManaged()) { + delete screen; + continue; + } + // add to our list + m_screen_list.push_back(screen); + } if (m_screen_list.empty()) { throw _FB_CONSOLETEXT(Fluxbox, ErrorNoScreens, @@ -395,6 +404,19 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile "Error message when no unmanaged screens found - usually means another window manager is running"); } + // parse apps file after creating screens but before creating windows +#ifdef REMEMBER + addAtomHandler(new Remember(), "remember"); // for remembering window attribs +#endif // REMEMBER + + // init all "screens" + ScreenList::iterator it = m_screen_list.begin(); + ScreenList::iterator it_end = m_screen_list.end(); + for(; it != it_end; ++it) + initScreen(*it); + + XAllowEvents(disp, ReplayPointer, CurrentTime); + m_keyscreen = m_mousescreen = m_screen_list.front(); // setup theme manager to have our style file ready to be scanned @@ -461,24 +483,9 @@ Fluxbox::~Fluxbox() { } -int Fluxbox::initScreen(int scrnr) { +void Fluxbox::initScreen(BScreen *screen) { Display* disp = display(); - char scrname[128], altscrname[128]; - sprintf(scrname, "session.screen%d", scrnr); - sprintf(altscrname, "session.Screen%d", scrnr); - BScreen *screen = new BScreen(m_screen_rm.lock(), - scrname, altscrname, - scrnr, getNumberOfLayers()); - - // already handled - if (! screen->isScreenManaged()) { - delete screen; - return 0; - } - - // 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(); @@ -534,7 +541,6 @@ int Fluxbox::initScreen(int scrnr) { screen->slit()->show(); #endif // SLIT - return 1; } diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 9855637..c80459a 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -101,7 +101,7 @@ public: //WinClient *searchGroup(Window); WinClient *searchWindow(Window); - int initScreen(int screen_nr); + void initScreen(BScreen *screen); BScreen *searchScreen(Window w); unsigned int getDoubleClickInterval() const { return *m_rc_double_click_interval; } -- cgit v0.11.2