From f66d446a94450d509748afe28a95f48b8fdfcfc5 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Fri, 11 Jan 2008 22:36:38 -0800 Subject: move some stuff from Fluxbox to BScreen --- src/Screen.cc | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- src/Screen.hh | 2 ++ src/Toolbar.cc | 5 +---- src/fluxbox.cc | 57 --------------------------------------------------------- src/fluxbox.hh | 4 ---- 5 files changed, 49 insertions(+), 68 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index ddfb65f..578b0c7 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -87,6 +87,12 @@ class Slit {}; #endif // SLIT +#ifdef USE_TOOLBAR +#include "Toolbar.hh" +#else +class Toolbar {}; +#endif // USE_TOOLBAR + #ifdef STDC_HEADERS #include #endif // STDC_HEADERS @@ -121,6 +127,10 @@ extern "C" { } #endif // XINERAMA +#ifdef HAVE_RANDR +#include +#endif // HAVE_RANDR + #include #include #include @@ -354,6 +364,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm, Display *disp = m_root_window.display(); + Fluxbox *fluxbox = Fluxbox::instance(); initXinerama(); @@ -375,6 +386,15 @@ BScreen::BScreen(FbTk::ResourceManager &rm, return; } + // we're going to manage the screen, so now add our pid +#ifdef HAVE_GETPID + pid_t bpid = getpid(); + + rootWindow().changeProperty(fluxbox->getFluxboxPidAtom(), XA_CARDINAL, + sizeof(pid_t) * 8, PropModeReplace, + (unsigned char *) &bpid, 1); +#endif // HAVE_GETPID + // check if we're the first EWMH compliant window manager on this screen Atom wm_check = XInternAtom(disp, "_NET_SUPPORTING_WM_CHECK", False); Atom xa_ret_type; @@ -391,6 +411,19 @@ BScreen::BScreen(FbTk::ResourceManager &rm, // TODO fluxgen: check if this is the right place m_head_areas = new HeadArea[numHeads() ? numHeads() : 1]; +#ifdef HAVE_RANDR + // setup RANDR for this screens root window + // we need to determine if we should use old randr select input function or not +#ifdef X_RRScreenChangeSelectInput + // use old set randr event + XRRScreenChangeSelectInput(disp, rootWindow().window(), True); +#else + XRRSelectInput(disp, rootWindow().window(), + RRScreenChangeNotifyMask); +#endif // X_RRScreenChangeSelectInput + +#endif // HAVE_RANDR + _FB_USES_NLS; fprintf(stderr, _FB_CONSOLETEXT(Screen, ManagingScreen, @@ -409,7 +442,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); // load this screens resources - Fluxbox *fluxbox = Fluxbox::instance(); fluxbox->load_rc(*this); // setup image cache engine @@ -517,10 +549,11 @@ BScreen::BScreen(FbTk::ResourceManager &rm, BScreen::~BScreen() { - if (! managed) return; + m_toolbar.reset(0); + FbTk::EventManager *evm = FbTk::EventManager::instance(); evm->remove(rootWindow()); Keys *keys = Fluxbox::instance()->keys(); @@ -685,9 +718,19 @@ void BScreen::initWindows() { children[i] = None; // we dont need this anymore, since we already created a window for it } - XFree(children); + // now, show slit and toolbar +#ifdef SLIT + if (slit()) + slit()->show(); +#endif // SLIT + +#ifdef USE_TOOLBAR + m_toolbar.reset(new Toolbar(*this, + *layerManager().getLayer(::Layer::NORMAL))); +#endif // USE_TOOLBAR + } unsigned int BScreen::currentWorkspaceID() const { diff --git a/src/Screen.hh b/src/Screen.hh index 1d41d82..99c23ff 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -59,6 +59,7 @@ class WinClient; class Workspace; class Strut; class Slit; +class Toolbar; class HeadArea; class FocusControl; class ScreenPlacement; @@ -516,6 +517,7 @@ private: Icons m_icon_list; std::auto_ptr m_slit; + std::auto_ptr m_toolbar; Workspace *m_current_workspace; diff --git a/src/Toolbar.cc b/src/Toolbar.cc index de19d1d..89ba9cf 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -369,10 +369,7 @@ void Toolbar::lower() { } void Toolbar::reconfigure() { - // wait until after windows are drawn to show toolbar at startup - // otherwise, it looks ugly - if (!Fluxbox::instance()->isStartup()) - updateVisibleState(); + updateVisibleState(); if (!doAutoHide() && isHidden()) toggleHidden(); diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 2ebf931..e93f363 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -63,9 +63,6 @@ #include "config.h" #endif // HAVE_CONFIG_H -#ifdef SLIT -#include "Slit.hh" -#endif // SLIT #ifdef USE_GNOME #include "Gnome.hh" #endif // USE_GNOME @@ -75,11 +72,6 @@ #ifdef REMEMBER #include "Remember.hh" #endif // REMEMBER -#ifdef USE_TOOLBAR -#include "Toolbar.hh" -#else -class Toolbar { }; -#endif // USE_TOOLBAR // X headers #include @@ -423,25 +415,11 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile // // m_resourcemanager.dump(); -#ifdef USE_TOOLBAR - // finally, show toolbar - Toolbars::iterator toolbar_it = m_toolbars.begin(); - Toolbars::iterator toolbar_it_end = m_toolbars.end(); - for (; toolbar_it != toolbar_it_end; ++toolbar_it) - (*toolbar_it)->updateVisibleState(); -#endif // USE_TOOLBAR - } Fluxbox::~Fluxbox() { - // destroy toolbars - while (!m_toolbars.empty()) { - delete m_toolbars.back(); - m_toolbars.pop_back(); - } - // destroy atomhandlers for (AtomHandlerContainerIt it= m_atomhandler.begin(); it != m_atomhandler.end(); @@ -467,40 +445,9 @@ Fluxbox::~Fluxbox() { void Fluxbox::initScreen(BScreen *screen) { - Display* disp = display(); - // now we can create menus (which needs this screen to be in screen_list) screen->initMenus(); -#ifdef HAVE_GETPID - pid_t bpid = getpid(); - - screen->rootWindow().changeProperty(getFluxboxPidAtom(), XA_CARDINAL, - sizeof(pid_t) * 8, PropModeReplace, - (unsigned char *) &bpid, 1); -#endif // HAVE_GETPID - -#ifdef HAVE_RANDR - // setup RANDR for this screens root window - // we need to determine if we should use old randr select input function or not -#ifdef X_RRScreenChangeSelectInput - // use old set randr event - XRRScreenChangeSelectInput(disp, screen->rootWindow().window(), True); -#else - XRRSelectInput(disp, screen->rootWindow().window(), - RRScreenChangeNotifyMask); -#endif // X_RRScreenChangeSelectInput - -#endif // HAVE_RANDR - - -#ifdef USE_TOOLBAR - m_toolbars.push_back(new Toolbar(*screen, - *screen->layerManager(). - getLayer(::Layer::NORMAL))); -#endif // USE_TOOLBAR - - // must do this after toolbar is created screen->initWindows(); // attach screen signals to this @@ -519,10 +466,6 @@ void Fluxbox::initScreen(BScreen *screen) { } FocusControl::revertFocus(*screen); // make sure focus style is correct -#ifdef SLIT - if (screen->slit()) - screen->slit()->show(); -#endif // SLIT } diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 9868511..d930ad1 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -67,8 +67,6 @@ class WinClient; class Keys; class BScreen; class FbAtoms; -class Toolbar; - /// main class for the window manager. /** @@ -277,8 +275,6 @@ private: typedef AtomHandlerContainer::iterator AtomHandlerContainerIt; AtomHandlerContainer m_atomhandler; - typedef std::vector Toolbars; - Toolbars m_toolbars; bool m_starting; bool m_restarting; -- cgit v0.11.2