diff options
-rw-r--r-- | src/Screen.cc | 49 | ||||
-rw-r--r-- | src/Screen.hh | 2 | ||||
-rw-r--r-- | src/Toolbar.cc | 5 | ||||
-rw-r--r-- | src/fluxbox.cc | 57 | ||||
-rw-r--r-- | 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 @@ | |||
87 | class Slit {}; | 87 | class Slit {}; |
88 | #endif // SLIT | 88 | #endif // SLIT |
89 | 89 | ||
90 | #ifdef USE_TOOLBAR | ||
91 | #include "Toolbar.hh" | ||
92 | #else | ||
93 | class Toolbar {}; | ||
94 | #endif // USE_TOOLBAR | ||
95 | |||
90 | #ifdef STDC_HEADERS | 96 | #ifdef STDC_HEADERS |
91 | #include <sys/types.h> | 97 | #include <sys/types.h> |
92 | #endif // STDC_HEADERS | 98 | #endif // STDC_HEADERS |
@@ -121,6 +127,10 @@ extern "C" { | |||
121 | } | 127 | } |
122 | #endif // XINERAMA | 128 | #endif // XINERAMA |
123 | 129 | ||
130 | #ifdef HAVE_RANDR | ||
131 | #include <X11/extensions/Xrandr.h> | ||
132 | #endif // HAVE_RANDR | ||
133 | |||
124 | #include <iostream> | 134 | #include <iostream> |
125 | #include <algorithm> | 135 | #include <algorithm> |
126 | #include <functional> | 136 | #include <functional> |
@@ -354,6 +364,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
354 | 364 | ||
355 | 365 | ||
356 | Display *disp = m_root_window.display(); | 366 | Display *disp = m_root_window.display(); |
367 | Fluxbox *fluxbox = Fluxbox::instance(); | ||
357 | 368 | ||
358 | initXinerama(); | 369 | initXinerama(); |
359 | 370 | ||
@@ -375,6 +386,15 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
375 | return; | 386 | return; |
376 | } | 387 | } |
377 | 388 | ||
389 | // we're going to manage the screen, so now add our pid | ||
390 | #ifdef HAVE_GETPID | ||
391 | pid_t bpid = getpid(); | ||
392 | |||
393 | rootWindow().changeProperty(fluxbox->getFluxboxPidAtom(), XA_CARDINAL, | ||
394 | sizeof(pid_t) * 8, PropModeReplace, | ||
395 | (unsigned char *) &bpid, 1); | ||
396 | #endif // HAVE_GETPID | ||
397 | |||
378 | // check if we're the first EWMH compliant window manager on this screen | 398 | // check if we're the first EWMH compliant window manager on this screen |
379 | Atom wm_check = XInternAtom(disp, "_NET_SUPPORTING_WM_CHECK", False); | 399 | Atom wm_check = XInternAtom(disp, "_NET_SUPPORTING_WM_CHECK", False); |
380 | Atom xa_ret_type; | 400 | Atom xa_ret_type; |
@@ -391,6 +411,19 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
391 | // TODO fluxgen: check if this is the right place | 411 | // TODO fluxgen: check if this is the right place |
392 | m_head_areas = new HeadArea[numHeads() ? numHeads() : 1]; | 412 | m_head_areas = new HeadArea[numHeads() ? numHeads() : 1]; |
393 | 413 | ||
414 | #ifdef HAVE_RANDR | ||
415 | // setup RANDR for this screens root window | ||
416 | // we need to determine if we should use old randr select input function or not | ||
417 | #ifdef X_RRScreenChangeSelectInput | ||
418 | // use old set randr event | ||
419 | XRRScreenChangeSelectInput(disp, rootWindow().window(), True); | ||
420 | #else | ||
421 | XRRSelectInput(disp, rootWindow().window(), | ||
422 | RRScreenChangeNotifyMask); | ||
423 | #endif // X_RRScreenChangeSelectInput | ||
424 | |||
425 | #endif // HAVE_RANDR | ||
426 | |||
394 | _FB_USES_NLS; | 427 | _FB_USES_NLS; |
395 | 428 | ||
396 | fprintf(stderr, _FB_CONSOLETEXT(Screen, ManagingScreen, | 429 | fprintf(stderr, _FB_CONSOLETEXT(Screen, ManagingScreen, |
@@ -409,7 +442,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
409 | rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); | 442 | rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); |
410 | 443 | ||
411 | // load this screens resources | 444 | // load this screens resources |
412 | Fluxbox *fluxbox = Fluxbox::instance(); | ||
413 | fluxbox->load_rc(*this); | 445 | fluxbox->load_rc(*this); |
414 | 446 | ||
415 | // setup image cache engine | 447 | // setup image cache engine |
@@ -517,10 +549,11 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
517 | 549 | ||
518 | BScreen::~BScreen() { | 550 | BScreen::~BScreen() { |
519 | 551 | ||
520 | |||
521 | if (! managed) | 552 | if (! managed) |
522 | return; | 553 | return; |
523 | 554 | ||
555 | m_toolbar.reset(0); | ||
556 | |||
524 | FbTk::EventManager *evm = FbTk::EventManager::instance(); | 557 | FbTk::EventManager *evm = FbTk::EventManager::instance(); |
525 | evm->remove(rootWindow()); | 558 | evm->remove(rootWindow()); |
526 | Keys *keys = Fluxbox::instance()->keys(); | 559 | Keys *keys = Fluxbox::instance()->keys(); |
@@ -685,9 +718,19 @@ void BScreen::initWindows() { | |||
685 | children[i] = None; // we dont need this anymore, since we already created a window for it | 718 | children[i] = None; // we dont need this anymore, since we already created a window for it |
686 | } | 719 | } |
687 | 720 | ||
688 | |||
689 | XFree(children); | 721 | XFree(children); |
690 | 722 | ||
723 | // now, show slit and toolbar | ||
724 | #ifdef SLIT | ||
725 | if (slit()) | ||
726 | slit()->show(); | ||
727 | #endif // SLIT | ||
728 | |||
729 | #ifdef USE_TOOLBAR | ||
730 | m_toolbar.reset(new Toolbar(*this, | ||
731 | *layerManager().getLayer(::Layer::NORMAL))); | ||
732 | #endif // USE_TOOLBAR | ||
733 | |||
691 | } | 734 | } |
692 | 735 | ||
693 | unsigned int BScreen::currentWorkspaceID() const { | 736 | 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; | |||
59 | class Workspace; | 59 | class Workspace; |
60 | class Strut; | 60 | class Strut; |
61 | class Slit; | 61 | class Slit; |
62 | class Toolbar; | ||
62 | class HeadArea; | 63 | class HeadArea; |
63 | class FocusControl; | 64 | class FocusControl; |
64 | class ScreenPlacement; | 65 | class ScreenPlacement; |
@@ -516,6 +517,7 @@ private: | |||
516 | Icons m_icon_list; | 517 | Icons m_icon_list; |
517 | 518 | ||
518 | std::auto_ptr<Slit> m_slit; | 519 | std::auto_ptr<Slit> m_slit; |
520 | std::auto_ptr<Toolbar> m_toolbar; | ||
519 | 521 | ||
520 | Workspace *m_current_workspace; | 522 | Workspace *m_current_workspace; |
521 | 523 | ||
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() { | |||
369 | } | 369 | } |
370 | 370 | ||
371 | void Toolbar::reconfigure() { | 371 | void Toolbar::reconfigure() { |
372 | // wait until after windows are drawn to show toolbar at startup | 372 | updateVisibleState(); |
373 | // otherwise, it looks ugly | ||
374 | if (!Fluxbox::instance()->isStartup()) | ||
375 | updateVisibleState(); | ||
376 | 373 | ||
377 | if (!doAutoHide() && isHidden()) | 374 | if (!doAutoHide() && isHidden()) |
378 | toggleHidden(); | 375 | 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 @@ | |||
63 | #include "config.h" | 63 | #include "config.h" |
64 | #endif // HAVE_CONFIG_H | 64 | #endif // HAVE_CONFIG_H |
65 | 65 | ||
66 | #ifdef SLIT | ||
67 | #include "Slit.hh" | ||
68 | #endif // SLIT | ||
69 | #ifdef USE_GNOME | 66 | #ifdef USE_GNOME |
70 | #include "Gnome.hh" | 67 | #include "Gnome.hh" |
71 | #endif // USE_GNOME | 68 | #endif // USE_GNOME |
@@ -75,11 +72,6 @@ | |||
75 | #ifdef REMEMBER | 72 | #ifdef REMEMBER |
76 | #include "Remember.hh" | 73 | #include "Remember.hh" |
77 | #endif // REMEMBER | 74 | #endif // REMEMBER |
78 | #ifdef USE_TOOLBAR | ||
79 | #include "Toolbar.hh" | ||
80 | #else | ||
81 | class Toolbar { }; | ||
82 | #endif // USE_TOOLBAR | ||
83 | 75 | ||
84 | // X headers | 76 | // X headers |
85 | #include <X11/Xlib.h> | 77 | #include <X11/Xlib.h> |
@@ -423,25 +415,11 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
423 | // | 415 | // |
424 | // m_resourcemanager.dump(); | 416 | // m_resourcemanager.dump(); |
425 | 417 | ||
426 | #ifdef USE_TOOLBAR | ||
427 | // finally, show toolbar | ||
428 | Toolbars::iterator toolbar_it = m_toolbars.begin(); | ||
429 | Toolbars::iterator toolbar_it_end = m_toolbars.end(); | ||
430 | for (; toolbar_it != toolbar_it_end; ++toolbar_it) | ||
431 | (*toolbar_it)->updateVisibleState(); | ||
432 | #endif // USE_TOOLBAR | ||
433 | |||
434 | } | 418 | } |
435 | 419 | ||
436 | 420 | ||
437 | Fluxbox::~Fluxbox() { | 421 | Fluxbox::~Fluxbox() { |
438 | 422 | ||
439 | // destroy toolbars | ||
440 | while (!m_toolbars.empty()) { | ||
441 | delete m_toolbars.back(); | ||
442 | m_toolbars.pop_back(); | ||
443 | } | ||
444 | |||
445 | // destroy atomhandlers | 423 | // destroy atomhandlers |
446 | for (AtomHandlerContainerIt it= m_atomhandler.begin(); | 424 | for (AtomHandlerContainerIt it= m_atomhandler.begin(); |
447 | it != m_atomhandler.end(); | 425 | it != m_atomhandler.end(); |
@@ -467,40 +445,9 @@ Fluxbox::~Fluxbox() { | |||
467 | 445 | ||
468 | void Fluxbox::initScreen(BScreen *screen) { | 446 | void Fluxbox::initScreen(BScreen *screen) { |
469 | 447 | ||
470 | Display* disp = display(); | ||
471 | |||
472 | // now we can create menus (which needs this screen to be in screen_list) | 448 | // now we can create menus (which needs this screen to be in screen_list) |
473 | screen->initMenus(); | 449 | screen->initMenus(); |
474 | 450 | ||
475 | #ifdef HAVE_GETPID | ||
476 | pid_t bpid = getpid(); | ||
477 | |||
478 | screen->rootWindow().changeProperty(getFluxboxPidAtom(), XA_CARDINAL, | ||
479 | sizeof(pid_t) * 8, PropModeReplace, | ||
480 | (unsigned char *) &bpid, 1); | ||
481 | #endif // HAVE_GETPID | ||
482 | |||
483 | #ifdef HAVE_RANDR | ||
484 | // setup RANDR for this screens root window | ||
485 | // we need to determine if we should use old randr select input function or not | ||
486 | #ifdef X_RRScreenChangeSelectInput | ||
487 | // use old set randr event | ||
488 | XRRScreenChangeSelectInput(disp, screen->rootWindow().window(), True); | ||
489 | #else | ||
490 | XRRSelectInput(disp, screen->rootWindow().window(), | ||
491 | RRScreenChangeNotifyMask); | ||
492 | #endif // X_RRScreenChangeSelectInput | ||
493 | |||
494 | #endif // HAVE_RANDR | ||
495 | |||
496 | |||
497 | #ifdef USE_TOOLBAR | ||
498 | m_toolbars.push_back(new Toolbar(*screen, | ||
499 | *screen->layerManager(). | ||
500 | getLayer(::Layer::NORMAL))); | ||
501 | #endif // USE_TOOLBAR | ||
502 | |||
503 | // must do this after toolbar is created | ||
504 | screen->initWindows(); | 451 | screen->initWindows(); |
505 | 452 | ||
506 | // attach screen signals to this | 453 | // attach screen signals to this |
@@ -519,10 +466,6 @@ void Fluxbox::initScreen(BScreen *screen) { | |||
519 | } | 466 | } |
520 | 467 | ||
521 | FocusControl::revertFocus(*screen); // make sure focus style is correct | 468 | FocusControl::revertFocus(*screen); // make sure focus style is correct |
522 | #ifdef SLIT | ||
523 | if (screen->slit()) | ||
524 | screen->slit()->show(); | ||
525 | #endif // SLIT | ||
526 | 469 | ||
527 | } | 470 | } |
528 | 471 | ||
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; | |||
67 | class Keys; | 67 | class Keys; |
68 | class BScreen; | 68 | class BScreen; |
69 | class FbAtoms; | 69 | class FbAtoms; |
70 | class Toolbar; | ||
71 | |||
72 | 70 | ||
73 | /// main class for the window manager. | 71 | /// main class for the window manager. |
74 | /** | 72 | /** |
@@ -277,8 +275,6 @@ private: | |||
277 | typedef AtomHandlerContainer::iterator AtomHandlerContainerIt; | 275 | typedef AtomHandlerContainer::iterator AtomHandlerContainerIt; |
278 | 276 | ||
279 | AtomHandlerContainer m_atomhandler; | 277 | AtomHandlerContainer m_atomhandler; |
280 | typedef std::vector<Toolbar *> Toolbars; | ||
281 | Toolbars m_toolbars; | ||
282 | 278 | ||
283 | bool m_starting; | 279 | bool m_starting; |
284 | bool m_restarting; | 280 | bool m_restarting; |