X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FWorkspace.cc;h=5982f878a8bf2631394a043b73fd613ddeaa551d;hb=e81b9d6a722b45f8895e70aa108ba4f879b48572;hp=256ad3da9845c18c6f1b8f3b7f7a7d53eb14a32b;hpb=a0dbb0e13f19ac4cc2dddf3d94723174971df6d2;p=chaz%2Fopenbox diff --git a/src/Workspace.cc b/src/Workspace.cc index 256ad3da..5982f878 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -71,8 +71,7 @@ Workspace::Workspace(BScreen &scrn, int i) : screen(scrn) { lastfocus = (OpenboxWindow *) 0; name = (char *) 0; - char *tmp = screen.getNameOfWorkspace(id); - setName(tmp); + setName(screen.getNameOfWorkspace(id)); } @@ -87,8 +86,6 @@ Workspace::~Workspace(void) { const int Workspace::addWindow(OpenboxWindow *w, Bool place) { if (! w) return -1; - if (place) placeWindow(*w); - w->setWorkspace(id); w->setWindowNumber(_windows.size()); @@ -102,6 +99,8 @@ const int Workspace::addWindow(OpenboxWindow *w, Bool place) { raiseWindow(w); + if (place) placeWindow(*w); + return w->getWindowNumber(); } @@ -120,8 +119,6 @@ const int Workspace::removeWindow(OpenboxWindow *w) { _zorder.empty() || // click focus but no windows !_zorder.front()->setInputFocus()) { // tried window, but wont focus screen.getOpenbox().focusWindow((OpenboxWindow *) 0); - XSetInputFocus(screen.getOpenbox().getXDisplay(), - PointerRoot, None, CurrentTime); } } } @@ -297,7 +294,7 @@ void Workspace::setCurrent(void) { } -void Workspace::setName(char *new_name) { +void Workspace::setName(const char *new_name) { if (name) delete [] name; @@ -316,10 +313,8 @@ void Workspace::setName(char *new_name) { void Workspace::shutdown(void) { - while (!_windows.empty()) { + while (!_windows.empty()) _windows[0]->restore(); - delete _windows[0]; - } } static rectList calcSpace(const Rect &win, const rectList &spaces) { @@ -420,7 +415,8 @@ Point *Workspace::bestFitPlacement(const Size &win_size, const Rect &space) { spaces.push_back(space); //initially the entire screen is free //Find Free Spaces - for (winVect::iterator it = _windows.begin(); it != _windows.end(); ++it) + winVect::iterator it; + for (it = _windows.begin(); it != _windows.end(); ++it) spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4), spaces); @@ -474,7 +470,8 @@ Point *Workspace::rowSmartPlacement(const Size &win_size, const Rect &space) { spaces.push_back(space); //initially the entire screen is free //Find Free Spaces - for (winVect::iterator it = _windows.begin(); it != _windows.end(); ++it) + winVect::iterator it; + for (it = _windows.begin(); it != _windows.end(); ++it) spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4), spaces); //Sort spaces by preference @@ -514,7 +511,8 @@ Point *Workspace::colSmartPlacement(const Size &win_size, const Rect &space) { spaces.push_back(space); //initially the entire screen is free //Find Free Spaces - for (winVect::iterator it = _windows.begin(); it != _windows.end(); ++it) + winVect::iterator it; + for (it = _windows.begin(); it != _windows.end(); ++it) spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4), spaces); //Sort spaces by user preference