wayland: Fix Qt clients not being maximized initially
Currently, Qt clients send two maximize requests separated by the initial commit. From spec's perspective, this is totally fine, the client should receive two configure events with "maximized" state. But because changeMaximize() in XdgToplevelClient and setMaximized() operate on two different maximize modes, the second maximize request will trick kwin into thinking that the client should be restored.
This commit is contained in:
parent
4acea54272
commit
a195223a8d
2 changed files with 35 additions and 1 deletions
|
@ -878,7 +878,7 @@ void AbstractClient::maximize(MaximizeMode m)
|
|||
void AbstractClient::setMaximize(bool vertically, bool horizontally)
|
||||
{
|
||||
// changeMaximize() flips the state, so change from set->flip
|
||||
const MaximizeMode oldMode = maximizeMode();
|
||||
const MaximizeMode oldMode = requestedMaximizeMode();
|
||||
changeMaximize(
|
||||
oldMode & MaximizeHorizontal ? !horizontally : horizontally,
|
||||
oldMode & MaximizeVertical ? !vertically : vertically,
|
||||
|
|
|
@ -100,6 +100,7 @@ private Q_SLOTS:
|
|||
void testXdgWindowGeometryMaximize();
|
||||
void testPointerInputTransform();
|
||||
void testReentrantSetFrameGeometry();
|
||||
void testDoubleMaximize();
|
||||
};
|
||||
|
||||
void TestXdgShellClient::initTestCase()
|
||||
|
@ -1558,5 +1559,38 @@ void TestXdgShellClient::testReentrantSetFrameGeometry()
|
|||
QVERIFY(Test::waitForWindowDestroyed(client));
|
||||
}
|
||||
|
||||
void TestXdgShellClient::testDoubleMaximize()
|
||||
{
|
||||
// This test verifies that the case where a client issues two set_maximized() requests
|
||||
// separated by the initial commit is handled properly.
|
||||
|
||||
// Create the test surface.
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly));
|
||||
shellSurface->setMaximized(true);
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
|
||||
// Wait for the compositor to respond with a configure event.
|
||||
QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested);
|
||||
QVERIFY(configureRequestedSpy.wait());
|
||||
QCOMPARE(configureRequestedSpy.count(), 1);
|
||||
QSize size = configureRequestedSpy.last().at(0).value<QSize>();
|
||||
QCOMPARE(size, QSize(1280, 1024));
|
||||
XdgShellSurface::States states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
|
||||
QVERIFY(states.testFlag(XdgShellSurface::State::Maximized));
|
||||
|
||||
// Send another set_maximized() request, but do not attach any buffer yet.
|
||||
shellSurface->setMaximized(true);
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
|
||||
// The compositor must respond with another configure event even if the state hasn't changed.
|
||||
QVERIFY(configureRequestedSpy.wait());
|
||||
QCOMPARE(configureRequestedSpy.count(), 2);
|
||||
size = configureRequestedSpy.last().at(0).value<QSize>();
|
||||
QCOMPARE(size, QSize(1280, 1024));
|
||||
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
|
||||
QVERIFY(states.testFlag(XdgShellSurface::State::Maximized));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(TestXdgShellClient)
|
||||
#include "xdgshellclient_test.moc"
|
||||
|
|
Loading…
Reference in a new issue