From a2b83bffc5aeb764da02ab1e740265a5cb3a1ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 14 Oct 2015 16:34:19 +0200 Subject: [PATCH] [wayland] Update geometry in ShellClient::setGeometry directly if size didn't change If the size is the same it's basically just a window movement. That's nothing we need to roundtrip to the client, but can adjust the geometry change directly. The quick tiling test is adjusted to test this together with sendToScreen. Each window is also sent to the next screen to verify the state doesn't change and geometry is updated. Note: the flag for quick maximization seems to get lost in this setup. --- autotests/wayland/quick_tiling_test.cpp | 28 +++++++++++++++++-------- shell_client.cpp | 8 ++++++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/autotests/wayland/quick_tiling_test.cpp b/autotests/wayland/quick_tiling_test.cpp index b81f892fc1..2ab3afec9c 100644 --- a/autotests/wayland/quick_tiling_test.cpp +++ b/autotests/wayland/quick_tiling_test.cpp @@ -151,20 +151,21 @@ void QuickTilingTest::testQuickTiling_data() { QTest::addColumn("mode"); QTest::addColumn("expectedGeometry"); + QTest::addColumn("secondScreen"); #define FLAG(name) AbstractClient::QuickTileMode(AbstractClient::QuickTile##name) - QTest::newRow("left") << FLAG(Left) << QRect(0, 0, 640, 1024); - QTest::newRow("top") << FLAG(Top) << QRect(0, 0, 1280, 512); - QTest::newRow("right") << FLAG(Right) << QRect(640, 0, 640, 1024); - QTest::newRow("bottom") << FLAG(Bottom) << QRect(0, 512, 1280, 512); + QTest::newRow("left") << FLAG(Left) << QRect(0, 0, 640, 1024) << QRect(1280, 0, 640, 1024); + QTest::newRow("top") << FLAG(Top) << QRect(0, 0, 1280, 512) << QRect(1280, 0, 1280, 512); + QTest::newRow("right") << FLAG(Right) << QRect(640, 0, 640, 1024) << QRect(1920, 0, 640, 1024); + QTest::newRow("bottom") << FLAG(Bottom) << QRect(0, 512, 1280, 512) << QRect(1280, 512, 1280, 512); - QTest::newRow("top left") << (FLAG(Left) | FLAG(Top)) << QRect(0, 0, 640, 512); - QTest::newRow("top right") << (FLAG(Right) | FLAG(Top)) << QRect(640, 0, 640, 512); - QTest::newRow("bottom left") << (FLAG(Left) | FLAG(Bottom)) << QRect(0, 512, 640, 512); - QTest::newRow("bottom right") << (FLAG(Right) | FLAG(Bottom)) << QRect(640, 512, 640, 512); + QTest::newRow("top left") << (FLAG(Left) | FLAG(Top)) << QRect(0, 0, 640, 512) << QRect(1280, 0, 640, 512); + QTest::newRow("top right") << (FLAG(Right) | FLAG(Top)) << QRect(640, 0, 640, 512) << QRect(1920, 0, 640, 512); + QTest::newRow("bottom left") << (FLAG(Left) | FLAG(Bottom)) << QRect(0, 512, 640, 512) << QRect(1280, 512, 640, 512); + QTest::newRow("bottom right") << (FLAG(Right) | FLAG(Bottom)) << QRect(640, 512, 640, 512) << QRect(1920, 512, 640, 512); - QTest::newRow("maximize") << FLAG(Maximize) << QRect(0, 0, 1280, 1024); + QTest::newRow("maximize") << FLAG(Maximize) << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024); #undef FLAG } @@ -227,6 +228,15 @@ void QuickTilingTest::testQuickTiling() QVERIFY(geometryChangedSpy.wait()); QCOMPARE(geometryChangedSpy.count(), 1); QCOMPARE(c->geometry(), expectedGeometry); + + // send window to other screen + QCOMPARE(c->screen(), 0); + c->sendToScreen(1); + QCOMPARE(c->screen(), 1); + // quick tile should not be changed + QEXPECT_FAIL("maximize", "Maximize loses the state", Continue); + QCOMPARE(c->quickTileMode(), mode); + QTEST(c->geometry(), "secondScreen"); } void QuickTilingTest::testQuickMaximizing_data() diff --git a/shell_client.cpp b/shell_client.cpp index 1c9af37419..6c4af4b60a 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -254,7 +254,13 @@ void ShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) { Q_UNUSED(force) // TODO: better merge with Client's implementation - requestGeometry(QRect(x, y, w, h)); + if (QSize(w, h) == geom.size()) { + // size didn't change, update directly + doSetGeometry(QRect(x, y, w, h)); + } else { + // size did change, Client needs to provide a new buffer + requestGeometry(QRect(x, y, w, h)); + } } void ShellClient::doSetGeometry(const QRect &rect)