From 2d13bc3aa8e6943fc169ab71310ee1ecc680a14b Mon Sep 17 00:00:00 2001 From: Benjamin Port Date: Mon, 29 Jun 2020 09:03:21 +0200 Subject: [PATCH] Prevent move/resize event when handling set full screen event BUG: 421232 --- .../integration/move_resize_window_test.cpp | 32 +++++++++++++++++++ xdgshellclient.cpp | 1 + 2 files changed, 33 insertions(+) diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index 27c2f1c1ff..2393ca3317 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -80,6 +80,7 @@ private Q_SLOTS: void testResizeForVirtualKeyboardWithFullScreen(); void testDestroyMoveClient(); void testDestroyResizeClient(); + void testSetFullScreenWhenMoving(); private: KWayland::Client::ConnectionThread *m_connection = nullptr; @@ -1109,6 +1110,37 @@ void MoveResizeWindowTest::testDestroyResizeClient() QCOMPARE(workspace()->moveResizeClient(), nullptr); } +void MoveResizeWindowTest::testSetFullScreenWhenMoving() +{ + // Ensure we disable moving event when setFullScreen is triggered + using namespace KWayland::Client; + + QScopedPointer surface(Test::createSurface()); + QVERIFY(!surface.isNull()); + + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); + QVERIFY(!shellSurface.isNull()); + + // let's render + 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)); +} } WAYLANDTEST_MAIN(KWin::MoveResizeWindowTest) diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp index f2314177d0..957d1c559d 100644 --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -1695,6 +1695,7 @@ void XdgToplevelClient::setFullScreen(bool set, bool user) } StackingUpdatesBlocker blocker1(workspace()); GeometryUpdatesBlocker blocker2(this); + dontMoveResize(); workspace()->updateClientLayer(this); // active fullscreens get different layer updateDecoration(false, false);