move some stuff from Fluxbox to BScreen
This commit is contained in:
parent
5b0806f1cb
commit
f66d446a94
5 changed files with 49 additions and 68 deletions
|
@ -87,6 +87,12 @@
|
|||
class Slit {};
|
||||
#endif // SLIT
|
||||
|
||||
#ifdef USE_TOOLBAR
|
||||
#include "Toolbar.hh"
|
||||
#else
|
||||
class Toolbar {};
|
||||
#endif // USE_TOOLBAR
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <sys/types.h>
|
||||
#endif // STDC_HEADERS
|
||||
|
@ -121,6 +127,10 @@ extern "C" {
|
|||
}
|
||||
#endif // XINERAMA
|
||||
|
||||
#ifdef HAVE_RANDR
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif // HAVE_RANDR
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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<Slit> m_slit;
|
||||
std::auto_ptr<Toolbar> m_toolbar;
|
||||
|
||||
Workspace *m_current_workspace;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 <X11/Xlib.h>
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Toolbar *> Toolbars;
|
||||
Toolbars m_toolbars;
|
||||
|
||||
bool m_starting;
|
||||
bool m_restarting;
|
||||
|
|
Loading…
Reference in a new issue