diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp --- a/autotests/integration/plasma_surface_test.cpp +++ b/autotests/integration/plasma_surface_test.cpp @@ -232,7 +232,6 @@ QCOMPARE(screens()->geometry(0), geometries.at(0)); QCOMPARE(screens()->geometry(1), geometries.at(1)); - QEXPECT_FAIL("", "Geometry should not change due to a screen being added", Continue); QCOMPARE(c->geometry(), QRect(590, 649, 100, 50)); } diff --git a/shell_client.h b/shell_client.h --- a/shell_client.h +++ b/shell_client.h @@ -127,6 +127,9 @@ bool setupCompositing() override; void finishCompositing(ReleaseReason releaseReason = ReleaseReason::Release) override; + // TODO: const-ref + void placeIn(QRect &area); + protected: void addDamage(const QRegion &damage) override; bool belongsToSameApplication(const AbstractClient *other, bool active_hack) const override; diff --git a/shell_client.cpp b/shell_client.cpp --- a/shell_client.cpp +++ b/shell_client.cpp @@ -21,6 +21,7 @@ #include "composite.h" #include "cursor.h" #include "deleted.h" +#include "placement.h" #include "screens.h" #include "wayland_server.h" #include "workspace.h" @@ -478,7 +479,6 @@ if (m_unmapped && m_geomMaximizeRestore.isEmpty() && !geom.isEmpty()) { // use first valid geometry as restore geometry - // TODO: needs to interact with placing. The first valid geometry should be the placed one m_geomMaximizeRestore = geom; } @@ -1223,4 +1223,10 @@ Toplevel::finishCompositing(releaseReason); } +void ShellClient::placeIn(QRect &area) +{ + Placement::self()->place(this, area); + setGeometryRestore(geometry()); +} + } diff --git a/workspace.cpp b/workspace.cpp --- a/workspace.cpp +++ b/workspace.cpp @@ -381,7 +381,7 @@ placementDone = true; } if (!placementDone) { - Placement::self()->place(c, area); + c->placeIn(area); } m_allClients.append(c); if (!unconstrained_stacking_order.contains(c)) @@ -401,7 +401,7 @@ // TODO: when else should we send the client through placement? if (c->hasTransientPlacementHint()) { QRect area = clientArea(PlacementArea, Screens::self()->current(), c->desktop()); - Placement::self()->place(c, area); + c->placeIn(area); } x_stacking_dirty = true; updateStackingOrder(true);