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
remotes/origin/bshah/hwcomposer_testing
Martin Gräßlin 9 years ago
parent 1c394ab645
commit 6383f83047
  1. 12
      abstract_client.cpp
  2. 7
      autotests/integration/plasma_surface_test.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()

@ -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()

Loading…
Cancel
Save