Expose window geometry to PlasmaWindow

Summary: Needed for e.g. the pager.

Test Plan: Test case for PlasmaWindow verifies the geometry

Reviewers: #kwin, #plasma_on_wayland, hein

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2200
master
Martin Gräßlin 8 years ago
parent bec69b5705
commit 8445008e85

@ -682,6 +682,7 @@ void AbstractClient::setupWindowManagementInterface()
w->setMovable(isMovable());
w->setVirtualDesktopChangeable(true); // FIXME Matches Client::actionSupported(), but both should be implemented.
w->setParentWindow(transientFor() ? transientFor()->windowManagementInterface() : nullptr);
w->setGeometry(geom);
connect(this, &AbstractClient::skipTaskbarChanged, w,
[w, this] {
w->setSkipTaskbar(skipTaskbar());
@ -727,6 +728,11 @@ void AbstractClient::setupWindowManagementInterface()
w->setParentWindow(transientFor() ? transientFor()->windowManagementInterface() : nullptr);
}
);
connect(this, &AbstractClient::geometryChanged, w,
[w, this] {
w->setGeometry(geom);
}
);
connect(w, &PlasmaWindowInterface::closeRequested, this, [this] { closeWindow(); });
connect(w, &PlasmaWindowInterface::moveRequested, this,
[this] {

@ -159,6 +159,10 @@ void PlasmaWindowTest::testCreateDestroyX11PlasmaWindow()
QVERIFY(plasmaWindowCreatedSpy.wait());
QCOMPARE(plasmaWindowCreatedSpy.count(), 1);
QCOMPARE(m_windowManagement->windows().count(), 1);
auto pw = m_windowManagement->windows().first();
QCOMPARE(pw->geometry(), client->geometry());
QSignalSpy geometryChangedSpy(pw, &PlasmaWindow::geometryChanged);
QVERIFY(geometryChangedSpy.isValid());
QSignalSpy unmappedSpy(m_windowManagement->windows().first(), &PlasmaWindow::unmapped);
QVERIFY(unmappedSpy.isValid());
@ -172,10 +176,14 @@ void PlasmaWindowTest::testCreateDestroyX11PlasmaWindow()
workspace()->slotWindowShade();
QVERIFY(client->isShade());
QVERIFY(client->geometry() != geoBeforeShade);
QVERIFY(geometryChangedSpy.wait());
QCOMPARE(pw->geometry(), client->geometry());
// and unshade again
workspace()->slotWindowShade();
QVERIFY(!client->isShade());
QCOMPARE(client->geometry(), geoBeforeShade);
QVERIFY(geometryChangedSpy.wait());
QCOMPARE(pw->geometry(), geoBeforeShade);
// and destroy the window again
xcb_unmap_window(c.data(), w);

Loading…
Cancel
Save