Add missing size check in Placement::placeOnScreenDisplay()
In order to center a window, kwin needs to know the window size.
This commit is contained in:
parent
6379b8b01a
commit
913a850584
1 changed files with 7 additions and 2 deletions
|
@ -487,9 +487,14 @@ void Placement::placeOnScreenDisplay(Window *c, const QRect &area)
|
|||
{
|
||||
Q_ASSERT(area.isValid());
|
||||
|
||||
const QSizeF size = c->size();
|
||||
if (size.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// place at lower area of the screen
|
||||
const int x = area.left() + (area.width() - c->width()) / 2;
|
||||
const int y = area.top() + 2 * area.height() / 3 - c->height() / 2;
|
||||
const int x = area.left() + (area.width() - size.width()) / 2;
|
||||
const int y = area.top() + 2 * area.height() / 3 - size.height() / 2;
|
||||
|
||||
c->move(QPoint(x, y));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue