diff options
| author | Martin Gräßlin <mgraesslin@kde.org> | 2016-12-18 09:39:04 (GMT) |
|---|---|---|
| committer | Martin Gräßlin <mgraesslin@kde.org> | 2016-12-21 18:24:57 (GMT) |
| commit | 6383f8304711719fe22371474138efc144adc750 (patch) | |
| tree | 9fbedc24b798e6ee93c2158f6cf5f2ee3ca4da96 | |
| parent | 1c394ab6453a0740892aa7d4baa27d7eeda91678 (diff) | |
Place OSD windows again on size changes
Summary:
The position of an OSD is based on the size of the window. If the
size of the OSD changed, it would not be positioned correctly any more.
With this change the OSD window gets placed again if the size changes.
Thus it's also placed correctly even if the window changed it's size.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3720
| -rw-r--r-- | abstract_client.cpp | 12 | ||||
| -rw-r--r-- | autotests/integration/plasma_surface_test.cpp | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/abstract_client.cpp b/abstract_client.cpp index f86dd84..cfa7f93 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 7f58936..5cb620c 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() |
