diff --git a/abstract_client.cpp b/abstract_client.cpp index f86dd84389..cfa7f93f31 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -69,6 +69,18 @@ AbstractClient::AbstractClient() connect(this, &AbstractClient::paletteChanged, this, &AbstractClient::triggerDecorationRepaint); connect(Decoration::DecorationBridge::self(), &QObject::destroyed, this, &AbstractClient::destroyDecoration); + + // replace on-screen-display on size changes + connect(this, &AbstractClient::geometryShapeChanged, this, + [this] (Toplevel *c, const QRect &old) { + Q_UNUSED(c) + if (isOnScreenDisplay() && !geometry().isEmpty() && old.size() != geometry().size()) { + QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop()); + Placement::self()->place(this, area); + setGeometryRestore(geometry()); + } + } + ); } AbstractClient::~AbstractClient() diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp index 7f58936b0a..5cb620c779 100644 --- a/autotests/integration/plasma_surface_test.cpp +++ b/autotests/integration/plasma_surface_test.cpp @@ -244,6 +244,13 @@ void PlasmaSurfaceTest::testOSDPlacement() QCOMPARE(screens()->geometry(1), geometries.at(1)); QCOMPARE(c->geometry(), QRect(590, 649, 100, 50)); + + // change size of window + QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryShapeChanged); + QVERIFY(geometryChangedSpy.isValid()); + Test::render(surface.data(), QSize(200, 100), Qt::red); + QVERIFY(geometryChangedSpy.wait()); + QCOMPARE(c->geometry(), QRect(540, 616, 200, 100)); } void PlasmaSurfaceTest::testPanelTypeHasStrut_data()