placement: keep the titlebar in the screen with centered placement

...even if the window is larger than the screen.

BUG: 489500
This commit is contained in:
Xaver Hugl 2024-07-22 23:42:16 +02:00
parent 0e25405151
commit d548ade3a6

View file

@ -446,8 +446,8 @@ void Placement::placeCentered(Window *c, const QRectF &area, PlacementPolicy /*n
return;
}
const int xp = area.left() + (area.width() - c->width()) / 2;
const int yp = area.top() + (area.height() - c->height()) / 2;
const int xp = std::max(area.left() + (area.width() - c->width()) / 2, area.left());
const int yp = std::max(area.top() + (area.height() - c->height()) / 2, area.top());
// place the window
c->move(QPoint(xp, yp));