Prevent move/resize event when handling a maximize event

This commit is contained in:
Benjamin Port 2020-06-30 16:02:30 +02:00 committed by Benjamin Port
parent 2d13bc3aa8
commit 84b8d866e6
2 changed files with 28 additions and 6 deletions

View file

@ -81,6 +81,7 @@ private Q_SLOTS:
void testDestroyMoveClient();
void testDestroyResizeClient();
void testSetFullScreenWhenMoving();
void testSetMaximizeWhenMoving();
private:
KWayland::Client::ConnectionThread *m_connection = nullptr;
@ -1125,15 +1126,35 @@ void MoveResizeWindowTest::testSetFullScreenWhenMoving()
auto client = Test::renderAndWaitForShown(surface.data(), QSize(500, 800), Qt::blue);
QVERIFY(client);
// The client should receive a configure event upon becoming active.
QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested);
QVERIFY(configureRequestedSpy.isValid());
QVERIFY(configureRequestedSpy.wait());
workspace()->slotWindowMove();
QCOMPARE(client->isMove(), true);
client->setFullScreen(true);
QCOMPARE(client->isFullScreen(), true);
QCOMPARE(client->isMove(), false);
QCOMPARE(workspace()->moveResizeClient(), nullptr);
// Let's pretend that the client crashed.
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(client));
}
void MoveResizeWindowTest::testSetMaximizeWhenMoving()
{
// Ensure we disable moving event when changeMaximize is triggered
using namespace KWayland::Client;
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
// let's render
auto client = Test::renderAndWaitForShown(surface.data(), QSize(500, 800), Qt::blue);
QVERIFY(client);
workspace()->slotWindowMove();
QCOMPARE(client->isMove(), true);
client->setMaximize(true, true);
QCOMPARE(client->isMove(), false);
QCOMPARE(workspace()->moveResizeClient(), nullptr);
// Let's pretend that the client crashed.

View file

@ -1757,6 +1757,7 @@ void XdgToplevelClient::changeMaximize(bool horizontal, bool vertical, bool adju
}
StackingUpdatesBlocker blocker(workspace());
dontMoveResize();
// call into decoration update borders
if (isDecorated() && decoration()->client() && !(options->borderlessMaximizedWindows() && m_requestedMaximizeMode == KWin::MaximizeFull)) {