cleaning
This commit is contained in:
parent
500aa3ce02
commit
fafc0a6e49
1 changed files with 33 additions and 45 deletions
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Screen.cc,v 1.82 2002/11/21 15:57:47 fluxgen Exp $
|
// $Id: Screen.cc,v 1.83 2002/11/24 20:56:06 fluxgen Exp $
|
||||||
|
|
||||||
|
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
@ -233,14 +233,15 @@ m_currentworkspace_sig(*this), // current workspace signal
|
||||||
theme(0),
|
theme(0),
|
||||||
resource(rm, screenname, altscreenname)
|
resource(rm, screenname, altscreenname)
|
||||||
{
|
{
|
||||||
|
Display *disp = BaseDisplay::getXDisplay();
|
||||||
|
|
||||||
event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
|
event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
|
||||||
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
||||||
ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask;
|
ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask;
|
||||||
|
|
||||||
XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning);
|
XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning);
|
||||||
XSelectInput(BaseDisplay::getXDisplay(), getRootWindow(), event_mask);
|
XSelectInput(disp, getRootWindow(), event_mask);
|
||||||
XSync(BaseDisplay::getXDisplay(), False);
|
XSync(disp, False);
|
||||||
XSetErrorHandler((XErrorHandler) old);
|
XSetErrorHandler((XErrorHandler) old);
|
||||||
|
|
||||||
managed = running;
|
managed = running;
|
||||||
|
@ -263,18 +264,17 @@ resource(rm, screenname, altscreenname)
|
||||||
#ifdef HAVE_GETPID
|
#ifdef HAVE_GETPID
|
||||||
pid_t bpid = getpid();
|
pid_t bpid = getpid();
|
||||||
|
|
||||||
XChangeProperty(BaseDisplay::getXDisplay(), getRootWindow(),
|
XChangeProperty(disp, getRootWindow(),
|
||||||
Fluxbox::instance()->getFluxboxPidAtom(), XA_CARDINAL,
|
Fluxbox::instance()->getFluxboxPidAtom(), XA_CARDINAL,
|
||||||
sizeof(pid_t) * 8, PropModeReplace,
|
sizeof(pid_t) * 8, PropModeReplace,
|
||||||
(unsigned char *) &bpid, 1);
|
(unsigned char *) &bpid, 1);
|
||||||
#endif // HAVE_GETPID
|
#endif // HAVE_GETPID
|
||||||
|
|
||||||
|
|
||||||
XDefineCursor(BaseDisplay::getXDisplay(), getRootWindow(),
|
XDefineCursor(disp, getRootWindow(), fluxbox->getSessionCursor());
|
||||||
fluxbox->getSessionCursor());
|
|
||||||
|
|
||||||
image_control =
|
image_control =
|
||||||
new BImageControl(fluxbox, this, true, fluxbox->colorsPerChannel(),
|
new BImageControl(this, true, fluxbox->colorsPerChannel(),
|
||||||
fluxbox->getCacheLife(), fluxbox->getCacheMax());
|
fluxbox->getCacheLife(), fluxbox->getCacheMax());
|
||||||
image_control->installRootColormap();
|
image_control->installRootColormap();
|
||||||
root_colormap_installed = true;
|
root_colormap_installed = true;
|
||||||
|
@ -282,7 +282,7 @@ resource(rm, screenname, altscreenname)
|
||||||
fluxbox->load_rc(this);
|
fluxbox->load_rc(this);
|
||||||
|
|
||||||
image_control->setDither(*resource.image_dither);
|
image_control->setDither(*resource.image_dither);
|
||||||
theme = new Theme(getBaseDisplay()->getXDisplay(), getRootWindow(), colormap(), getScreenNumber(),
|
theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(),
|
||||||
image_control, fluxbox->getStyleFilename(), getRootCommand().c_str());
|
image_control, fluxbox->getStyleFilename(), getRootCommand().c_str());
|
||||||
|
|
||||||
theme->reconfigure(*resource.antialias);
|
theme->reconfigure(*resource.antialias);
|
||||||
|
@ -306,7 +306,7 @@ resource(rm, screenname, altscreenname)
|
||||||
attrib.save_under = true;
|
attrib.save_under = true;
|
||||||
|
|
||||||
geom_window =
|
geom_window =
|
||||||
XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
XCreateWindow(disp, getRootWindow(),
|
||||||
0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(),
|
0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(),
|
||||||
InputOutput, getVisual(), mask, &attrib);
|
InputOutput, getVisual(), mask, &attrib);
|
||||||
geom_visible = false;
|
geom_visible = false;
|
||||||
|
@ -315,25 +315,23 @@ resource(rm, screenname, altscreenname)
|
||||||
if (theme->getWindowStyle().t_focus.type() ==
|
if (theme->getWindowStyle().t_focus.type() ==
|
||||||
(FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
|
(FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
|
||||||
geom_pixmap = None;
|
geom_pixmap = None;
|
||||||
XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window,
|
XSetWindowBackground(disp, geom_window,
|
||||||
theme->getWindowStyle().t_focus.color().pixel());
|
theme->getWindowStyle().t_focus.color().pixel());
|
||||||
} else {
|
} else {
|
||||||
geom_pixmap = image_control->renderImage(geom_w, geom_h,
|
geom_pixmap = image_control->renderImage(geom_w, geom_h,
|
||||||
&theme->getWindowStyle().t_focus);
|
&theme->getWindowStyle().t_focus);
|
||||||
XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
|
XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap);
|
||||||
geom_window, geom_pixmap);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (theme->getWindowStyle().l_focus.type() ==
|
if (theme->getWindowStyle().l_focus.type() ==
|
||||||
(FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
|
(FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
|
||||||
geom_pixmap = None;
|
geom_pixmap = None;
|
||||||
XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window,
|
XSetWindowBackground(disp, geom_window,
|
||||||
theme->getWindowStyle().l_focus.color().pixel());
|
theme->getWindowStyle().l_focus.color().pixel());
|
||||||
} else {
|
} else {
|
||||||
geom_pixmap = image_control->renderImage(geom_w, geom_h,
|
geom_pixmap = image_control->renderImage(geom_w, geom_h,
|
||||||
&theme->getWindowStyle().l_focus);
|
&theme->getWindowStyle().l_focus);
|
||||||
XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
|
XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap);
|
||||||
geom_window, geom_pixmap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +365,7 @@ resource(rm, screenname, altscreenname)
|
||||||
m_toolbar.reset(new Toolbar(this));
|
m_toolbar.reset(new Toolbar(this));
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
slit = new Slit(this);
|
m_slit.reset(new Slit(this));
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
initMenu();
|
initMenu();
|
||||||
|
@ -377,7 +375,7 @@ resource(rm, screenname, altscreenname)
|
||||||
//update menus
|
//update menus
|
||||||
rootmenu->update();
|
rootmenu->update();
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
slit->reconfigure();
|
m_slit->reconfigure();
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
// start with workspace 0
|
// start with workspace 0
|
||||||
|
@ -387,8 +385,7 @@ resource(rm, screenname, altscreenname)
|
||||||
int i;
|
int i;
|
||||||
unsigned int nchild;
|
unsigned int nchild;
|
||||||
Window r, p, *children;
|
Window r, p, *children;
|
||||||
XQueryTree(getBaseDisplay()->getXDisplay(), getRootWindow(), &r, &p,
|
XQueryTree(disp, getRootWindow(), &r, &p, &children, &nchild);
|
||||||
&children, &nchild);
|
|
||||||
|
|
||||||
// preen the window list of all icon windows... for better dockapp support
|
// preen the window list of all icon windows... for better dockapp support
|
||||||
for (i = 0; i < (int) nchild; i++) {
|
for (i = 0; i < (int) nchild; i++) {
|
||||||
|
@ -417,7 +414,7 @@ resource(rm, screenname, altscreenname)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
XWindowAttributes attrib;
|
XWindowAttributes attrib;
|
||||||
if (XGetWindowAttributes(getBaseDisplay()->getXDisplay(), children[i],
|
if (XGetWindowAttributes(disp, children[i],
|
||||||
&attrib)) {
|
&attrib)) {
|
||||||
if (attrib.override_redirect)
|
if (attrib.override_redirect)
|
||||||
continue;
|
continue;
|
||||||
|
@ -442,23 +439,18 @@ resource(rm, screenname, altscreenname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! resource.sloppy_focus)
|
if (! resource.sloppy_focus) {
|
||||||
XSetInputFocus(getBaseDisplay()->getXDisplay(), m_toolbar->getWindowID(),
|
XSetInputFocus(disp, m_toolbar->getWindowID(),
|
||||||
RevertToParent, CurrentTime);
|
RevertToParent, CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
XFree(children);
|
XFree(children);
|
||||||
XFlush(getBaseDisplay()->getXDisplay());
|
XFlush(disp);
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
template<typename T>
|
|
||||||
void delete_obj(T * obj) {
|
|
||||||
delete obj;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BScreen::~BScreen() {
|
BScreen::~BScreen() {
|
||||||
if (! managed) return;
|
if (! managed)
|
||||||
|
return;
|
||||||
|
|
||||||
if (geom_pixmap != None)
|
if (geom_pixmap != None)
|
||||||
image_control->removeImage(geom_pixmap);
|
image_control->removeImage(geom_pixmap);
|
||||||
|
@ -494,10 +486,6 @@ BScreen::~BScreen() {
|
||||||
delete m_iconmenu;
|
delete m_iconmenu;
|
||||||
delete configmenu;
|
delete configmenu;
|
||||||
|
|
||||||
#ifdef SLIT
|
|
||||||
delete slit;
|
|
||||||
#endif // SLIT
|
|
||||||
|
|
||||||
delete image_control;
|
delete image_control;
|
||||||
|
|
||||||
delete theme;
|
delete theme;
|
||||||
|
@ -581,7 +569,7 @@ void BScreen::reconfigure() {
|
||||||
m_toolbar->reconfigure();
|
m_toolbar->reconfigure();
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
slit->reconfigure();
|
m_slit->reconfigure();
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
//reconfigure workspaces
|
//reconfigure workspaces
|
||||||
|
@ -973,14 +961,14 @@ void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
|
||||||
session_stack[i++] = configmenu->windowID();
|
session_stack[i++] = configmenu->windowID();
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
session_stack[i++] = slit->menu().getDirectionmenu().windowID();
|
session_stack[i++] = m_slit->menu().getDirectionmenu().windowID();
|
||||||
session_stack[i++] = slit->menu().getPlacementmenu().windowID();
|
session_stack[i++] = m_slit->menu().getPlacementmenu().windowID();
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
if (hasXinerama()) {
|
if (hasXinerama()) {
|
||||||
session_stack[i++] = slit->menu().getHeadmenu()->windowID();
|
session_stack[i++] = m_slit->menu().getHeadmenu()->windowID();
|
||||||
}
|
}
|
||||||
#endif // XINERAMA
|
#endif // XINERAMA
|
||||||
session_stack[i++] = slit->menu().windowID();
|
session_stack[i++] = m_slit->menu().windowID();
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
session_stack[i++] =
|
session_stack[i++] =
|
||||||
|
@ -1002,9 +990,9 @@ void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
|
||||||
if (m_toolbar->isOnTop())
|
if (m_toolbar->isOnTop())
|
||||||
session_stack[i++] = m_toolbar->getWindowID();
|
session_stack[i++] = m_toolbar->getWindowID();
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
if (slit->isOnTop())
|
if (m_slit->isOnTop())
|
||||||
session_stack[i++] = slit->getWindowID();
|
session_stack[i++] = m_slit->getWindowID();
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
if (!workspace_stack.empty()) {
|
if (!workspace_stack.empty()) {
|
||||||
Workspace::Stack::const_reverse_iterator it = workspace_stack.rbegin();
|
Workspace::Stack::const_reverse_iterator it = workspace_stack.rbegin();
|
||||||
|
@ -1554,8 +1542,8 @@ void BScreen::shutdown() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
slit->shutdown();
|
m_slit->shutdown();
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue