From 0c78da0e3a2ca8351ce269e5c43942579a1f06f7 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 16 Jan 2022 16:22:41 +0200 Subject: [PATCH] wayland: Make fullscreen and maximize mode not affect interactive resize dontInteractiveMoveResize() was added to workaround kwin sending bad configure events when double clicking mpv to make it fullscreen. With async geometry updates fixed, dontInteractiveMoveResize() can be finally removed. Another reason to remove dontInteractiveMoveResize() is that it can make kwin crash with a debug build. For example, if you enable resizing maximized windows in breeze decoration settings and resize a maximized window, kwin would eventually crash in the AbstractClient::handleInteractiveMoveResize() function because neither isInteractiveMove() nor isInteractiveResize() return true. --- .../integration/move_resize_window_test.cpp | 53 ------------------- src/xdgshellclient.cpp | 4 -- 2 files changed, 57 deletions(-) diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index 82ece3e7b1..12d5152430 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -68,8 +68,6 @@ private Q_SLOTS: void testResizeForVirtualKeyboardWithFullScreen(); void testDestroyMoveClient(); void testDestroyResizeClient(); - void testSetFullScreenWhenMoving(); - void testSetMaximizeWhenMoving(); private: KWayland::Client::ConnectionThread *m_connection = nullptr; @@ -1098,57 +1096,6 @@ 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::createXdgToplevelSurface(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->isInteractiveMove(), true); - client->setFullScreen(true); - QCOMPARE(client->isInteractiveMove(), 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(Test::createSurface()); - QVERIFY(!surface.isNull()); - - QScopedPointer shellSurface(Test::createXdgToplevelSurface(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->isInteractiveMove(), true); - client->setMaximize(true, true); - QCOMPARE(client->isInteractiveMove(), 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/src/xdgshellclient.cpp b/src/xdgshellclient.cpp index 433f9a1eb7..2289529cf6 100644 --- a/src/xdgshellclient.cpp +++ b/src/xdgshellclient.cpp @@ -1604,7 +1604,6 @@ void XdgToplevelClient::setFullScreen(bool set, bool user) if (set) { workspace()->raiseClient(this); - dontInteractiveMoveResize(); } configureDecoration(); @@ -1666,9 +1665,6 @@ void XdgToplevelClient::changeMaximize(bool horizontal, bool vertical, bool adju } StackingUpdatesBlocker blocker(workspace()); - if (m_requestedMaximizeMode != MaximizeRestore) { - dontInteractiveMoveResize(); - } // call into decoration update borders if (isDecorated() && decoration()->client() && !(options->borderlessMaximizedWindows() && m_requestedMaximizeMode == KWin::MaximizeFull)) {