| 958 | } |
| 959 | |
| 960 | RectF Window::keepInArea(RectF geometry, RectF area, bool partial) const |
| 961 | { |
| 962 | if (partial) { |
| 963 | // increase the area so that can have only 100 pixels in the area |
| 964 | const RectF geometry = moveResizeGeometry(); |
| 965 | area.setLeft(std::min(area.left() - geometry.width() + 100, area.left())); |
| 966 | area.setTop(std::min(area.top() - geometry.height() + 100, area.top())); |
| 967 | area.setRight(std::max(area.right() + geometry.width() - 100, area.right())); |
| 968 | area.setBottom(std::max(area.bottom() + geometry.height() - 100, area.bottom())); |
| 969 | } |
| 970 | if (!partial) { |
| 971 | // resize to fit into area |
| 972 | if (area.width() < geometry.width() || area.height() < geometry.height()) { |
| 973 | geometry = resizeWithChecks(geometry, geometry.size().boundedTo(area.size())); |
| 974 | } |
| 975 | } |
| 976 | |
| 977 | if (geometry.right() > area.right() && geometry.width() <= area.width()) { |
| 978 | geometry.moveRight(area.right()); |
| 979 | } |
| 980 | if (geometry.bottom() > area.bottom() && geometry.height() <= area.height()) { |
| 981 | geometry.moveBottom(area.bottom()); |
| 982 | } |
| 983 | |
| 984 | if (geometry.left() < area.left()) { |
| 985 | geometry.moveLeft(area.left()); |
| 986 | } |
| 987 | if (geometry.top() < area.top()) { |
| 988 | geometry.moveTop(area.top()); |
| 989 | } |
| 990 | return geometry; |
| 991 | } |
| 992 | |
| 993 | /** |
| 994 | * Returns the maximum client size, not the maximum frame size. |
no test coverage detected