- //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())) {
- best = siter;
- break;
+ test_x = (screen.rowPlacementDirection() == BScreen::LeftRight) ?
+ start_pos : screen.size().w() - win_size.w() - start_pos;
+
+ while(!placed &&
+ ((screen.rowPlacementDirection() == BScreen::RightLeft) ?
+ test_x > 0 : test_x + win_size.w() < (signed) space.w())) {
+ 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())){
+
+ 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;
+ }
+ }
+
+ // Removed code checking for intersection with Toolbar and Slit
+ // The space passed to this method should not include either
+
+ if (placed) {
+ pt= new Point(test_x,test_y);
+
+ break;
+ }
+
+ test_y += (change_y * delta_y);