X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fopenbox.cc;h=80622c1c426aee4bc80796c818994dea3b081ff7;hb=a77f0fb344978bb4dafd2ad4639f3de3e090bf7b;hp=9d040e14e786b036f37d2bb9bd94fa73a56b4adf;hpb=cee305244662d352a7ad5ab7ae22f6221c064d3d;p=chaz%2Fopenbox diff --git a/src/openbox.cc b/src/openbox.cc index 9d040e14..80622c1c 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -74,6 +74,8 @@ void Openbox::signalHandler(int signal) Openbox::Openbox(int argc, char **argv) + : otk::OtkEventDispatcher(), + otk::OtkEventHandler() { struct sigaction action; @@ -128,8 +130,19 @@ Openbox::Openbox(int argc, char **argv) _cursors.ur_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ur_angle); // initialize all the screens - _screens.push_back(new OBScreen(0)); - _screens[0]->loadStyle(_config); + OBScreen *screen; + screen = new OBScreen(0, _config); + if (screen->managed()) { + _screens.push_back(screen); + _screens[0]->manageExisting(); + // XXX: "change to" the first workspace on the screen to initialize stuff + } else + delete screen; + + if (_screens.empty()) { + printf(_("No screens were found without a window manager. Exiting.\n")); + ::exit(1); + } _state = State_Normal; // done starting } @@ -139,10 +152,6 @@ Openbox::~Openbox() { _state = State_Exiting; // time to kill everything - // unmanage all windows - while (!_clients.empty()) - _xeventhandler.unmanageWindow(_clients.begin()->second); - std::for_each(_screens.begin(), _screens.end(), otk::PointerAssassin()); // close the X display @@ -237,14 +246,8 @@ void Openbox::showHelp() void Openbox::eventLoop() { while (!_doshutdown) { - if (XPending(otk::OBDisplay::display)) { - XEvent e; - XNextEvent(otk::OBDisplay::display, &e); - //process_event(&e); - _xeventhandler.handle(e); - } else { - _timermanager.fire(); - } + dispatchEvents(); // from OtkEventDispatcher + _timermanager.fire(); } } @@ -277,5 +280,6 @@ OBClient *Openbox::findClient(Window window) return (OBClient*) 0; } + }