* Decide whether a given rectangle is a good place to open a completely visible new window. * The new window should be within screen borders, and not overlap with another already * existing window (except for the main window in the background). * @param left Left edge of the rectangle * @param top Top edge of the rectangle * @param width Width of the rectangle * @param height Heigh
| 1540 | * @return Boolean indication that the rectangle is a good place for the new window |
| 1541 | */ |
| 1542 | static bool IsGoodAutoPlace1(int left, int top, int width, int height, int toolbar_y, Point &pos) |
| 1543 | { |
| 1544 | int right = width + left; |
| 1545 | int bottom = height + top; |
| 1546 | |
| 1547 | if (left < 0 || top < toolbar_y || right > _screen.width || bottom > _screen.height) return false; |
| 1548 | |
| 1549 | /* Make sure it is not obscured by any window. */ |
| 1550 | for (const Window *w : Window::Iterate()) { |
| 1551 | if (w->window_class == WC_MAIN_WINDOW) continue; |
| 1552 | |
| 1553 | if (right > w->left && |
| 1554 | w->left + w->width > left && |
| 1555 | bottom > w->top && |
| 1556 | w->top + w->height > top) { |
| 1557 | return false; |
| 1558 | } |
| 1559 | } |
| 1560 | |
| 1561 | pos.x = left; |
| 1562 | pos.y = top; |
| 1563 | return true; |
| 1564 | } |
| 1565 | |
| 1566 | /** |
| 1567 | * Decide whether a given rectangle is a good place to open a mostly visible new window. |
no outgoing calls
no test coverage detected