Clean up Placement::placeSmart()

Avoid using Window::frameGeometry() because its position is invalid.

In the future, the XdgToplevelWindow would need to run the placement
code before updating the Window::frameGeometry(). In order to prepare
for that, this change also makes placeSmart() pull the window size from
a cached QSizeF() object.
wilder/Plasma/6.2
Vlad Zahorodnii 2 years ago
parent 646f071291
commit 6379b8b01a
  1. 7
      src/placement.cpp

@ -178,7 +178,8 @@ void Placement::placeSmart(Window *window, const QRectF &area, PlacementPolicy /
* with ideas from xfce.
*/
if (!window->frameGeometry().isValid()) {
const QSizeF size = window->size();
if (size.isEmpty()) {
return;
}
@ -199,8 +200,8 @@ void Placement::placeSmart(Window *window, const QRectF &area, PlacementPolicy /
y_optimal = y;
// client gabarit
int ch = std::ceil(window->height());
int cw = std::ceil(window->width());
int ch = std::ceil(size.height());
int cw = std::ceil(size.width());
// Explicitly converts those to int to avoid accidentally
// mixing ints and qreal in the calculations below.

Loading…
Cancel
Save