- if (best != NULL) {
- Point *pt = new Point(best->origin());
- if (screen.colPlacementDirection() != BScreen::TopBottom)
- pt->setY(pt->y() + (best->h() - win_size.h()));
- if (screen.rowPlacementDirection() != BScreen::LeftRight)
- pt->setX(pt->x() + (best->w() - win_size.w()));
- return pt;
- } else
- return NULL; //fall back to cascade
-}
-
-
-Point *Workspace::rowSmartPlacement(const Size &win_size, const Rect &space) {
- bool placed=false;
- int test_x, test_y, place_x = 0, place_y = 0;
- int start_pos = 0;
- int change_y =
- ((screen.colPlacementDirection() == BScreen::TopBottom) ? 1 : -1);
- int change_x =
- ((screen.rowPlacementDirection() == BScreen::LeftRight) ? 1 : -1);
- int delta_x = 8, delta_y = 8;
- LinkedListIterator<OpenboxWindow> it(windowList);
-
- test_y = (screen.colPlacementDirection() == BScreen::TopBottom) ?
- start_pos : screen.size().h() - win_size.h() - start_pos;
-
- while(!placed &&
- ((screen.colPlacementDirection() == BScreen::BottomTop) ?
- test_y > 0 : test_y + win_size.h() < (signed) space.h())) {
- test_x = (screen.rowPlacementDirection() == BScreen::LeftRight) ?
- start_pos : space.w() - win_size.w() - start_pos;
- while (!placed &&
- ((screen.rowPlacementDirection() == BScreen::RightLeft) ?
- test_x > 0 : test_x + win_size.w() < (signed) space.w())) {
- placed = true;
-
- it.reset();
- for (OpenboxWindow *curr = it.current(); placed && curr;
- it++, curr = it.current()) {
- int curr_w = curr->area().w() + (screen.getBorderWidth() * 4);
- int curr_h = curr->area().h() + (screen.getBorderWidth() * 4);
-
- if (curr->area().x() < test_x + win_size.w() &&
- curr->area().x() + curr_w > test_x &&
- curr->area().y() < test_y + win_size.h() &&
- curr->area().y() + curr_h > test_y) {
- placed = false;
- }
- }