aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc49
1 files changed, 46 insertions, 3 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 @@
87class Slit {}; 87class Slit {};
88#endif // SLIT 88#endif // SLIT
89 89
90#ifdef USE_TOOLBAR
91#include "Toolbar.hh"
92#else
93class 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
518BScreen::~BScreen() { 550BScreen::~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
693unsigned int BScreen::currentWorkspaceID() const { 736unsigned int BScreen::currentWorkspaceID() const {