[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.
icc-effect-5.14.5
Martin Gräßlin 2015-10-14 16:34:19 +02:00
parent 5558d62220
commit a2b83bffc5
2 changed files with 26 additions and 10 deletions

View File

@ -151,20 +151,21 @@ void QuickTilingTest::testQuickTiling_data()
{
QTest::addColumn<AbstractClient::QuickTileMode>("mode");
QTest::addColumn<QRect>("expectedGeometry");
QTest::addColumn<QRect>("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()

View File

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