- return new Point(200, 0);
-}
-
-inline 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.getColPlacementDirection() == BScreen::TopBottom) ? 1 : -1);
- int change_x =
- ((screen.getRowPlacementDirection() == BScreen::LeftRight) ? 1 : -1);
- int delta_x = 8, delta_y = 8;
- LinkedListIterator<OpenboxWindow> it(windowList);
-
- test_y = (screen.getColPlacementDirection() == BScreen::TopBottom) ?
- start_pos : screen.getHeight() - win_size.h() - start_pos;
-
- while(!placed &&
- ((screen.getColPlacementDirection() == BScreen::BottomTop) ?
- test_y > 0 : test_y + win_size.h() < (signed) space.h())) {
- test_x = (screen.getRowPlacementDirection() == BScreen::LeftRight) ?
- start_pos : space.w() - win_size.w() - start_pos;
- while (!placed &&
- ((screen.getRowPlacementDirection() == 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->getWidth() + (screen.getBorderWidth() * 4);
- int curr_h =
- ((curr->isShaded()) ? curr->getTitleHeight() : curr->getHeight()) +
- (screen.getBorderWidth() * 4);
-
- if (curr->getXFrame() < test_x + win_size.w() &&
- curr->getXFrame() + curr_w > test_x &&
- curr->getYFrame() < test_y + win_size.h() &&
- curr->getYFrame() + curr_h > test_y) {
- placed = false;
- }
- }
-
- // Removed code for checking toolbar and slit
- // The space passed in should not include either
-
- if (placed) {
- place_x = test_x;
- place_y = test_y;
-
- break;
- }
-
- test_x += (change_x * delta_x);
- }
-
- test_y += (change_y * delta_y);
- }
- return new Point(place_x, place_y);
-}
-
-void Workspace::placeWindow(OpenboxWindow *win) {
- ASSERT(win != NULL);
-
- Bool placed = False;
-
- const int win_w = win->getWidth() + (screen.getBorderWidth() * 4),
- win_h = win->getHeight() + (screen.getBorderWidth() * 4),
-#ifdef SLIT
- slit_x = screen.getSlit()->getX() - screen.getBorderWidth(),
- slit_y = screen.getSlit()->getY() - screen.getBorderWidth(),
- slit_w = screen.getSlit()->getWidth() +
- (screen.getBorderWidth() * 4),
- slit_h = screen.getSlit()->getHeight() +
- (screen.getBorderWidth() * 4),
-#endif // SLIT
- toolbar_x = screen.getToolbar()->getX() - screen.getBorderWidth(),
- toolbar_y = screen.getToolbar()->getY() - screen.getBorderWidth(),
- toolbar_w = screen.getToolbar()->getWidth() +
- (screen.getBorderWidth() * 4),
- toolbar_h = screen.getToolbar()->getHeight() +
- (screen.getBorderWidth() * 4),
- start_pos = 0,
- change_y =
- ((screen.getColPlacementDirection() == BScreen::TopBottom) ? 1 : -1),
- change_x =
- ((screen.getRowPlacementDirection() == BScreen::LeftRight) ? 1 : -1),
- delta_x = 8, delta_y = 8;
-
- int test_x, test_y, place_x = 0, place_y = 0;
- LinkedListIterator<OpenboxWindow> it(windowList);
-
- Rect space(0, 0,
- screen.getWidth(),
- screen.getHeight()
- );
- Size window_size(win_w, win_h);
-
- switch (screen.getPlacementPolicy()) {
- case BScreen::BestFitPlacement: {
- Point *spot = bestFitPlacement(window_size, space);
- if (spot != NULL) {
- place_x=spot->x();
- place_y=spot->y();
- delete spot;
- placed=true;