From 8445008e85e8724e060eef5ef724106330cff7b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 18 Jul 2016 08:22:33 +0200 Subject: [PATCH] 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 --- abstract_client.cpp | 6 ++++++ autotests/integration/plasmawindow_test.cpp | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/abstract_client.cpp b/abstract_client.cpp index a222ad24eb..a15989a5e7 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -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] { diff --git a/autotests/integration/plasmawindow_test.cpp b/autotests/integration/plasmawindow_test.cpp index c98a18bb7d..45345afb00 100644 --- a/autotests/integration/plasmawindow_test.cpp +++ b/autotests/integration/plasmawindow_test.cpp @@ -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);