diff options
author | fluxgen <fluxgen> | 2002-11-24 20:56:06 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-11-24 20:56:06 (GMT) |
commit | fafc0a6e49c3d4c31f05191313266bb0bbf86377 (patch) | |
tree | 76578b6f18057053289953175aa93c3039eb845f | |
parent | 500aa3ce024d12157c934c584b426d44e9fbe37c (diff) | |
download | fluxbox_paul-fafc0a6e49c3d4c31f05191313266bb0bbf86377.zip fluxbox_paul-fafc0a6e49c3d4c31f05191313266bb0bbf86377.tar.bz2 |
cleaning
-rw-r--r-- | src/Screen.cc | 78 |
1 files changed, 33 insertions, 45 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 08a5e02..880e13c 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.82 2002/11/21 15:57:47 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.83 2002/11/24 20:56:06 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -233,14 +233,15 @@ m_currentworkspace_sig(*this), // current workspace signal | |||
233 | theme(0), | 233 | theme(0), |
234 | resource(rm, screenname, altscreenname) | 234 | resource(rm, screenname, altscreenname) |
235 | { | 235 | { |
236 | Display *disp = BaseDisplay::getXDisplay(); | ||
236 | 237 | ||
237 | event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask | | 238 | event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask | |
238 | SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | | 239 | SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | |
239 | ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask; | 240 | ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask; |
240 | 241 | ||
241 | XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning); | 242 | XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning); |
242 | XSelectInput(BaseDisplay::getXDisplay(), getRootWindow(), event_mask); | 243 | XSelectInput(disp, getRootWindow(), event_mask); |
243 | XSync(BaseDisplay::getXDisplay(), False); | 244 | XSync(disp, False); |
244 | XSetErrorHandler((XErrorHandler) old); | 245 | XSetErrorHandler((XErrorHandler) old); |
245 | 246 | ||
246 | managed = running; | 247 | managed = running; |
@@ -263,18 +264,17 @@ resource(rm, screenname, altscreenname) | |||
263 | #ifdef HAVE_GETPID | 264 | #ifdef HAVE_GETPID |
264 | pid_t bpid = getpid(); | 265 | pid_t bpid = getpid(); |
265 | 266 | ||
266 | XChangeProperty(BaseDisplay::getXDisplay(), getRootWindow(), | 267 | XChangeProperty(disp, getRootWindow(), |
267 | Fluxbox::instance()->getFluxboxPidAtom(), XA_CARDINAL, | 268 | Fluxbox::instance()->getFluxboxPidAtom(), XA_CARDINAL, |
268 | sizeof(pid_t) * 8, PropModeReplace, | 269 | sizeof(pid_t) * 8, PropModeReplace, |
269 | (unsigned char *) &bpid, 1); | 270 | (unsigned char *) &bpid, 1); |
270 | #endif // HAVE_GETPID | 271 | #endif // HAVE_GETPID |
271 | 272 | ||
272 | 273 | ||
273 | XDefineCursor(BaseDisplay::getXDisplay(), getRootWindow(), | 274 | XDefineCursor(disp, getRootWindow(), fluxbox->getSessionCursor()); |
274 | fluxbox->getSessionCursor()); | ||
275 | 275 | ||
276 | image_control = | 276 | image_control = |
277 | new BImageControl(fluxbox, this, true, fluxbox->colorsPerChannel(), | 277 | new BImageControl(this, true, fluxbox->colorsPerChannel(), |
278 | fluxbox->getCacheLife(), fluxbox->getCacheMax()); | 278 | fluxbox->getCacheLife(), fluxbox->getCacheMax()); |
279 | image_control->installRootColormap(); | 279 | image_control->installRootColormap(); |
280 | root_colormap_installed = true; | 280 | root_colormap_installed = true; |
@@ -282,7 +282,7 @@ resource(rm, screenname, altscreenname) | |||
282 | fluxbox->load_rc(this); | 282 | fluxbox->load_rc(this); |
283 | 283 | ||
284 | image_control->setDither(*resource.image_dither); | 284 | image_control->setDither(*resource.image_dither); |
285 | theme = new Theme(getBaseDisplay()->getXDisplay(), getRootWindow(), colormap(), getScreenNumber(), | 285 | theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(), |
286 | image_control, fluxbox->getStyleFilename(), getRootCommand().c_str()); | 286 | image_control, fluxbox->getStyleFilename(), getRootCommand().c_str()); |
287 | 287 | ||
288 | theme->reconfigure(*resource.antialias); | 288 | theme->reconfigure(*resource.antialias); |
@@ -306,7 +306,7 @@ resource(rm, screenname, altscreenname) | |||
306 | attrib.save_under = true; | 306 | attrib.save_under = true; |
307 | 307 | ||
308 | geom_window = | 308 | geom_window = |
309 | XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(), | 309 | XCreateWindow(disp, getRootWindow(), |
310 | 0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(), | 310 | 0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(), |
311 | InputOutput, getVisual(), mask, &attrib); | 311 | InputOutput, getVisual(), mask, &attrib); |
312 | geom_visible = false; | 312 | geom_visible = false; |
@@ -315,25 +315,23 @@ resource(rm, screenname, altscreenname) | |||
315 | if (theme->getWindowStyle().t_focus.type() == | 315 | if (theme->getWindowStyle().t_focus.type() == |
316 | (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { | 316 | (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { |
317 | geom_pixmap = None; | 317 | geom_pixmap = None; |
318 | XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, | 318 | XSetWindowBackground(disp, geom_window, |
319 | theme->getWindowStyle().t_focus.color().pixel()); | 319 | theme->getWindowStyle().t_focus.color().pixel()); |
320 | } else { | 320 | } else { |
321 | geom_pixmap = image_control->renderImage(geom_w, geom_h, | 321 | geom_pixmap = image_control->renderImage(geom_w, geom_h, |
322 | &theme->getWindowStyle().t_focus); | 322 | &theme->getWindowStyle().t_focus); |
323 | XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), | 323 | XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap); |
324 | geom_window, geom_pixmap); | ||
325 | } | 324 | } |
326 | } else { | 325 | } else { |
327 | if (theme->getWindowStyle().l_focus.type() == | 326 | if (theme->getWindowStyle().l_focus.type() == |
328 | (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { | 327 | (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { |
329 | geom_pixmap = None; | 328 | geom_pixmap = None; |
330 | XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, | 329 | XSetWindowBackground(disp, geom_window, |
331 | theme->getWindowStyle().l_focus.color().pixel()); | 330 | theme->getWindowStyle().l_focus.color().pixel()); |
332 | } else { | 331 | } else { |
333 | geom_pixmap = image_control->renderImage(geom_w, geom_h, | 332 | geom_pixmap = image_control->renderImage(geom_w, geom_h, |
334 | &theme->getWindowStyle().l_focus); | 333 | &theme->getWindowStyle().l_focus); |
335 | XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), | 334 | XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap); |
336 | geom_window, geom_pixmap); | ||
337 | } | 335 | } |
338 | } | 336 | } |
339 | 337 | ||
@@ -367,7 +365,7 @@ resource(rm, screenname, altscreenname) | |||
367 | m_toolbar.reset(new Toolbar(this)); | 365 | m_toolbar.reset(new Toolbar(this)); |
368 | 366 | ||
369 | #ifdef SLIT | 367 | #ifdef SLIT |
370 | slit = new Slit(this); | 368 | m_slit.reset(new Slit(this)); |
371 | #endif // SLIT | 369 | #endif // SLIT |
372 | 370 | ||
373 | initMenu(); | 371 | initMenu(); |
@@ -377,7 +375,7 @@ resource(rm, screenname, altscreenname) | |||
377 | //update menus | 375 | //update menus |
378 | rootmenu->update(); | 376 | rootmenu->update(); |
379 | #ifdef SLIT | 377 | #ifdef SLIT |
380 | slit->reconfigure(); | 378 | m_slit->reconfigure(); |
381 | #endif // SLIT | 379 | #endif // SLIT |
382 | 380 | ||
383 | // start with workspace 0 | 381 | // start with workspace 0 |
@@ -387,8 +385,7 @@ resource(rm, screenname, altscreenname) | |||
387 | int i; | 385 | int i; |
388 | unsigned int nchild; | 386 | unsigned int nchild; |
389 | Window r, p, *children; | 387 | Window r, p, *children; |
390 | XQueryTree(getBaseDisplay()->getXDisplay(), getRootWindow(), &r, &p, | 388 | XQueryTree(disp, getRootWindow(), &r, &p, &children, &nchild); |
391 | &children, &nchild); | ||
392 | 389 | ||
393 | // preen the window list of all icon windows... for better dockapp support | 390 | // preen the window list of all icon windows... for better dockapp support |
394 | for (i = 0; i < (int) nchild; i++) { | 391 | for (i = 0; i < (int) nchild; i++) { |
@@ -417,7 +414,7 @@ resource(rm, screenname, altscreenname) | |||
417 | continue; | 414 | continue; |
418 | 415 | ||
419 | XWindowAttributes attrib; | 416 | XWindowAttributes attrib; |
420 | if (XGetWindowAttributes(getBaseDisplay()->getXDisplay(), children[i], | 417 | if (XGetWindowAttributes(disp, children[i], |
421 | &attrib)) { | 418 | &attrib)) { |
422 | if (attrib.override_redirect) | 419 | if (attrib.override_redirect) |
423 | continue; | 420 | continue; |
@@ -442,23 +439,18 @@ resource(rm, screenname, altscreenname) | |||
442 | } | 439 | } |
443 | } | 440 | } |
444 | 441 | ||
445 | if (! resource.sloppy_focus) | 442 | if (! resource.sloppy_focus) { |
446 | XSetInputFocus(getBaseDisplay()->getXDisplay(), m_toolbar->getWindowID(), | 443 | XSetInputFocus(disp, m_toolbar->getWindowID(), |
447 | RevertToParent, CurrentTime); | 444 | RevertToParent, CurrentTime); |
445 | } | ||
448 | 446 | ||
449 | XFree(children); | 447 | XFree(children); |
450 | XFlush(getBaseDisplay()->getXDisplay()); | 448 | XFlush(disp); |
451 | } | ||
452 | |||
453 | namespace { | ||
454 | template<typename T> | ||
455 | void delete_obj(T * obj) { | ||
456 | delete obj; | ||
457 | } | ||
458 | } | 449 | } |
459 | 450 | ||
460 | BScreen::~BScreen() { | 451 | BScreen::~BScreen() { |
461 | if (! managed) return; | 452 | if (! managed) |
453 | return; | ||
462 | 454 | ||
463 | if (geom_pixmap != None) | 455 | if (geom_pixmap != None) |
464 | image_control->removeImage(geom_pixmap); | 456 | image_control->removeImage(geom_pixmap); |
@@ -494,10 +486,6 @@ BScreen::~BScreen() { | |||
494 | delete m_iconmenu; | 486 | delete m_iconmenu; |
495 | delete configmenu; | 487 | delete configmenu; |
496 | 488 | ||
497 | #ifdef SLIT | ||
498 | delete slit; | ||
499 | #endif // SLIT | ||
500 | |||
501 | delete image_control; | 489 | delete image_control; |
502 | 490 | ||
503 | delete theme; | 491 | delete theme; |
@@ -581,7 +569,7 @@ void BScreen::reconfigure() { | |||
581 | m_toolbar->reconfigure(); | 569 | m_toolbar->reconfigure(); |
582 | 570 | ||
583 | #ifdef SLIT | 571 | #ifdef SLIT |
584 | slit->reconfigure(); | 572 | m_slit->reconfigure(); |
585 | #endif // SLIT | 573 | #endif // SLIT |
586 | 574 | ||
587 | //reconfigure workspaces | 575 | //reconfigure workspaces |
@@ -973,14 +961,14 @@ void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) { | |||
973 | session_stack[i++] = configmenu->windowID(); | 961 | session_stack[i++] = configmenu->windowID(); |
974 | 962 | ||
975 | #ifdef SLIT | 963 | #ifdef SLIT |
976 | session_stack[i++] = slit->menu().getDirectionmenu().windowID(); | 964 | session_stack[i++] = m_slit->menu().getDirectionmenu().windowID(); |
977 | session_stack[i++] = slit->menu().getPlacementmenu().windowID(); | 965 | session_stack[i++] = m_slit->menu().getPlacementmenu().windowID(); |
978 | #ifdef XINERAMA | 966 | #ifdef XINERAMA |
979 | if (hasXinerama()) { | 967 | if (hasXinerama()) { |
980 | session_stack[i++] = slit->menu().getHeadmenu()->windowID(); | 968 | session_stack[i++] = m_slit->menu().getHeadmenu()->windowID(); |
981 | } | 969 | } |
982 | #endif // XINERAMA | 970 | #endif // XINERAMA |
983 | session_stack[i++] = slit->menu().windowID(); | 971 | session_stack[i++] = m_slit->menu().windowID(); |
984 | #endif // SLIT | 972 | #endif // SLIT |
985 | 973 | ||
986 | session_stack[i++] = | 974 | session_stack[i++] = |
@@ -1002,9 +990,9 @@ void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) { | |||
1002 | if (m_toolbar->isOnTop()) | 990 | if (m_toolbar->isOnTop()) |
1003 | session_stack[i++] = m_toolbar->getWindowID(); | 991 | session_stack[i++] = m_toolbar->getWindowID(); |
1004 | 992 | ||
1005 | #ifdef SLIT | 993 | #ifdef SLIT |
1006 | if (slit->isOnTop()) | 994 | if (m_slit->isOnTop()) |
1007 | session_stack[i++] = slit->getWindowID(); | 995 | session_stack[i++] = m_slit->getWindowID(); |
1008 | #endif // SLIT | 996 | #endif // SLIT |
1009 | if (!workspace_stack.empty()) { | 997 | if (!workspace_stack.empty()) { |
1010 | Workspace::Stack::const_reverse_iterator it = workspace_stack.rbegin(); | 998 | Workspace::Stack::const_reverse_iterator it = workspace_stack.rbegin(); |
@@ -1554,8 +1542,8 @@ void BScreen::shutdown() { | |||
1554 | } | 1542 | } |
1555 | } | 1543 | } |
1556 | 1544 | ||
1557 | #ifdef SLIT | 1545 | #ifdef SLIT |
1558 | slit->shutdown(); | 1546 | m_slit->shutdown(); |
1559 | #endif // SLIT | 1547 | #endif // SLIT |
1560 | 1548 | ||
1561 | } | 1549 | } |