Simplify Placement::placeMaximizing()

Window::maximize() maximizes the window regardless of size constraints.
If the window can't be maximized, just fallback to the default (centered)
placement policy.
This commit is contained in:
Vlad Zahorodnii 2024-06-10 19:20:53 +03:00
parent 3f698ab446
commit a83cd5bf2f

View file

@ -569,15 +569,9 @@ void Placement::placeMaximizing(Window *c, const QRect &area, PlacementPolicy ne
if (nextPlacement == PlacementUnknown) {
nextPlacement = PlacementCentered;
}
if (c->isMaximizable() && c->maxSize().width() >= area.width() && c->maxSize().height() >= area.height()) {
if (workspace()->clientArea(MaximizeArea, c) == area) {
c->maximize(MaximizeFull);
} else { // if the geometry doesn't match default maximize area (xinerama case?),
// it's probably better to use the given area
c->moveResize(area);
}
if (c->isMaximizable()) {
c->maximize(MaximizeFull);
} else {
c->moveResize(c->resizeWithChecks(c->moveResizeGeometry(), c->maxSize().boundedTo(area.size())));
place(c, area, nextPlacement);
}
}