+static rectList calcSpace(const OpenboxWindow &win, const rectList &spaces) {
+ rectList result;
+ rectList::const_iterator siter;
+ for(siter=spaces.begin(); siter!=spaces.end(); ++siter) {
+ if(win.getArea().Intersect(*siter)) {
+ //Check for space to the left of the window
+ if(win.getXFrame() > siter->x())
+ result.push_back(Rect(siter->x(), siter->y(),
+ win.getXFrame() - siter->x() - 1,
+ siter->h()));
+ //Check for space above the window
+ if(win.getYFrame() > siter->y())
+ result.push_back(Rect(siter->x(), siter->y(),
+ siter->w(),
+ win.getYFrame() - siter->y() - 1));
+ //Check for space to the right of the window
+ if((win.getXFrame()+win.getWidth()) <
+ (siter->x()+siter->w()))
+ result.push_back(Rect(win.getXFrame() + win.getWidth() + 1,
+ siter->y(),
+ siter->x() + siter->w() -
+ win.getXFrame() - win.getWidth() - 1,
+ siter->h()));
+ //Check for space below the window
+ if((win.getYFrame()+win.getHeight()) <
+ (siter->y()+siter->h()))
+ result.push_back(Rect(siter->x(),
+ win.getYFrame() + win.getHeight() + 1,
+ siter->w(),
+ siter->y() + siter->h()-
+ win.getYFrame() - win.getHeight() - 1));