- for (OpenboxWindow *cur=it.current(); cur!=NULL; it++, cur=it.current())
- spaces = calcSpace(cur->area().Inflate(screen.getBorderWidth() * 4),
- spaces);
-
- //Find first space that fits the window
- best = NULL;
- for (siter=spaces.begin(); siter!=spaces.end(); ++siter) {
- if ((siter->w() >= win_size.w()) && (siter->h() >= win_size.h())) {
- if (best==NULL)
- best = siter;
- else if(siter->w()*siter->h()<best->h()*best->w())
- best = siter;
+ BlackboxWindowList::const_iterator wit = windowList.begin(),
+ end = windowList.end();
+ Rect tmp;
+ for (; wit != end; ++wit) {
+ const BlackboxWindow* const curr = *wit;
+
+ if (curr->isShaded()) continue;
+
+ tmp.setRect(curr->frameRect().x(), curr->frameRect().y(),
+ curr->frameRect().width() + screen->getBorderWidth(),
+ curr->frameRect().height() + screen->getBorderWidth());
+
+ spaces = calcSpace(tmp, spaces);
+ }
+
+ if (screen->getPlacementPolicy() == BScreen::RowSmartPlacement) {
+ if(screen->getRowPlacementDirection() == BScreen::LeftRight) {
+ if(screen->getColPlacementDirection() == BScreen::TopBottom)
+ std::sort(spaces.begin(), spaces.end(), rowLRTB);
+ else
+ std::sort(spaces.begin(), spaces.end(), rowLRBT);
+ } else {
+ if(screen->getColPlacementDirection() == BScreen::TopBottom)
+ std::sort(spaces.begin(), spaces.end(), rowRLTB);
+ else
+ std::sort(spaces.begin(), spaces.end(), rowRLBT);
+ }
+ } else {
+ if(screen->getColPlacementDirection() == BScreen::TopBottom) {
+ if(screen->getRowPlacementDirection() == BScreen::LeftRight)
+ std::sort(spaces.begin(), spaces.end(), colLRTB);
+ else
+ std::sort(spaces.begin(), spaces.end(), colRLTB);
+ } else {
+ if(screen->getRowPlacementDirection() == BScreen::LeftRight)
+ std::sort(spaces.begin(), spaces.end(), colLRBT);
+ else
+ std::sort(spaces.begin(), spaces.end(), colRLBT);