X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fworkspace.cc;h=891340621e75ccfd418db12d045dd7c3845322ae;hb=ace8c8896aa13a6fc4e489277cf9c96f49175322;hp=995c50059033ef65889b07f1791e6763223c5c05;hpb=7bf96a9123a9f6b29a4c6168f7391db72f374f8a;p=chaz%2Fopenbox diff --git a/src/workspace.cc b/src/workspace.cc index 995c5005..89134062 100644 --- a/src/workspace.cc +++ b/src/workspace.cc @@ -1,25 +1,4 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -// Workspace.cc for Blackbox - an X11 Window manager -// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry -// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. #ifdef HAVE_CONFIG_H # include "../config.h" @@ -46,13 +25,15 @@ extern "C" { using std::string; #include "blackbox.hh" -#include "font.hh" +#include "otk/font.hh" +#include "otk/display.hh" #include "screen.hh" #include "util.hh" #include "window.hh" #include "workspace.hh" #include "xatom.hh" +namespace ob { Workspace::Workspace(BScreen *scrn, unsigned int i) { screen = scrn; @@ -120,7 +101,7 @@ void Workspace::removeWindow(BlackboxWindow *w, bool sticky) { // pass focus to the next appropriate window if ((w->isFocused() || w == lastfocus) && - ! screen->getBlackbox()->doShutdown()) { + screen->getBlackbox()->state() != Openbox::State_Exiting) { focusFallback(w); } @@ -209,7 +190,8 @@ void Workspace::showAll(void) { // sticky windows arent unmapped on a workspace change so we don't have ot // map them, but sometimes on a restart, another app can unmap our sticky // windows, so we map on startup always - if (! bw->isStuck() || screen->getBlackbox()->isStartup()) + if (! bw->isStuck() || + screen->getBlackbox()->state() == Openbox::State_Starting) bw->show(); } } @@ -486,13 +468,13 @@ void Workspace::setName(const string& new_name) { /* * Calculate free space available for window placement. */ -Workspace::rectList Workspace::calcSpace(const Rect &win, +Workspace::rectList Workspace::calcSpace(const otk::Rect &win, const rectList &spaces) const { - Rect isect, extra; + otk::Rect isect, extra; rectList result; rectList::const_iterator siter, end = spaces.end(); for (siter = spaces.begin(); siter != end; ++siter) { - const Rect &curr = *siter; + const otk::Rect &curr = *siter; if(! win.intersects(curr)) { result.push_back(curr); @@ -530,56 +512,56 @@ Workspace::rectList Workspace::calcSpace(const Rect &win, } -static bool rowRLBT(const Rect &first, const Rect &second) { +static bool rowRLBT(const otk::Rect &first, const otk::Rect &second) { if (first.bottom() == second.bottom()) return first.right() > second.right(); return first.bottom() > second.bottom(); } -static bool rowRLTB(const Rect &first, const Rect &second) { +static bool rowRLTB(const otk::Rect &first, const otk::Rect &second) { if (first.y() == second.y()) return first.right() > second.right(); return first.y() < second.y(); } -static bool rowLRBT(const Rect &first, const Rect &second) { +static bool rowLRBT(const otk::Rect &first, const otk::Rect &second) { if (first.bottom() == second.bottom()) return first.x() < second.x(); return first.bottom() > second.bottom(); } -static bool rowLRTB(const Rect &first, const Rect &second) { +static bool rowLRTB(const otk::Rect &first, const otk::Rect &second) { if (first.y() == second.y()) return first.x() < second.x(); return first.y() < second.y(); } -static bool colLRTB(const Rect &first, const Rect &second) { +static bool colLRTB(const otk::Rect &first, const otk::Rect &second) { if (first.x() == second.x()) return first.y() < second.y(); return first.x() < second.x(); } -static bool colLRBT(const Rect &first, const Rect &second) { +static bool colLRBT(const otk::Rect &first, const otk::Rect &second) { if (first.x() == second.x()) return first.bottom() > second.bottom(); return first.x() < second.x(); } -static bool colRLTB(const Rect &first, const Rect &second) { +static bool colRLTB(const otk::Rect &first, const otk::Rect &second) { if (first.right() == second.right()) return first.y() < second.y(); return first.right() > second.right(); } -static bool colRLBT(const Rect &first, const Rect &second) { +static bool colRLBT(const otk::Rect &first, const otk::Rect &second) { if (first.right() == second.right()) return first.bottom() > second.bottom(); return first.right() > second.right(); } -bool Workspace::smartPlacement(Rect& win) { +bool Workspace::smartPlacement(otk::Rect& win) { rectList spaces; //initially the entire screen is free @@ -600,7 +582,7 @@ bool Workspace::smartPlacement(Rect& win) { } else #endif // XINERAMA { - Rect r = screen->availableArea(); + otk::Rect r = screen->availableArea(); r.setRect(r.x() + screen->getSnapOffset(), r.y() + screen->getSnapOffset(), r.width() - screen->getSnapOffset(), @@ -611,7 +593,7 @@ bool Workspace::smartPlacement(Rect& win) { //Find Free Spaces BlackboxWindowList::const_iterator wit = windowList.begin(), end = windowList.end(); - Rect tmp; + otk::Rect tmp; for (; wit != end; ++wit) { const BlackboxWindow* const curr = *wit; @@ -665,7 +647,7 @@ bool Workspace::smartPlacement(Rect& win) { return False; //set new position based on the empty space found - const Rect& where = *sit; + const otk::Rect& where = *sit; win.setX(where.x()); win.setY(where.y()); @@ -685,14 +667,14 @@ bool Workspace::smartPlacement(Rect& win) { } -bool Workspace::underMousePlacement(Rect &win) { +bool Workspace::underMousePlacement(otk::Rect &win) { int x, y, rx, ry; Window c, r; unsigned int m; - XQueryPointer(screen->getBlackbox()->getXDisplay(), screen->getRootWindow(), + XQueryPointer(otk::OBDisplay::display, screen->getRootWindow(), &r, &c, &rx, &ry, &x, &y, &m); - Rect area; + otk::Rect area; #ifdef XINERAMA if (screen->isXineramaActive() && screen->getBlackbox()->doXineramaPlacement()) { @@ -726,8 +708,8 @@ bool Workspace::underMousePlacement(Rect &win) { } -bool Workspace::cascadePlacement(Rect &win, const int offset) { - Rect area; +bool Workspace::cascadePlacement(otk::Rect &win, const int offset) { + otk::Rect area; #ifdef XINERAMA if (screen->isXineramaActive() && @@ -766,7 +748,7 @@ bool Workspace::cascadePlacement(Rect &win, const int offset) { void Workspace::placeWindow(BlackboxWindow *win) { - Rect new_win(0, 0, win->frameRect().width(), win->frameRect().height()); + otk::Rect new_win(0, 0, win->frameRect().width(), win->frameRect().height()); bool placed = False; switch (screen->getPlacementPolicy()) { @@ -792,3 +774,5 @@ void Workspace::placeWindow(BlackboxWindow *win) { win->configure(new_win.x(), new_win.y(), new_win.width(), new_win.height()); } + +}