+inline Point * Workspace::colSmartPlacement(const Size &win_size,
+ const Rect &space){
+ Point *pt;
+ bool placed=false;
+ int test_x, test_y;
+ 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_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->size().w() + (screen.getBorderWidth() * 4);
+ int curr_h = curr->size().h() + (screen.getBorderWidth() * 4);
+
+ if (curr->origin().x() < test_x + win_size.w() &&
+ curr->origin().x() + curr_w > test_x &&
+ curr->origin().y() < test_y + win_size.h() &&
+ curr->origin().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);
+ }
+
+ test_x += (change_x * delta_x);
+ }
+ if (placed)
+ return pt;
+ else
+ return NULL;
+}
+
+Point *const Workspace::cascadePlacement(const OpenboxWindow *const win){
+ if (((unsigned) cascade_x > (screen.size().w() / 2)) ||
+ ((unsigned) cascade_y > (screen.size().h() / 2)))
+ cascade_x = cascade_y = 32;
+
+ cascade_x += win->getTitleHeight();
+ cascade_y += win->getTitleHeight();
+
+ return new Point(cascade_x, cascade_y);
+}
+
+