diff --git a/autotests/integration/CMakeLists.txt b/autotests/integration/CMakeLists.txt --- a/autotests/integration/CMakeLists.txt +++ b/autotests/integration/CMakeLists.txt @@ -19,8 +19,6 @@ endif() endfunction() -integrationTest(WAYLAND_ONLY NAME testStart SRCS start_test.cpp) -integrationTest(WAYLAND_ONLY NAME testTransientNoInput SRCS transient_no_input_test.cpp) integrationTest(NAME testDontCrashGlxgears SRCS dont_crash_glxgears.cpp) integrationTest(NAME testLockScreen SRCS lockscreen.cpp) integrationTest(WAYLAND_ONLY NAME testDecorationInput SRCS decoration_input_test.cpp) diff --git a/autotests/integration/dbus_interface_test.cpp b/autotests/integration/dbus_interface_test.cpp --- a/autotests/integration/dbus_interface_test.cpp +++ b/autotests/integration/dbus_interface_test.cpp @@ -32,9 +32,7 @@ #include "wayland_server.h" #include "workspace.h" -#include #include -#include #include #include @@ -116,26 +114,23 @@ void TestDbusInterface::testGetWindowInfoShellClient_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestDbusInterface::testGetWindowInfoShellClient() { QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); QVERIFY(clientAddedSpy.isValid()); QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); - if (type != Test::ShellSurfaceType::WlShell) { - qobject_cast(shellSurface.data())->setAppId(QByteArrayLiteral("org.kde.foo")); - qobject_cast(shellSurface.data())->setTitle(QStringLiteral("Test window")); - } + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); + shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); + shellSurface->setTitle(QStringLiteral("Test window")); // now let's render Test::render(surface.data(), QSize(100, 50), Qt::blue); @@ -173,15 +168,9 @@ QCOMPARE(windowData.value(QStringLiteral("localhost")).toBool(), true); QCOMPARE(windowData.value(QStringLiteral("role")).toString(), QString()); QCOMPARE(windowData.value(QStringLiteral("resourceName")).toString(), QStringLiteral("testDbusInterface")); - if (type == Test::ShellSurfaceType::WlShell) { - QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QString()); - QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QString()); - QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QString()); - } else { - QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QStringLiteral("org.kde.foo")); - QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QStringLiteral("org.kde.foo")); - QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QStringLiteral("Test window")); - } + QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QStringLiteral("org.kde.foo")); + QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QStringLiteral("org.kde.foo")); + QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QStringLiteral("Test window")); auto verifyProperty = [client] (const QString &name) { QDBusPendingReply reply{getWindowInfo(client->internalId())}; diff --git a/autotests/integration/debug_console_test.cpp b/autotests/integration/debug_console_test.cpp --- a/autotests/integration/debug_console_test.cpp +++ b/autotests/integration/debug_console_test.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -299,10 +298,11 @@ void DebugConsoleTest::testWaylandClient_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void DebugConsoleTest::testWaylandClient() @@ -331,8 +331,8 @@ using namespace KWayland::Client; QScopedPointer surface(Test::createSurface()); QVERIFY(surface->isValid()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QVERIFY(!shellSurface.isNull()); Test::render(surface.data(), QSize(10, 10), Qt::red); diff --git a/autotests/integration/decoration_input_test.cpp b/autotests/integration/decoration_input_test.cpp --- a/autotests/integration/decoration_input_test.cpp +++ b/autotests/integration/decoration_input_test.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -88,7 +87,7 @@ void testTooltipDoesntEatKeyEvents(); private: - AbstractClient *showWindow(Test::ShellSurfaceType type); + AbstractClient *showWindow(Test::XdgShellSurfaceType type); }; #define MOTION(target) \ @@ -100,7 +99,7 @@ #define RELEASE \ kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++) -AbstractClient *DecorationInputTest::showWindow(Test::ShellSurfaceType type) +AbstractClient *DecorationInputTest::showWindow(Test::XdgShellSurfaceType type) { using namespace KWayland::Client; #define VERIFY(statement) \ @@ -112,7 +111,7 @@ Surface *surface = Test::createSurface(Test::waylandCompositor()); VERIFY(surface); - auto shellSurface = Test::createShellSurface(type, surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellSurface(type, surface, surface); VERIFY(shellSurface); auto deco = Test::waylandServerSideDecoration()->create(surface, surface); QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged); @@ -180,25 +179,22 @@ { QTest::addColumn("decoPoint"); QTest::addColumn("expectedSection"); - QTest::addColumn("type"); - - QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellStable; + QTest::addColumn("type"); + + QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; } void DecorationInputTest::testAxis() { - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -240,25 +236,22 @@ { QTest::addColumn("decoPoint"); QTest::addColumn("expectedSection"); - QTest::addColumn("type"); - - QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellStable; + QTest::addColumn("type"); + + QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; } void KWin::DecorationInputTest::testDoubleClick() { - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -301,25 +294,22 @@ { QTest::addColumn("decoPoint"); QTest::addColumn("expectedSection"); - QTest::addColumn("type"); - - QTest::newRow("topLeft") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("top") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("topRight") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell; - QTest::newRow("topLeft|xdgv5") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("top|xdgv5") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("topRight|xdgv5") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("topLeft|xdgv6") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("top|xdgv6") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("topRight|xdgv6") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("topLeft|xdgWmBase") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("top|xdgWmBase") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("topRight|xdgWmBase") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellStable; + QTest::addColumn("type"); + + QTest::newRow("topLeft|xdgv5") << QPoint(10, 10) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("top|xdgv5") << QPoint(260, 10) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("topRight|xdgv5") << QPoint(509, 10) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("topLeft|xdgv6") << QPoint(10, 10) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("top|xdgv6") << QPoint(260, 10) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("topRight|xdgv6") << QPoint(509, 10) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("topLeft|xdgWmBase") << QPoint(10, 10) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("top|xdgWmBase") << QPoint(260, 10) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("topRight|xdgWmBase") << QPoint(509, 10) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; } void KWin::DecorationInputTest::testDoubleTap() { - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -362,17 +352,16 @@ void DecorationInputTest::testHover_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void DecorationInputTest::testHover() { - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -423,29 +412,25 @@ QTest::addColumn("offset"); QTest::addColumn("offset2"); QTest::addColumn("offset3"); - QTest::addColumn("type"); - - QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::WlShell; - QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::WlShell; - QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::WlShell; - QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::WlShell; - QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellStable; + QTest::addColumn("type"); + + QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellStable; } void DecorationInputTest::testPressToMove() { - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -496,29 +481,25 @@ QTest::addColumn("offset"); QTest::addColumn("offset2"); QTest::addColumn("offset3"); - QTest::addColumn("type"); - - QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::WlShell; - QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::WlShell; - QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::WlShell; - QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::WlShell; - QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellStable; - QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellStable; + QTest::addColumn("type"); + + QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellStable; + QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellStable; } void DecorationInputTest::testTapToMove() { - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -567,22 +548,19 @@ void DecorationInputTest::testResizeOutsideWindow_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); QTest::addColumn("edge"); QTest::addColumn("expectedCursor"); - QTest::newRow("wlShell - left") << Test::ShellSurfaceType::WlShell << Qt::LeftEdge << Qt::SizeHorCursor; - QTest::newRow("xdgShellV5 - left") << Test::ShellSurfaceType::XdgShellV5 << Qt::LeftEdge << Qt::SizeHorCursor; - QTest::newRow("xdgShellV6 - left") << Test::ShellSurfaceType::XdgShellV6 << Qt::LeftEdge << Qt::SizeHorCursor; - QTest::newRow("xdgWmBase - left") << Test::ShellSurfaceType::XdgShellStable << Qt::LeftEdge << Qt::SizeHorCursor; - QTest::newRow("wlShell - right") << Test::ShellSurfaceType::WlShell << Qt::RightEdge << Qt::SizeHorCursor; - QTest::newRow("xdgShellV5 - right") << Test::ShellSurfaceType::XdgShellV5 << Qt::RightEdge << Qt::SizeHorCursor; - QTest::newRow("xdgShellV6 - right") << Test::ShellSurfaceType::XdgShellV6 << Qt::RightEdge << Qt::SizeHorCursor; - QTest::newRow("xdgWmBase - right") << Test::ShellSurfaceType::XdgShellStable << Qt::RightEdge << Qt::SizeHorCursor; - QTest::newRow("wlShell - bottom") << Test::ShellSurfaceType::WlShell << Qt::BottomEdge << Qt::SizeVerCursor; - QTest::newRow("xdgShellV5 - bottom") << Test::ShellSurfaceType::XdgShellV5 << Qt::BottomEdge << Qt::SizeVerCursor; - QTest::newRow("xdgShellV6 - bottom") << Test::ShellSurfaceType::XdgShellV6 << Qt::BottomEdge << Qt::SizeVerCursor; - QTest::newRow("xdgWmBase - bottom") << Test::ShellSurfaceType::XdgShellStable << Qt::BottomEdge << Qt::SizeVerCursor; + QTest::newRow("xdgShellV5 - left") << Test::XdgShellSurfaceType::XdgShellV5 << Qt::LeftEdge << Qt::SizeHorCursor; + QTest::newRow("xdgShellV6 - left") << Test::XdgShellSurfaceType::XdgShellV6 << Qt::LeftEdge << Qt::SizeHorCursor; + QTest::newRow("xdgWmBase - left") << Test::XdgShellSurfaceType::XdgShellStable << Qt::LeftEdge << Qt::SizeHorCursor; + QTest::newRow("xdgShellV5 - right") << Test::XdgShellSurfaceType::XdgShellV5 << Qt::RightEdge << Qt::SizeHorCursor; + QTest::newRow("xdgShellV6 - right") << Test::XdgShellSurfaceType::XdgShellV6 << Qt::RightEdge << Qt::SizeHorCursor; + QTest::newRow("xdgWmBase - right") << Test::XdgShellSurfaceType::XdgShellStable << Qt::RightEdge << Qt::SizeHorCursor; + QTest::newRow("xdgShellV5 - bottom") << Test::XdgShellSurfaceType::XdgShellV5 << Qt::BottomEdge << Qt::SizeVerCursor; + QTest::newRow("xdgShellV6 - bottom") << Test::XdgShellSurfaceType::XdgShellV6 << Qt::BottomEdge << Qt::SizeVerCursor; + QTest::newRow("xdgWmBase - bottom") << Test::XdgShellSurfaceType::XdgShellStable << Qt::BottomEdge << Qt::SizeVerCursor; } void DecorationInputTest::testResizeOutsideWindow() @@ -595,7 +573,7 @@ workspace()->slotReconfigure(); // now create window - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -640,19 +618,18 @@ QTest::addColumn("mouseButton"); QTest::addColumn("modKey"); QTest::addColumn("capsLock"); - QTest::addColumn("surfaceType"); + QTest::addColumn("surfaceType"); const QString alt = QStringLiteral("Alt"); const QString meta = QStringLiteral("Meta"); - const QVector> surfaceTypes{ - {Test::ShellSurfaceType::WlShell, QByteArrayLiteral("WlShell")}, - {Test::ShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5")}, - {Test::ShellSurfaceType::XdgShellV6, QByteArrayLiteral("XdgShellV6")}, - {Test::ShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase")}, + const QVector> surfaceTypes{ + { Test::XdgShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5") }, + { Test::XdgShellSurfaceType::XdgShellV6, QByteArrayLiteral("XdgShellV6") }, + { Test::XdgShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase") }, }; - for (const auto &type: surfaceTypes) { + for (const auto &type : surfaceTypes) { QTest::newRow("Left Alt + Left Click" + type.second) << KEY_LEFTALT << BTN_LEFT << alt << false << type.first; QTest::newRow("Left Alt + Right Click" + type.second) << KEY_LEFTALT << BTN_RIGHT << alt << false << type.first; QTest::newRow("Left Alt + Middle Click" + type.second) << KEY_LEFTALT << BTN_MIDDLE << alt << false << type.first; @@ -703,7 +680,7 @@ QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); // create a window - QFETCH(Test::ShellSurfaceType, surfaceType); + QFETCH(Test::XdgShellSurfaceType, surfaceType); AbstractClient *c = showWindow(surfaceType); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -740,19 +717,18 @@ QTest::addColumn("modifierKey"); QTest::addColumn("modKey"); QTest::addColumn("capsLock"); - QTest::addColumn("surfaceType"); + QTest::addColumn("surfaceType"); const QString alt = QStringLiteral("Alt"); const QString meta = QStringLiteral("Meta"); - const QVector> surfaceTypes{ - {Test::ShellSurfaceType::WlShell, QByteArrayLiteral("WlShell")}, - {Test::ShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5")}, - {Test::ShellSurfaceType::XdgShellV6, QByteArrayLiteral("XdgShellV6")}, - {Test::ShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase")}, + const QVector> surfaceTypes{ + { Test::XdgShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5") }, + { Test::XdgShellSurfaceType::XdgShellV6, QByteArrayLiteral("XdgShellV6") }, + { Test::XdgShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase") }, }; - for (const auto &type: surfaceTypes) { + for (const auto &type : surfaceTypes) { QTest::newRow("Left Alt" + type.second) << KEY_LEFTALT << alt << false << type.first; QTest::newRow("Right Alt" + type.second) << KEY_RIGHTALT << alt << false << type.first; QTest::newRow("Left Meta" + type.second) << KEY_LEFTMETA << meta << false << type.first; @@ -776,7 +752,7 @@ group.sync(); workspace()->slotReconfigure(); - QFETCH(Test::ShellSurfaceType, surfaceType); + QFETCH(Test::XdgShellSurfaceType, surfaceType); AbstractClient *c = showWindow(surfaceType); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -808,12 +784,11 @@ void DecorationInputTest::testTouchEvents_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } class EventHelper : public QObject @@ -843,7 +818,7 @@ { // this test verifies that the decoration gets a hover leave event on touch release // see BUG 386231 - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); @@ -884,11 +859,10 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void DecorationInputTest::testTooltipDoesntEatKeyEvents() @@ -902,7 +876,7 @@ QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered); QVERIFY(enteredSpy.isValid()); - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow(type); QVERIFY(c); QVERIFY(c->isDecorated()); diff --git a/autotests/integration/dont_crash_cancel_animation.cpp b/autotests/integration/dont_crash_cancel_animation.cpp --- a/autotests/integration/dont_crash_cancel_animation.cpp +++ b/autotests/integration/dont_crash_cancel_animation.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include namespace KWin @@ -99,7 +98,7 @@ // create a window Surface *surface = Test::createSurface(Test::waylandCompositor()); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); // let's render auto c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); diff --git a/autotests/integration/dont_crash_cursor_physical_size_empty.cpp b/autotests/integration/dont_crash_cursor_physical_size_empty.cpp --- a/autotests/integration/dont_crash_cursor_physical_size_empty.cpp +++ b/autotests/integration/dont_crash_cursor_physical_size_empty.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include #include @@ -89,23 +88,22 @@ void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco() { // This test ensures that there is no endless recursion if the cursor theme cannot be created // a reason for creation failure could be physical size not existing // see BUG: 390314 QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); Test::waylandServerSideDecoration()->create(surface.data(), surface.data()); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); diff --git a/autotests/integration/dont_crash_no_border.cpp b/autotests/integration/dont_crash_no_border.cpp --- a/autotests/integration/dont_crash_no_border.cpp +++ b/autotests/integration/dont_crash_no_border.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include @@ -100,12 +99,11 @@ void DontCrashNoBorder::testCreateWindow_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void DontCrashNoBorder::testCreateWindow() @@ -115,8 +113,8 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QVERIFY(shellSurface); QScopedPointer deco(Test::waylandServerSideDecoration()->create(surface.data())); QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); diff --git a/autotests/integration/dont_crash_useractions_menu.cpp b/autotests/integration/dont_crash_useractions_menu.cpp --- a/autotests/integration/dont_crash_useractions_menu.cpp +++ b/autotests/integration/dont_crash_useractions_menu.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -93,7 +92,7 @@ { // this test creates the condition of BUG 382063 QScopedPointer surface1(Test::createSurface()); - QScopedPointer shellSurface1(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); auto client = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); QVERIFY(client); diff --git a/autotests/integration/effects/fade_test.cpp b/autotests/integration/effects/fade_test.cpp --- a/autotests/integration/effects/fade_test.cpp +++ b/autotests/integration/effects/fade_test.cpp @@ -31,7 +31,6 @@ #include #include -#include #include using namespace KWin; @@ -116,11 +115,11 @@ void FadeTest::testWindowCloseAfterWindowHidden_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void FadeTest::testWindowCloseAfterWindowHidden() @@ -139,8 +138,8 @@ QVERIFY(windowClosedSpy.isValid()); QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QTRY_COMPARE(windowAddedSpy.count(), 1); diff --git a/autotests/integration/effects/maximize_animation_test.cpp b/autotests/integration/effects/maximize_animation_test.cpp --- a/autotests/integration/effects/maximize_animation_test.cpp +++ b/autotests/integration/effects/maximize_animation_test.cpp @@ -97,11 +97,11 @@ void MaximizeAnimationTest::testMaximizeRestore_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void MaximizeAnimationTest::testMaximizeRestore() @@ -115,7 +115,7 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer shellSurface(createXdgShellSurface(type, surface.data(), nullptr, Test::CreationSetup::CreateOnly)); // Wait for the initial configure event. diff --git a/autotests/integration/effects/slidingpopups_test.cpp b/autotests/integration/effects/slidingpopups_test.cpp --- a/autotests/integration/effects/slidingpopups_test.cpp +++ b/autotests/integration/effects/slidingpopups_test.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -337,7 +336,7 @@ QScopedPointer slide(slideManager->createSlide(surface.data())); slide->setLocation(Slide::Location::Left); slide->commit(); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(shellSurface); QCOMPARE(windowAddedSpy.count(), 0); auto client = Test::renderAndWaitForShown(surface.data(), QSize(10, 20), Qt::blue); diff --git a/autotests/integration/effects/windowgeometry_test.cpp b/autotests/integration/effects/windowgeometry_test.cpp --- a/autotests/integration/effects/windowgeometry_test.cpp +++ b/autotests/integration/effects/windowgeometry_test.cpp @@ -31,7 +31,6 @@ #include #include -#include #include using namespace KWin; diff --git a/autotests/integration/effects/wobbly_shade_test.cpp b/autotests/integration/effects/wobbly_shade_test.cpp --- a/autotests/integration/effects/wobbly_shade_test.cpp +++ b/autotests/integration/effects/wobbly_shade_test.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -29,7 +29,6 @@ #include "wayland_server.h" #include "workspace.h" -#include #include #include @@ -166,7 +165,7 @@ // first create a window QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QVERIFY(c->isActive()); @@ -305,7 +304,7 @@ void GlobalShortcutsTest::testWaylandClientShortcut() { QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QCOMPARE(workspace()->activeClient(), client); @@ -341,7 +340,7 @@ void GlobalShortcutsTest::testSetupWindowShortcut() { QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QCOMPARE(workspace()->activeClient(), client); diff --git a/autotests/integration/idle_inhibition_test.cpp b/autotests/integration/idle_inhibition_test.cpp --- a/autotests/integration/idle_inhibition_test.cpp +++ b/autotests/integration/idle_inhibition_test.cpp @@ -84,12 +84,11 @@ void TestIdleInhibition::testInhibit_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestIdleInhibition::testInhibit() @@ -102,8 +101,8 @@ // now create window QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); // now create inhibition on window QScopedPointer inhibitor(Test::waylandIdleInhibitManager()->createInhibitor(surface.data())); @@ -127,9 +126,6 @@ QVERIFY(idle->isInhibited()); shellSurface.reset(); - if (type == Test::ShellSurfaceType::WlShell) { - surface.reset(); - } QVERIFY(Test::waitForWindowDestroyed(c)); QTRY_VERIFY(!idle->isInhibited()); QCOMPARE(inhibitedSpy.count(), 4); diff --git a/autotests/integration/input_stacking_order.cpp b/autotests/integration/input_stacking_order.cpp --- a/autotests/integration/input_stacking_order.cpp +++ b/autotests/integration/input_stacking_order.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -103,10 +102,11 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange() @@ -130,17 +130,17 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(Test::waylandCompositor()); QVERIFY(surface1); - QFETCH(Test::ShellSurfaceType, type); - auto shellSurface1 = Test::createShellSurface(type, surface1, surface1); + QFETCH(Test::XdgShellSurfaceType, type); + XdgShellSurface *shellSurface1 = Test::createXdgShellSurface(type, surface1, surface1); QVERIFY(shellSurface1); render(surface1); QVERIFY(clientAddedSpy.wait()); AbstractClient *window1 = workspace()->activeClient(); QVERIFY(window1); Surface *surface2 = Test::createSurface(Test::waylandCompositor()); QVERIFY(surface2); - auto shellSurface2 = Test::createShellSurface(type, surface2, surface2); + XdgShellSurface *shellSurface2 = Test::createXdgShellSurface(type, surface2, surface2); QVERIFY(shellSurface2); render(surface2); QVERIFY(clientAddedSpy.wait()); diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp --- a/autotests/integration/internal_window.cpp +++ b/autotests/integration/internal_window.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -390,7 +389,7 @@ QSignalSpy leftSpy(keyboard.data(), &Keyboard::left); QVERIFY(leftSpy.isValid()); QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); // now let's render auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); diff --git a/autotests/integration/keyboard_layout_test.cpp b/autotests/integration/keyboard_layout_test.cpp --- a/autotests/integration/keyboard_layout_test.cpp +++ b/autotests/integration/keyboard_layout_test.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include @@ -364,7 +363,7 @@ // create a window using namespace KWayland::Client; QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto c1 = Test::renderAndWaitForShown(surface.data(), QSize(100, 100), Qt::blue); QVERIFY(c1); @@ -380,7 +379,7 @@ // create a second window QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 100), Qt::red); QVERIFY(c2); // this should have switched back to English @@ -411,7 +410,7 @@ // create a window using namespace KWayland::Client; QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto c1 = Test::renderAndWaitForShown(surface.data(), QSize(100, 100), Qt::blue); QVERIFY(c1); @@ -432,7 +431,7 @@ // create a second window QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 100), Qt::red); QVERIFY(c2); // it is the same application and should not switch the layout diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h --- a/autotests/integration/kwin_wayland_test.h +++ b/autotests/integration/kwin_wayland_test.h @@ -42,8 +42,6 @@ class Seat; class ServerSideDecorationManager; class ShadowManager; -class Shell; -class ShellSurface; class ShmPool; class SubCompositor; class SubSurface; @@ -116,7 +114,6 @@ KWayland::Client::Compositor *waylandCompositor(); KWayland::Client::SubCompositor *waylandSubCompositor(); KWayland::Client::ShadowManager *waylandShadowManager(); -KWayland::Client::Shell *waylandShell(); KWayland::Client::ShmPool *waylandShmPool(); KWayland::Client::Seat *waylandSeat(); KWayland::Client::ServerSideDecorationManager *waylandServerSideDecoration(); @@ -136,8 +133,7 @@ KWayland::Client::Surface *createSurface(QObject *parent = nullptr); KWayland::Client::SubSurface *createSubSurface(KWayland::Client::Surface *surface, KWayland::Client::Surface *parentSurface, QObject *parent = nullptr); -enum class ShellSurfaceType { - WlShell, +enum class XdgShellSurfaceType { XdgShellV5, XdgShellV6, XdgShellStable @@ -148,19 +144,11 @@ CreateAndConfigure, /// commit and wait for the configure event, making this surface ready to commit buffers }; -/** - * Creates either a ShellSurface * or XdgShellSurface * as defined by @arg type - * For XDG top levels this method will block for a configure event, make this surface ready to commit buffers - */ -QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent = nullptr); - -KWayland::Client::XdgShellSurface *createXdgShellSurface(ShellSurfaceType type, +KWayland::Client::XdgShellSurface *createXdgShellSurface(XdgShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent = nullptr, CreationSetup creationSetup = CreationSetup::CreateAndConfigure); -KWayland::Client::ShellSurface *createShellSurface(KWayland::Client::Surface *surface, - QObject *parent = nullptr); KWayland::Client::XdgShellSurface *createXdgShellV5Surface(KWayland::Client::Surface *surface, QObject *parent = nullptr, CreationSetup = CreationSetup::CreateAndConfigure); @@ -228,7 +216,7 @@ } Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Test::AdditionalWaylandInterfaces) -Q_DECLARE_METATYPE(KWin::Test::ShellSurfaceType) +Q_DECLARE_METATYPE(KWin::Test::XdgShellSurfaceType) #define WAYLANDTEST_MAIN_HELPER(TestObject, DPI, OperationMode) \ int main(int argc, char *argv[]) \ diff --git a/autotests/integration/kwinbindings_test.cpp b/autotests/integration/kwinbindings_test.cpp --- a/autotests/integration/kwinbindings_test.cpp +++ b/autotests/integration/kwinbindings_test.cpp @@ -29,7 +29,6 @@ #include "wayland_server.h" #include "workspace.h" -#include #include #include @@ -88,16 +87,16 @@ { // first create windows QScopedPointer surface1(Test::createSurface()); - QScopedPointer shellSurface1(Test::createShellSurface(surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); QScopedPointer surface3(Test::createSurface()); - QScopedPointer shellSurface3(Test::createShellSurface(surface3.data())); + QScopedPointer shellSurface3(Test::createXdgShellStableSurface(surface3.data())); auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); QScopedPointer surface4(Test::createSurface()); - QScopedPointer shellSurface4(Test::createShellSurface(surface4.data())); + QScopedPointer shellSurface4(Test::createXdgShellStableSurface(surface4.data())); auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); QVERIFY(c4->isActive()); @@ -148,16 +147,16 @@ // first create windows QScopedPointer surface1(Test::createSurface()); - QScopedPointer shellSurface1(Test::createShellSurface(surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); QScopedPointer surface3(Test::createSurface()); - QScopedPointer shellSurface3(Test::createShellSurface(surface3.data())); + QScopedPointer shellSurface3(Test::createXdgShellStableSurface(surface3.data())); auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); QScopedPointer surface4(Test::createSurface()); - QScopedPointer shellSurface4(Test::createShellSurface(surface4.data())); + QScopedPointer shellSurface4(Test::createXdgShellStableSurface(surface4.data())); auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); QVERIFY(c4->isActive()); @@ -231,7 +230,7 @@ // now create a window QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QSignalSpy desktopChangedSpy(c, &AbstractClient::desktopChanged); QVERIFY(desktopChangedSpy.isValid()); diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp --- a/autotests/integration/lockscreen.cpp +++ b/autotests/integration/lockscreen.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -168,7 +167,7 @@ Surface *surface = Test::createSurface(m_compositor); VERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); VERIFY(shellSurface); // let's render auto c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); @@ -212,7 +211,6 @@ QVERIFY(Test::waitForWaylandPointer()); m_connection = Test::waylandConnection(); m_compositor = Test::waylandCompositor(); - m_shell = Test::waylandShell(); m_shm = Test::waylandShmPool(); m_seat = Test::waylandSeat(); diff --git a/autotests/integration/maximize_test.cpp b/autotests/integration/maximize_test.cpp --- a/autotests/integration/maximize_test.cpp +++ b/autotests/integration/maximize_test.cpp @@ -28,15 +28,12 @@ #include "workspace.h" #include -#include #include #include #include #include -#include #include -#include #include #include @@ -107,43 +104,48 @@ void TestMaximized::testMaximizedPassedToDeco() { // this test verifies that when a ShellClient gets maximized the Decoration receives the signal + + // Create the test client. QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer ssd(Test::waylandServerSideDecoration()->create(surface.data())); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); - - QSignalSpy sizeChangedSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangedSpy.isValid()); - QVERIFY(client); QVERIFY(client->isDecorated()); + auto decoration = client->decoration(); QVERIFY(decoration); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); + // Wait for configure event that signals the client is active now. + QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); + QVERIFY(configureRequestedSpy.isValid()); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 1); + // When there are no borders, there is no change to them when maximizing. // TODO: we should test both cases with fixed fake decoration for autotests. const bool hasBorders = Decoration::DecorationBridge::self()->settings()->borderSize() != KDecoration2::BorderSize::None; // now maximize - QVERIFY(sizeChangedSpy.isEmpty()); QSignalSpy bordersChangedSpy(decoration, &KDecoration2::Decoration::bordersChanged); QVERIFY(bordersChangedSpy.isValid()); QSignalSpy maximizedChangedSpy(decoration->client().data(), &KDecoration2::DecoratedClient::maximizedChanged); QVERIFY(maximizedChangedSpy.isValid()); QSignalSpy geometryShapeChangedSpy(client, &AbstractClient::geometryShapeChanged); QVERIFY(geometryShapeChangedSpy.isValid()); workspace()->slotWindowMaximize(); - QVERIFY(sizeChangedSpy.wait()); - QCOMPARE(sizeChangedSpy.first().first().toSize(), QSize(1280, 1024 - decoration->borderTop())); - Test::render(surface.data(), sizeChangedSpy.first().first().toSize(), Qt::red); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 2); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024 - decoration->borderTop())); + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); + Test::render(surface.data(), configureRequestedSpy.last().at(0).toSize(), Qt::red); QVERIFY(geometryShapeChangedSpy.wait()); // If no borders, there is only the initial geometry shape change, but none through border resizing. QCOMPARE(geometryShapeChangedSpy.count(), hasBorders ? 2 : 1); - QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); QCOMPARE(maximizedChangedSpy.count(), 1); QCOMPARE(maximizedChangedSpy.last().first().toBool(), true); @@ -155,7 +157,11 @@ // now unmaximize again workspace()->slotWindowMaximize(); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 3); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(100, 50)); + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::red); QVERIFY(geometryShapeChangedSpy.wait()); QCOMPARE(geometryShapeChangedSpy.count(), hasBorders ? 4 : 2); @@ -168,76 +174,135 @@ QVERIFY(decoration->borderRight() != !hasBorders); QVERIFY(decoration->borderBottom() != !hasBorders); - QCOMPARE(sizeChangedSpy.count(), 2); - QCOMPARE(sizeChangedSpy.last().first().toSize(), QSize(100, 50)); + // Destroy the test client. + shellSurface.reset(); + QVERIFY(Test::waitForWindowDestroyed(client)); } void TestMaximized::testInitiallyMaximized() { - // this test verifies that a window created as maximized, will be maximized - QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - - QSignalSpy sizeChangedSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangedSpy.isValid()); + // This test verifies that a window created as maximized, will be maximized. - shellSurface->setMaximized(); - QVERIFY(sizeChangedSpy.wait()); - QCOMPARE(shellSurface->size(), QSize(1280, 1024)); - - // now let's render in an incorrect size - auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + // Create the test client. + QScopedPointer surface(Test::createSurface()); + QScopedPointer shellSurface( + Test::createXdgShellStableSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); + QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); + QVERIFY(configureRequestedSpy.isValid()); + shellSurface->setMaximized(true); + surface->commit(Surface::CommitFlag::None); + + // Wait for the initial configure event. + XdgShellSurface::States states; + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 1); + states = configureRequestedSpy.last().at(1).value(); + QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); + QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); + + // Now let's render in an incorrect size. + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); + ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(client); QCOMPARE(client->geometry(), QRect(0, 0, 100, 50)); QEXPECT_FAIL("", "Should go out of maximzied", Continue); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); + + // Destroy the client. + shellSurface.reset(); + QVERIFY(Test::waitForWindowDestroyed(client)); } void TestMaximized::testBorderlessMaximizedWindow() { - // test case verifies that borderless maximized window works - // see BUG 370982 + // This test verifies that a maximized client looses it's server-side + // decoration when the borderless maximized option is on. - // adjust config + // Enable the borderless maximized windows option. auto group = kwinApp()->config()->group("Windows"); group.writeEntry("BorderlessMaximizedWindows", true); group.sync(); Workspace::self()->slotReconfigure(); QCOMPARE(options->borderlessMaximizedWindows(), true); - QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - QScopedPointer ssd(Test::waylandServerSideDecoration()->create(surface.data())); - auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(client->isDecorated()); - const QRect origGeo = client->geometry(); + // Create the test client. + QScopedPointer surface(Test::createSurface()); + QScopedPointer shellSurface( + Test::createXdgShellStableSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); + QScopedPointer decoration( + Test::xdgDecorationManager()->getToplevelDecoration(shellSurface.data())); + QSignalSpy decorationConfiguredSpy(decoration.data(), &XdgDecoration::modeChanged); + QVERIFY(decorationConfiguredSpy.isValid()); + QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); + QVERIFY(configureRequestedSpy.isValid()); + decoration->setMode(XdgDecoration::Mode::ServerSide); + surface->commit(Surface::CommitFlag::None); + + // Wait for the initial configure event. + XdgShellSurface::States states; + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 1); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(0, 0)); + states = configureRequestedSpy.last().at(1).value(); + QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); + QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); + + // Map the client. + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); + ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + QVERIFY(client); + QVERIFY(client->isActive()); + QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); + QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); + QCOMPARE(client->isDecorated(), true); - QSignalSpy sizeChangedSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangedSpy.isValid()); + // We should receive a configure event when the client becomes active. + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 2); + states = configureRequestedSpy.last().at(1).value(); + QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); + QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); - // go to maximized - shellSurface->setMaximized(); - QVERIFY(sizeChangedSpy.wait()); - QCOMPARE(shellSurface->size(), QSize(1280, 1024)); - QSignalSpy geometryChangedSpy(client, &ShellClient::geometryChanged); + // Maximize the client. + const QRect maximizeRestoreGeometry = client->geometry(); + workspace()->slotWindowMaximize(); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 3); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024)); + states = configureRequestedSpy.last().at(1).value(); + QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); + QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); + + QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); QVERIFY(geometryChangedSpy.isValid()); - Test::render(surface.data(), shellSurface->size(), Qt::red); + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); + Test::render(surface.data(), QSize(1280, 1024), Qt::blue); QVERIFY(geometryChangedSpy.wait()); - QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); QCOMPARE(client->geometry(), QRect(0, 0, 1280, 1024)); - QCOMPARE(client->geometryRestore(), origGeo); + QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); + QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); QCOMPARE(client->isDecorated(), false); - // go back to normal - shellSurface->setToplevel(); - QVERIFY(sizeChangedSpy.wait()); - QCOMPARE(shellSurface->size(), QSize(100, 50)); + // Restore the client. + workspace()->slotWindowMaximize(); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 4); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(100, 50)); + states = configureRequestedSpy.last().at(1).value(); + QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); + QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); + + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::red); QVERIFY(geometryChangedSpy.wait()); + QCOMPARE(client->geometry(), maximizeRestoreGeometry); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); - QCOMPARE(client->geometry(), origGeo); - QCOMPARE(client->geometryRestore(), origGeo); + QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); QCOMPARE(client->isDecorated(), true); + + // Destroy the client. + shellSurface.reset(); + QVERIFY(Test::waitForWindowDestroyed(client)); } void TestMaximized::testBorderlessMaximizedWindowNoClientSideDecoration() diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -89,7 +88,6 @@ private: KWayland::Client::ConnectionThread *m_connection = nullptr; KWayland::Client::Compositor *m_compositor = nullptr; - KWayland::Client::Shell *m_shell = nullptr; }; void MoveResizeWindowTest::initTestCase() @@ -114,7 +112,6 @@ QVERIFY(Test::waitForWaylandPointer()); m_connection = Test::waylandConnection(); m_compositor = Test::waylandCompositor(); - m_shell = Test::waylandShell(); screens()->setCurrent(0); } @@ -131,9 +128,9 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); + QSignalSpy sizeChangeSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeSpy.isValid()); // let's render auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); @@ -354,9 +351,9 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); + QSignalSpy sizeChangeSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeSpy.isValid()); // let's render auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); @@ -400,13 +397,13 @@ QScopedPointer surface4(Test::createSurface()); QVERIFY(!surface4.isNull()); - QScopedPointer shellSurface1(Test::createShellSurface(surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); QVERIFY(!shellSurface1.isNull()); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); QVERIFY(!shellSurface2.isNull()); - QScopedPointer shellSurface3(Test::createShellSurface(surface3.data())); + QScopedPointer shellSurface3(Test::createXdgShellStableSurface(surface3.data())); QVERIFY(!shellSurface3.isNull()); - QScopedPointer shellSurface4(Test::createShellSurface(surface4.data())); + QScopedPointer shellSurface4(Test::createXdgShellStableSurface(surface4.data())); QVERIFY(!shellSurface4.isNull()); auto renderWindow = [this] (Surface *surface, const QString &methodCall, const QRect &expectedGeometry) { // let's render @@ -428,7 +425,7 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); @@ -461,7 +458,7 @@ // block geometry helper QScopedPointer surface1(Test::createSurface()); QVERIFY(!surface1.isNull()); - QScopedPointer shellSurface1(Test::createShellSurface(surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); QVERIFY(!shellSurface1.isNull()); Test::render(surface1.data(), QSize(650, 514), Qt::blue); QVERIFY(Test::waitForWaylandWindowShown()); @@ -471,9 +468,9 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); + QSignalSpy sizeChangeSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeSpy.isValid()); // let's render auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); @@ -521,9 +518,9 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); + QSignalSpy sizeChangeSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeSpy.isValid()); // let's render auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); @@ -556,12 +553,11 @@ } void MoveResizeWindowTest::testClientSideMove_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void MoveResizeWindowTest::testClientSideMove() @@ -577,8 +573,8 @@ QVERIFY(buttonSpy.isValid()); QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); @@ -593,11 +589,7 @@ QVERIFY(buttonSpy.wait()); QSignalSpy moveStartSpy(c, &AbstractClient::clientStartUserMovedResized); QVERIFY(moveStartSpy.isValid()); - if (auto s = qobject_cast(shellSurface.data())) { - s->requestMove(Test::waylandSeat(), buttonSpy.first().first().value()); - } else if (auto s = qobject_cast(shellSurface.data())) { - s->requestMove(Test::waylandSeat(), buttonSpy.first().first().value()); - } + shellSurface->requestMove(Test::waylandSeat(), buttonSpy.first().first().value()); QVERIFY(moveStartSpy.wait()); QCOMPARE(c->isMove(), true); QVERIFY(pointerLeftSpy.wait()); @@ -639,7 +631,7 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); // and a PlasmaShellSurface QScopedPointer plasmaSurface(Test::waylandPlasmaShell()->createSurface(surface.data())); @@ -790,7 +782,7 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); auto testWindow = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); @@ -853,7 +845,7 @@ using namespace KWayland::Client; QScopedPointer panelSurface(Test::createSurface()); QVERIFY(!panelSurface.isNull()); - QScopedPointer panelShellSurface(Test::createShellSurface(panelSurface.data())); + QScopedPointer panelShellSurface(Test::createXdgShellStableSurface(panelSurface.data())); QVERIFY(!panelShellSurface.isNull()); QScopedPointer plasmaSurface(Test::waylandPlasmaShell()->createSurface(panelSurface.data())); QVERIFY(!plasmaSurface.isNull()); @@ -871,7 +863,7 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); auto testWindow = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); diff --git a/autotests/integration/placement_test.cpp b/autotests/integration/placement_test.cpp --- a/autotests/integration/placement_test.cpp +++ b/autotests/integration/placement_test.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp --- a/autotests/integration/plasma_surface_test.cpp +++ b/autotests/integration/plasma_surface_test.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include using namespace KWin; @@ -85,7 +84,6 @@ { QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::PlasmaShell)); m_compositor = Test::waylandCompositor(); - m_shell = Test::waylandShell(); m_plasmaShell = Test::waylandPlasmaShell(); KWin::Cursor::setPos(640, 512); @@ -115,7 +113,7 @@ // this test verifies that a ShellClient is set on all desktops when the role changes QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); QVERIFY(!plasmaSurface.isNull()); @@ -144,7 +142,7 @@ QScopedPointer plasmaSurface2(m_plasmaShell->createSurface(surface2.data())); QVERIFY(!plasmaSurface2.isNull()); plasmaSurface2->setRole(role); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); QVERIFY(!shellSurface2.isNull()); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); QVERIFY(c2); @@ -173,7 +171,7 @@ // this test verifies that some surface roles don't get focus QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); QVERIFY(!plasmaSurface.isNull()); @@ -192,7 +190,7 @@ { QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); QVERIFY(!plasmaSurface.isNull()); @@ -213,7 +211,7 @@ { QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); QVERIFY(!plasmaSurface.isNull()); @@ -253,12 +251,11 @@ void PlasmaSurfaceTest::testOSDPlacementManualPosition_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wl-shell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgv5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgv6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgv5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgv6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void PlasmaSurfaceTest::testOSDPlacementManualPosition() @@ -271,8 +268,8 @@ plasmaSurface->setPosition(QPoint(50, 70)); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QVERIFY(!shellSurface.isNull()); // now render and map the window @@ -288,36 +285,32 @@ void PlasmaSurfaceTest::testPanelTypeHasStrut_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); QTest::addColumn("panelBehavior"); QTest::addColumn("expectedStrut"); QTest::addColumn("expectedMaxArea"); QTest::addColumn("expectedLayer"); - QTest::newRow("always visible - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; - QTest::newRow("always visible - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; - QTest::newRow("always visible - xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; - QTest::newRow("always visible - xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; - QTest::newRow("autohide - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; - QTest::newRow("autohide - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; - QTest::newRow("autohide - xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; - QTest::newRow("autohide - xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; - QTest::newRow("windows can cover - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; - QTest::newRow("windows can cover - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; - QTest::newRow("windows can cover - xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; - QTest::newRow("windows can cover - xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; - QTest::newRow("windows go below - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; - QTest::newRow("windows go below - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; - QTest::newRow("windows go below - xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; - QTest::newRow("windows go below - xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; + QTest::newRow("always visible - xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; + QTest::newRow("always visible - xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; + QTest::newRow("always visible - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; + QTest::newRow("autohide - xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; + QTest::newRow("autohide - xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; + QTest::newRow("autohide - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; + QTest::newRow("windows can cover - xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; + QTest::newRow("windows can cover - xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; + QTest::newRow("windows can cover - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; + QTest::newRow("windows go below - xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; + QTest::newRow("windows go below - xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; + QTest::newRow("windows go below - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; } void PlasmaSurfaceTest::testPanelTypeHasStrut() { QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QVERIFY(!shellSurface.isNull()); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); QVERIFY(!plasmaSurface.isNull()); @@ -364,16 +357,15 @@ // triggering the screen edge should raise the panel. QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); QVERIFY(!plasmaSurface.isNull()); plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); QFETCH(QRect, panelGeometry); plasmaSurface->setPosition(panelGeometry.topLeft()); plasmaSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::WindowsCanCover); - // now render and map the window auto panel = Test::renderAndWaitForShown(surface.data(), panelGeometry.size(), Qt::blue); @@ -388,7 +380,7 @@ // create a Window QScopedPointer surface2(Test::createSurface()); QVERIFY(!surface2.isNull()); - QScopedPointer shellSurface2(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); QVERIFY(!shellSurface2.isNull()); QFETCH(QRect, windowGeometry); @@ -431,7 +423,7 @@ { QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); QVERIFY(!plasmaSurface.isNull()); diff --git a/autotests/integration/plasmawindow_test.cpp b/autotests/integration/plasmawindow_test.cpp --- a/autotests/integration/plasmawindow_test.cpp +++ b/autotests/integration/plasmawindow_test.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include //screenlocker @@ -65,7 +64,6 @@ private: PlasmaWindowManagement *m_windowManagement = nullptr; KWayland::Client::Compositor *m_compositor = nullptr; - Shell *m_shell = nullptr; }; void PlasmaWindowTest::initTestCase() @@ -93,7 +91,6 @@ QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::WindowManagement)); m_windowManagement = Test::waylandWindowManagement(); m_compositor = Test::waylandCompositor(); - m_shell = Test::waylandShell(); screens()->setCurrent(0); Cursor::setPos(QPoint(640, 512)); @@ -247,57 +244,28 @@ // first create the parent window QScopedPointer parentSurface(Test::createSurface()); - QScopedPointer parentShellSurface(Test::createShellSurface(parentSurface.data())); - // map that window - Test::render(parentSurface.data(), QSize(100, 50), Qt::blue); - // this should create a plasma window + QScopedPointer parentShellSurface(Test::createXdgShellStableSurface(parentSurface.data())); + ShellClient *parentClient = Test::renderAndWaitForShown(parentSurface.data(), QSize(100, 50), Qt::blue); + QVERIFY(parentClient); QVERIFY(plasmaWindowCreatedSpy.wait()); + QCOMPARE(plasmaWindowCreatedSpy.count(), 1); // now let's create a popup window for it + XdgPositioner positioner(QSize(10, 10), QRect(0, 0, 10, 10)); + positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); + positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); QScopedPointer popupSurface(Test::createSurface()); - QScopedPointer popupShellSurface(Test::createShellSurface(popupSurface.data())); - popupShellSurface->setTransient(parentSurface.data(), QPoint(0, 0), ShellSurface::TransientFlag::NoFocus); - // let's map it - Test::render(popupSurface.data(), QSize(100, 50), Qt::blue); - - // this should not create a plasma window - QVERIFY(!plasmaWindowCreatedSpy.wait()); - - // now the same with an already mapped surface when we create the shell surface - QScopedPointer popup2Surface(Test::createSurface()); - Test::render(popup2Surface.data(), QSize(100, 50), Qt::blue); - QScopedPointer popup2ShellSurface(Test::createShellSurface(popup2Surface.data())); - popup2ShellSurface->setTransient(popupSurface.data(), QPoint(0, 0), ShellSurface::TransientFlag::NoFocus); - - // this should not create a plasma window - QEXPECT_FAIL("", "The call to setTransient comes to late the window is already mapped then", Continue); - QVERIFY(!plasmaWindowCreatedSpy.wait()); + QScopedPointer popupShellSurface(Test::createXdgShellStablePopup(popupSurface.data(), parentShellSurface.data(), positioner)); + ShellClient *popupClient = Test::renderAndWaitForShown(popupSurface.data(), positioner.initialSize(), Qt::blue); + QVERIFY(popupClient); + QVERIFY(!plasmaWindowCreatedSpy.wait(100)); + QCOMPARE(plasmaWindowCreatedSpy.count(), 1); // let's destroy the windows - QCOMPARE(waylandServer()->clients().count(), 3); - QSignalSpy destroyed1Spy(waylandServer()->clients().last(), &QObject::destroyed); - QVERIFY(destroyed1Spy.isValid()); - popup2Surface->attachBuffer(Buffer::Ptr()); - popup2Surface->commit(Surface::CommitFlag::None); - popup2ShellSurface.reset(); - popup2Surface.reset(); - QVERIFY(destroyed1Spy.wait()); - QCOMPARE(waylandServer()->clients().count(), 2); - QSignalSpy destroyed2Spy(waylandServer()->clients().last(), &QObject::destroyed); - QVERIFY(destroyed2Spy.isValid()); - popupSurface->attachBuffer(Buffer::Ptr()); - popupSurface->commit(Surface::CommitFlag::None); popupShellSurface.reset(); - popupSurface.reset(); - QVERIFY(destroyed2Spy.wait()); - QCOMPARE(waylandServer()->clients().count(), 1); - QSignalSpy destroyed3Spy(waylandServer()->clients().last(), &QObject::destroyed); - QVERIFY(destroyed3Spy.isValid()); - parentSurface->attachBuffer(Buffer::Ptr()); - parentSurface->commit(Surface::CommitFlag::None); + QVERIFY(Test::waitForWindowDestroyed(popupClient)); parentShellSurface.reset(); - parentSurface.reset(); - QVERIFY(destroyed3Spy.wait()); + QVERIFY(Test::waitForWindowDestroyed(parentClient)); } void PlasmaWindowTest::testLockScreenNoPlasmaWindow() @@ -341,7 +309,7 @@ // first create the parent window QScopedPointer parentSurface(Test::createSurface()); - QScopedPointer parentShellSurface(Test::createShellSurface(parentSurface.data())); + QScopedPointer parentShellSurface(Test::createXdgShellStableSurface(parentSurface.data())); // map that window Test::render(parentSurface.data(), QSize(100, 50), Qt::blue); // this should create a plasma window diff --git a/autotests/integration/pointer_constraints_test.cpp b/autotests/integration/pointer_constraints_test.cpp --- a/autotests/integration/pointer_constraints_test.cpp +++ b/autotests/integration/pointer_constraints_test.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -111,40 +110,36 @@ void TestPointerConstraints::testConfinedPointer_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); QTest::addColumn("positionFunction"); QTest::addColumn("xOffset"); QTest::addColumn("yOffset"); PointerFunc bottomLeft = &QRect::bottomLeft; PointerFunc bottomRight = &QRect::bottomRight; PointerFunc topRight = &QRect::topRight; PointerFunc topLeft = &QRect::topLeft; - QTest::newRow("wlShell - bottomLeft") << Test::ShellSurfaceType::WlShell << bottomLeft << -1 << 1; - QTest::newRow("wlShell - bottomRight") << Test::ShellSurfaceType::WlShell << bottomRight << 1 << 1; - QTest::newRow("wlShell - topLeft") << Test::ShellSurfaceType::WlShell << topLeft << -1 << -1; - QTest::newRow("wlShell - topRight") << Test::ShellSurfaceType::WlShell << topRight << 1 << -1; - QTest::newRow("XdgShellV5 - bottomLeft") << Test::ShellSurfaceType::XdgShellV5 << bottomLeft << -1 << 1; - QTest::newRow("XdgShellV5 - bottomRight") << Test::ShellSurfaceType::XdgShellV5 << bottomRight << 1 << 1; - QTest::newRow("XdgShellV5 - topLeft") << Test::ShellSurfaceType::XdgShellV5 << topLeft << -1 << -1; - QTest::newRow("XdgShellV5 - topRight") << Test::ShellSurfaceType::XdgShellV5 << topRight << 1 << -1; - QTest::newRow("XdgShellV6 - bottomLeft") << Test::ShellSurfaceType::XdgShellV6 << bottomLeft << -1 << 1; - QTest::newRow("XdgShellV6 - bottomRight") << Test::ShellSurfaceType::XdgShellV6 << bottomRight << 1 << 1; - QTest::newRow("XdgShellV6 - topLeft") << Test::ShellSurfaceType::XdgShellV6 << topLeft << -1 << -1; - QTest::newRow("XdgShellV6 - topRight") << Test::ShellSurfaceType::XdgShellV6 << topRight << 1 << -1; - QTest::newRow("XdgWmBase - bottomLeft") << Test::ShellSurfaceType::XdgShellStable << bottomLeft << -1 << 1; - QTest::newRow("XdgWmBase - bottomRight") << Test::ShellSurfaceType::XdgShellStable << bottomRight << 1 << 1; - QTest::newRow("XdgWmBase - topLeft") << Test::ShellSurfaceType::XdgShellStable << topLeft << -1 << -1; - QTest::newRow("XdgWmBase - topRight") << Test::ShellSurfaceType::XdgShellStable << topRight << 1 << -1; + QTest::newRow("XdgShellV5 - bottomLeft") << Test::XdgShellSurfaceType::XdgShellV5 << bottomLeft << -1 << 1; + QTest::newRow("XdgShellV5 - bottomRight") << Test::XdgShellSurfaceType::XdgShellV5 << bottomRight << 1 << 1; + QTest::newRow("XdgShellV5 - topLeft") << Test::XdgShellSurfaceType::XdgShellV5 << topLeft << -1 << -1; + QTest::newRow("XdgShellV5 - topRight") << Test::XdgShellSurfaceType::XdgShellV5 << topRight << 1 << -1; + QTest::newRow("XdgShellV6 - bottomLeft") << Test::XdgShellSurfaceType::XdgShellV6 << bottomLeft << -1 << 1; + QTest::newRow("XdgShellV6 - bottomRight") << Test::XdgShellSurfaceType::XdgShellV6 << bottomRight << 1 << 1; + QTest::newRow("XdgShellV6 - topLeft") << Test::XdgShellSurfaceType::XdgShellV6 << topLeft << -1 << -1; + QTest::newRow("XdgShellV6 - topRight") << Test::XdgShellSurfaceType::XdgShellV6 << topRight << 1 << -1; + QTest::newRow("XdgWmBase - bottomLeft") << Test::XdgShellSurfaceType::XdgShellStable << bottomLeft << -1 << 1; + QTest::newRow("XdgWmBase - bottomRight") << Test::XdgShellSurfaceType::XdgShellStable << bottomRight << 1 << 1; + QTest::newRow("XdgWmBase - topLeft") << Test::XdgShellSurfaceType::XdgShellStable << topLeft << -1 << -1; + QTest::newRow("XdgWmBase - topRight") << Test::XdgShellSurfaceType::XdgShellStable << topRight << 1 << -1; } void TestPointerConstraints::testConfinedPointer() { // this test sets up a Surface with a confined pointer // simple interaction test to verify that the pointer gets confined QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QScopedPointer pointer(Test::waylandSeat()->createPointer()); QScopedPointer confinedPointer(Test::waylandPointerConstraints()->confinePointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot)); QSignalSpy confinedSpy(confinedPointer.data(), &ConfinedPointer::confined); @@ -251,7 +246,7 @@ // create a second window and move it above our constrained window QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(type, surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellSurface(type, surface2.data())); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(1280, 1024), Qt::blue); QVERIFY(c2); QVERIFY(unconfinedSpy2.wait()); @@ -299,22 +294,21 @@ void TestPointerConstraints::testLockedPointer_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestPointerConstraints::testLockedPointer() { // this test sets up a Surface with a locked pointer // simple interaction test to verify that the pointer gets locked // the various ways to unlock are not tested as that's already verified by testConfinedPointer QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QScopedPointer pointer(Test::waylandSeat()->createPointer()); QScopedPointer lockedPointer(Test::waylandPointerConstraints()->lockPointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot)); QSignalSpy lockedSpy(lockedPointer.data(), &LockedPointer::locked); @@ -378,20 +372,19 @@ void TestPointerConstraints::testCloseWindowWithLockedPointer_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("XdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("XdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("XdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("XdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("XdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("XdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestPointerConstraints::testCloseWindowWithLockedPointer() { // test case which verifies that the pointer gets unlocked when the window for it gets closed QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QScopedPointer pointer(Test::waylandSeat()->createPointer()); QScopedPointer lockedPointer(Test::waylandPointerConstraints()->lockPointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot)); QSignalSpy lockedSpy(lockedPointer.data(), &LockedPointer::locked); diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -131,12 +130,12 @@ void testResizeCursor_data(); void testResizeCursor(); void testMoveCursor(); + void testHideShowCursor(); private: void render(KWayland::Client::Surface *surface, const QSize &size = QSize(100, 50)); KWayland::Client::Compositor *m_compositor = nullptr; KWayland::Client::Seat *m_seat = nullptr; - KWayland::Client::Shell *m_shell = nullptr; }; void PointerInputTest::initTestCase() @@ -175,7 +174,6 @@ QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::Decoration)); QVERIFY(Test::waitForWaylandPointer()); m_compositor = Test::waylandCompositor(); - m_shell = Test::waylandShell(); m_seat = Test::waylandSeat(); screens()->setCurrent(0); @@ -211,7 +209,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -259,7 +257,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -299,7 +297,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -342,7 +340,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface, QSize(1280, 1024)); QVERIFY(clientAddedSpy.wait()); @@ -438,7 +436,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -505,7 +503,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -578,7 +576,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -637,7 +635,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -687,15 +685,15 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(m_compositor); QVERIFY(surface1); - ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1); + XdgShellSurface *shellSurface1 = Test::createXdgShellStableSurface(surface1, surface1); QVERIFY(shellSurface1); render(surface1); QVERIFY(clientAddedSpy.wait()); AbstractClient *window1 = workspace()->activeClient(); QVERIFY(window1); Surface *surface2 = Test::createSurface(m_compositor); QVERIFY(surface2); - ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2); + XdgShellSurface *shellSurface2 = Test::createXdgShellStableSurface(surface2, surface2); QVERIFY(shellSurface2); render(surface2); QVERIFY(clientAddedSpy.wait()); @@ -747,15 +745,15 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(m_compositor); QVERIFY(surface1); - ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1); + XdgShellSurface *shellSurface1 = Test::createXdgShellStableSurface(surface1, surface1); QVERIFY(shellSurface1); render(surface1, QSize(800, 800)); QVERIFY(clientAddedSpy.wait()); AbstractClient *window1 = workspace()->activeClient(); QVERIFY(window1); Surface *surface2 = Test::createSurface(m_compositor); QVERIFY(surface2); - ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2); + XdgShellSurface *shellSurface2 = Test::createXdgShellStableSurface(surface2, surface2); QVERIFY(shellSurface2); render(surface2, QSize(800, 800)); QVERIFY(clientAddedSpy.wait()); @@ -833,15 +831,15 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(m_compositor); QVERIFY(surface1); - ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1); + XdgShellSurface *shellSurface1 = Test::createXdgShellStableSurface(surface1, surface1); QVERIFY(shellSurface1); render(surface1, QSize(800, 800)); QVERIFY(clientAddedSpy.wait()); AbstractClient *window1 = workspace()->activeClient(); QVERIFY(window1); Surface *surface2 = Test::createSurface(m_compositor); QVERIFY(surface2); - ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2); + XdgShellSurface *shellSurface2 = Test::createXdgShellStableSurface(surface2, surface2); QVERIFY(shellSurface2); render(surface2, QSize(800, 800)); QVERIFY(clientAddedSpy.wait()); @@ -923,7 +921,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(m_compositor); QVERIFY(surface1); - ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1); + XdgShellSurface *shellSurface1 = Test::createXdgShellStableSurface(surface1, surface1); QVERIFY(shellSurface1); render(surface1, QSize(800, 800)); QVERIFY(clientAddedSpy.wait()); @@ -933,7 +931,7 @@ QVERIFY(window1DestroyedSpy.isValid()); Surface *surface2 = Test::createSurface(m_compositor); QVERIFY(surface2); - ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2); + XdgShellSurface *shellSurface2 = Test::createXdgShellStableSurface(surface2, surface2); QVERIFY(shellSurface2); render(surface2, QSize(800, 800)); QVERIFY(clientAddedSpy.wait()); @@ -1004,7 +1002,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -1105,7 +1103,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -1181,7 +1179,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -1199,15 +1197,17 @@ QVERIFY(buttonStateChangedSpy.wait()); // now create the popup surface + XdgPositioner positioner(QSize(100, 50), QRect(0, 0, 80, 20)); + positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); + positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); Surface *popupSurface = Test::createSurface(m_compositor); QVERIFY(popupSurface); - ShellSurface *popupShellSurface = Test::createShellSurface(popupSurface, popupSurface); + XdgShellPopup *popupShellSurface = Test::createXdgShellStablePopup(popupSurface, shellSurface, positioner); QVERIFY(popupShellSurface); - QSignalSpy popupDoneSpy(popupShellSurface, &ShellSurface::popupDone); + QSignalSpy popupDoneSpy(popupShellSurface, &XdgShellPopup::popupDone); QVERIFY(popupDoneSpy.isValid()); - // TODO: proper serial - popupShellSurface->setTransientPopup(surface, m_seat, 0, QPoint(80, 20)); - render(popupSurface); + popupShellSurface->requestGrab(Test::waylandSeat(), 0); // FIXME: Serial. + render(popupSurface, positioner.initialSize()); QVERIFY(clientAddedSpy.wait()); auto popupClient = clientAddedSpy.last().first().value(); QVERIFY(popupClient); @@ -1260,7 +1260,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); auto deco = Test::waylandServerSideDecoration()->create(surface, surface); @@ -1288,15 +1288,17 @@ QVERIFY(buttonStateChangedSpy.wait()); // now create the popup surface + XdgPositioner positioner(QSize(100, 50), QRect(0, 0, 80, 20)); + positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); + positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); Surface *popupSurface = Test::createSurface(m_compositor); QVERIFY(popupSurface); - ShellSurface *popupShellSurface = Test::createShellSurface(popupSurface, popupSurface); + XdgShellPopup *popupShellSurface = Test::createXdgShellStablePopup(popupSurface, shellSurface, positioner); QVERIFY(popupShellSurface); - QSignalSpy popupDoneSpy(popupShellSurface, &ShellSurface::popupDone); + QSignalSpy popupDoneSpy(popupShellSurface, &XdgShellPopup::popupDone); QVERIFY(popupDoneSpy.isValid()); - // TODO: proper serial - popupShellSurface->setTransientPopup(surface, m_seat, 0, QPoint(80, 20)); - render(popupSurface); + popupShellSurface->requestGrab(Test::waylandSeat(), 0); // FIXME: Serial. + render(popupSurface, positioner.initialSize()); QVERIFY(clientAddedSpy.wait()); auto popupClient = clientAddedSpy.last().first().value(); QVERIFY(popupClient); @@ -1335,7 +1337,7 @@ QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); QVERIFY(shellSurface); render(surface); QVERIFY(clientAddedSpy.wait()); @@ -1351,17 +1353,20 @@ kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); // now create a second window as transient + XdgPositioner positioner(QSize(99, 49), QRect(0, 0, 1, 1)); + positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); + positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); Surface *popupSurface = Test::createSurface(m_compositor); QVERIFY(popupSurface); - ShellSurface *popupShellSurface = Test::createShellSurface(popupSurface, popupSurface); + XdgShellPopup *popupShellSurface = Test::createXdgShellStablePopup(popupSurface, shellSurface, positioner); QVERIFY(popupShellSurface); - popupShellSurface->setTransient(surface, QPoint(0, 0)); - render(popupSurface); + render(popupSurface, positioner.initialSize()); QVERIFY(clientAddedSpy.wait()); auto popupClient = clientAddedSpy.last().first().value(); QVERIFY(popupClient); QVERIFY(popupClient != window); - QCOMPARE(window->geometry(), popupClient->geometry()); + QVERIFY(window->geometry().contains(Cursor::pos())); + QVERIFY(popupClient->geometry().contains(Cursor::pos())); QVERIFY(!leftSpy.wait()); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); @@ -1597,6 +1602,31 @@ QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), arrowCursor.hotSpot()); } +void PointerInputTest::testHideShowCursor() +{ + QCOMPARE(kwinApp()->platform()->isCursorHidden(), false); + kwinApp()->platform()->hideCursor(); + QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); + kwinApp()->platform()->showCursor(); + QCOMPARE(kwinApp()->platform()->isCursorHidden(), false); + + kwinApp()->platform()->hideCursor(); + QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); + kwinApp()->platform()->hideCursor(); + kwinApp()->platform()->hideCursor(); + kwinApp()->platform()->hideCursor(); + QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); + + kwinApp()->platform()->showCursor(); + QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); + kwinApp()->platform()->showCursor(); + QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); + kwinApp()->platform()->showCursor(); + QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); + kwinApp()->platform()->showCursor(); + QCOMPARE(kwinApp()->platform()->isCursorHidden(), false); +} + } WAYLANDTEST_MAIN(KWin::PointerInputTest) diff --git a/autotests/integration/quick_tiling_test.cpp b/autotests/integration/quick_tiling_test.cpp --- a/autotests/integration/quick_tiling_test.cpp +++ b/autotests/integration/quick_tiling_test.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -75,10 +74,8 @@ void testQuickTilingKeyboardMove(); void testQuickTilingPointerMove_data(); void testQuickTilingPointerMove(); - void testQuickTilingPointerMoveXdgShell_data(); - void testQuickTilingPointerMoveXdgShell(); - void testQuickTilingTouchMoveXdgShell_data(); - void testQuickTilingTouchMoveXdgShell(); + void testQuickTilingTouchMove_data(); + void testQuickTilingTouchMove(); void testX11QuickTiling_data(); void testX11QuickTiling(); void testX11QuickTilingAfterVertMaximize_data(); @@ -91,7 +88,6 @@ private: KWayland::Client::ConnectionThread *m_connection = nullptr; KWayland::Client::Compositor *m_compositor = nullptr; - KWayland::Client::Shell *m_shell = nullptr; }; void QuickTilingTest::initTestCase() @@ -127,7 +123,6 @@ QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration)); m_connection = Test::waylandConnection(); m_compositor = Test::waylandCompositor(); - m_shell = Test::waylandShell(); screens()->setCurrent(0); } @@ -167,18 +162,22 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangeSpy.isValid()); - // let's render - auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + // Map the client. + auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QCOMPARE(workspace()->activeClient(), c); QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); QCOMPARE(c->quickTileMode(), QuickTileMode(QuickTileFlag::None)); + + // We have to receive a configure event when the client becomes active. + QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); + QVERIFY(configureRequestedSpy.isValid()); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 1); + QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); QVERIFY(quickTileChangedSpy.isValid()); QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); @@ -194,13 +193,14 @@ QCOMPARE(c->quickTileMode(), mode); // but we got requested a new geometry - QVERIFY(sizeChangeSpy.wait()); - QCOMPARE(sizeChangeSpy.count(), 1); - QCOMPARE(sizeChangeSpy.first().first().toSize(), expectedGeometry.size()); + QVERIFY(configureRequestedSpy.wait()); + QEXPECT_FAIL("maximize", "Two configure events are sent for maximized", Continue); + QCOMPARE(configureRequestedSpy.count(), 2); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); // attach a new image + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), expectedGeometry.size(), Qt::red); - m_connection->flush(); QVERIFY(geometryChangedSpy.wait()); QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); @@ -238,19 +238,23 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangeSpy.isValid()); - // let's render - auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + // Map the client. + auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QCOMPARE(workspace()->activeClient(), c); QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); QCOMPARE(c->quickTileMode(), QuickTileMode(QuickTileFlag::None)); QCOMPARE(c->maximizeMode(), MaximizeRestore); + + // We have to receive a configure event upon becoming active. + QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); + QVERIFY(configureRequestedSpy.isValid()); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 1); + QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); QVERIFY(quickTileChangedSpy.isValid()); QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); @@ -270,13 +274,14 @@ QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); // but we got requested a new geometry - QVERIFY(sizeChangeSpy.wait()); - QCOMPARE(sizeChangeSpy.count(), 1); - QCOMPARE(sizeChangeSpy.first().first().toSize(), QSize(1280, 1024)); + QVERIFY(configureRequestedSpy.wait()); + QEXPECT_FAIL("", "Two configure events are sent for maximized", Continue); + QCOMPARE(configureRequestedSpy.count(), 2); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024)); // attach a new image + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(1280, 1024), Qt::red); - m_connection->flush(); QVERIFY(geometryChangedSpy.wait()); QCOMPARE(geometryChangedSpy.count(), 2); @@ -302,13 +307,14 @@ QCOMPARE(c->geometry(), QRect(0, 0, 1280, 1024)); QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); // we got requested a new geometry - QVERIFY(sizeChangeSpy.wait()); - QCOMPARE(sizeChangeSpy.count(), 2); - QCOMPARE(sizeChangeSpy.last().first().toSize(), QSize(100, 50)); + QVERIFY(configureRequestedSpy.wait()); + QEXPECT_FAIL("", "Two configure events are sent for maximized", Continue); + QCOMPARE(configureRequestedSpy.count(), 3); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(100, 50)); // render again + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::yellow); - m_connection->flush(); QVERIFY(geometryChangedSpy.wait()); QCOMPARE(geometryChangedSpy.count(), 4); @@ -343,9 +349,9 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); + QSignalSpy sizeChangeSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeSpy.isValid()); // let's render auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); @@ -392,8 +398,6 @@ QTEST(c->quickTileMode(), "expectedMode"); } - - void QuickTilingTest::testQuickTilingPointerMove_data() { QTest::addColumn("targetPos"); @@ -414,60 +418,6 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangeSpy.isValid()); - // let's render - auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); - - QVERIFY(c); - QCOMPARE(workspace()->activeClient(), c); - QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); - QCOMPARE(c->quickTileMode(), QuickTileMode(QuickTileFlag::None)); - QCOMPARE(c->maximizeMode(), MaximizeRestore); - - QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); - QVERIFY(quickTileChangedSpy.isValid()); - - workspace()->performWindowOperation(c, Options::UnrestrictedMoveOp); - QCOMPARE(c, workspace()->moveResizeClient()); - QCOMPARE(Cursor::pos(), QPoint(49, 24)); - - QFETCH(QPoint, targetPos); - quint32 timestamp = 1; - kwinApp()->platform()->pointerMotion(targetPos, timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); - QCOMPARE(Cursor::pos(), targetPos); - QVERIFY(!workspace()->moveResizeClient()); - - QCOMPARE(quickTileChangedSpy.count(), 1); - QTEST(c->quickTileMode(), "expectedMode"); - QTRY_COMPARE(sizeChangeSpy.count(), 1); -} - - -void QuickTilingTest::testQuickTilingPointerMoveXdgShell_data() -{ - QTest::addColumn("targetPos"); - QTest::addColumn("expectedMode"); - - QTest::newRow("topRight") << QPoint(2559, 24) << QuickTileMode(QuickTileFlag::Top | QuickTileFlag::Right); - QTest::newRow("right") << QPoint(2559, 512) << QuickTileMode(QuickTileFlag::Right); - QTest::newRow("bottomRight") << QPoint(2559, 1023) << QuickTileMode(QuickTileFlag::Bottom | QuickTileFlag::Right); - QTest::newRow("bottomLeft") << QPoint(0, 1023) << QuickTileMode(QuickTileFlag::Bottom | QuickTileFlag::Left); - QTest::newRow("Left") << QPoint(0, 512) << QuickTileMode(QuickTileFlag::Left); - QTest::newRow("topLeft") << QPoint(0, 24) << QuickTileMode(QuickTileFlag::Top | QuickTileFlag::Left); -} - -void QuickTilingTest::testQuickTilingPointerMoveXdgShell() -{ - using namespace KWayland::Client; - - QScopedPointer surface(Test::createSurface()); - QVERIFY(!surface.isNull()); - QScopedPointer shellSurface(Test::createXdgShellV6Surface( surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); QVERIFY(!shellSurface.isNull()); @@ -517,7 +467,7 @@ QCOMPARE(false, configureRequestedSpy.last().first().toSize().isEmpty()); } -void QuickTilingTest::testQuickTilingTouchMoveXdgShell_data() +void QuickTilingTest::testQuickTilingTouchMove_data() { QTest::addColumn("targetPos"); QTest::addColumn("expectedMode"); @@ -530,7 +480,7 @@ QTest::newRow("topLeft") << QPoint(0, 24) << QuickTileMode(QuickTileFlag::Top | QuickTileFlag::Left); } -void QuickTilingTest::testQuickTilingTouchMoveXdgShell() +void QuickTilingTest::testQuickTilingTouchMove() { // test verifies that touch on decoration also allows quick tiling // see BUG: 390113 @@ -789,25 +739,23 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangeSpy.isValid()); - // let's render - auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + // Map the client. + auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QCOMPARE(workspace()->activeClient(), c); QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); QCOMPARE(c->quickTileMode(), QuickTileMode(QuickTileFlag::None)); - QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); - QVERIFY(quickTileChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + + // We have to receive a configure event when the client becomes active. + QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); + QVERIFY(configureRequestedSpy.isValid()); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 1); QFETCH(QString, shortcut); - QFETCH(QuickTileMode, expectedMode); QFETCH(QRect, expectedGeometry); // invoke global shortcut through dbus @@ -819,20 +767,25 @@ msg.setArguments(QList{shortcut}); QDBusConnection::sessionBus().asyncCall(msg); + QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); + QVERIFY(quickTileChangedSpy.isValid()); QVERIFY(quickTileChangedSpy.wait()); QCOMPARE(quickTileChangedSpy.count(), 1); // at this point the geometry did not yet change QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); // but quick tile mode already changed - QCOMPARE(c->quickTileMode(), expectedMode); + QTEST(c->quickTileMode(), "expectedMode"); // but we got requested a new geometry - QTRY_COMPARE(sizeChangeSpy.count(), 1); - QCOMPARE(sizeChangeSpy.first().first().toSize(), expectedGeometry.size()); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 2); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); // attach a new image + QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); + QVERIFY(geometryChangedSpy.isValid()); + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), expectedGeometry.size(), Qt::red); - m_connection->flush(); QVERIFY(geometryChangedSpy.wait()); QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); @@ -866,18 +819,22 @@ QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); - - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QVERIFY(!shellSurface.isNull()); - QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangeSpy.isValid()); - // let's render - auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + // Map the client. + auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QCOMPARE(workspace()->activeClient(), c); QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); QCOMPARE(c->quickTileMode(), QuickTileMode(QuickTileFlag::None)); + + // We have to receive a configure event upon the client becoming active. + QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); + QVERIFY(configureRequestedSpy.isValid()); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 1); + QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); QVERIFY(quickTileChangedSpy.isValid()); QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); @@ -916,12 +873,13 @@ QCOMPARE(c->quickTileMode(), expectedMode); // but we got requested a new geometry - QTRY_COMPARE(sizeChangeSpy.count(), 1); - QCOMPARE(sizeChangeSpy.first().first().toSize(), expectedGeometry.size()); + QVERIFY(configureRequestedSpy.wait()); + QCOMPARE(configureRequestedSpy.count(), 2); + QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); // attach a new image + shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), expectedGeometry.size(), Qt::red); - m_connection->flush(); QVERIFY(geometryChangedSpy.wait()); QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); diff --git a/autotests/integration/scene_opengl_shadow_test.cpp b/autotests/integration/scene_opengl_shadow_test.cpp --- a/autotests/integration/scene_opengl_shadow_test.cpp +++ b/autotests/integration/scene_opengl_shadow_test.cpp @@ -31,7 +31,6 @@ #include #include -#include #include #include #include @@ -628,12 +627,12 @@ // Create a decorated client. QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer ssd(Test::waylandServerSideDecoration()->create(surface.data())); auto *client = Test::renderAndWaitForShown(surface.data(), windowSize, Qt::blue); - QSignalSpy sizeChangedSpy(shellSurface.data(), &ShellSurface::sizeChanged); + QSignalSpy sizeChangedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangedSpy.isValid()); // Check the client is decorated. @@ -692,7 +691,7 @@ // Create a surface. QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto *client = Test::renderAndWaitForShown(surface.data(), QSize(512, 512), Qt::blue); QVERIFY(client); QVERIFY(!client->isDecorated()); @@ -788,7 +787,7 @@ // Create a surface. QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto *client = Test::renderAndWaitForShown(surface.data(), QSize(64, 64), Qt::blue); QVERIFY(client); QVERIFY(!client->isDecorated()); diff --git a/autotests/integration/scene_qpainter_shadow_test.cpp b/autotests/integration/scene_qpainter_shadow_test.cpp --- a/autotests/integration/scene_qpainter_shadow_test.cpp +++ b/autotests/integration/scene_qpainter_shadow_test.cpp @@ -35,7 +35,6 @@ #include #include -#include #include #include #include @@ -632,12 +631,12 @@ // Create a decorated client. QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer ssd(Test::waylandServerSideDecoration()->create(surface.data())); auto *client = Test::renderAndWaitForShown(surface.data(), windowSize, Qt::blue); - QSignalSpy sizeChangedSpy(shellSurface.data(), &ShellSurface::sizeChanged); + QSignalSpy sizeChangedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangedSpy.isValid()); // Check the client is decorated. @@ -693,7 +692,7 @@ // Create a surface. QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto *client = Test::renderAndWaitForShown(surface.data(), QSize(512, 512), Qt::blue); QVERIFY(client); QVERIFY(!client->isDecorated()); diff --git a/autotests/integration/scene_qpainter_test.cpp b/autotests/integration/scene_qpainter_test.cpp --- a/autotests/integration/scene_qpainter_test.cpp +++ b/autotests/integration/scene_qpainter_test.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -153,12 +152,11 @@ void SceneQPainterTest::testWindow_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void SceneQPainterTest::testWindow() @@ -169,8 +167,8 @@ QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat)); QVERIFY(Test::waitForWaylandPointer()); QScopedPointer s(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer ss(Test::createShellSurface(type, s.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer ss(Test::createXdgShellSurface(type, s.data())); QScopedPointer p(Test::waylandSeat()->createPointer()); auto scene = KWin::Compositor::self()->scene(); @@ -214,7 +212,7 @@ QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat)); QVERIFY(Test::waitForWaylandPointer()); QScopedPointer s(Test::createSurface()); - QScopedPointer ss(Test::createShellSurface(s.data())); + QScopedPointer ss(Test::createXdgShellStableSurface(s.data())); QScopedPointer p(Test::waylandSeat()->createPointer()); QSignalSpy pointerEnteredSpy(p.data(), &Pointer::entered); QVERIFY(pointerEnteredSpy.isValid()); @@ -258,11 +256,11 @@ void SceneQPainterTest::testCompositorRestart_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void SceneQPainterTest::testCompositorRestart() @@ -274,8 +272,8 @@ using namespace KWayland::Client; QVERIFY(Test::setupWaylandConnection()); QScopedPointer s(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer ss(Test::createShellSurface(type, s.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer ss(Test::createXdgShellSurface(type, s.data())); QVERIFY(Test::renderAndWaitForShown(s.data(), QSize(200, 300), Qt::blue)); // now let's try to reinitialize the compositing scene diff --git a/autotests/integration/shell_client_rules_test.cpp b/autotests/integration/shell_client_rules_test.cpp --- a/autotests/integration/shell_client_rules_test.cpp +++ b/autotests/integration/shell_client_rules_test.cpp @@ -265,13 +265,13 @@ #define TEST_DATA(name) \ void TestShellClientRules::name##_data() \ { \ - QTest::addColumn("type"); \ - QTest::newRow("XdgShellV5") << Test::ShellSurfaceType::XdgShellV5; \ - QTest::newRow("XdgShellV6") << Test::ShellSurfaceType::XdgShellV6; \ - QTest::newRow("XdgWmBase") << Test::ShellSurfaceType::XdgShellStable; \ + QTest::addColumn("type"); \ + QTest::newRow("XdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; \ + QTest::newRow("XdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; \ + QTest::newRow("XdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; \ } -std::tuple createWindow(Test::ShellSurfaceType type, const QByteArray &appId) +std::tuple createWindow(Test::XdgShellSurfaceType type, const QByteArray &appId) { // Create an xdg surface. Surface *surface = Test::createSurface(); @@ -310,7 +310,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -348,7 +348,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -427,7 +427,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -506,7 +506,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -553,7 +553,7 @@ void TestShellClientRules::testPositionApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; QObject *shellSurface; @@ -647,7 +647,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -707,7 +707,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -758,7 +758,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -896,7 +896,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1034,7 +1034,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1109,7 +1109,7 @@ void TestShellClientRules::testSizeApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1191,7 +1191,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1281,7 +1281,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1343,7 +1343,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1455,7 +1455,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1567,7 +1567,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1654,7 +1654,7 @@ void TestShellClientRules::testMaximizeApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1776,7 +1776,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer surface; surface.reset(Test::createSurface()); QScopedPointer shellSurface; @@ -1882,7 +1882,7 @@ QCOMPARE(VirtualDesktopManager::self()->current(), 1); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -1923,7 +1923,7 @@ QCOMPARE(VirtualDesktopManager::self()->current(), 1); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -1980,7 +1980,7 @@ QCOMPARE(VirtualDesktopManager::self()->current(), 1); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2033,7 +2033,7 @@ QCOMPARE(VirtualDesktopManager::self()->current(), 1); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2077,7 +2077,7 @@ QCOMPARE(VirtualDesktopManager::self()->current(), 1); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2143,7 +2143,7 @@ QCOMPARE(VirtualDesktopManager::self()->current(), 1); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2202,7 +2202,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2237,7 +2237,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2285,7 +2285,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2331,7 +2331,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2366,7 +2366,7 @@ void TestShellClientRules::testMinimizeApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2425,7 +2425,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2473,7 +2473,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2507,7 +2507,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2553,7 +2553,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2601,7 +2601,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2636,7 +2636,7 @@ void TestShellClientRules::testSkipTaskbarApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2692,7 +2692,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2742,7 +2742,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2776,7 +2776,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2822,7 +2822,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2870,7 +2870,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2905,7 +2905,7 @@ void TestShellClientRules::testSkipPagerApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -2961,7 +2961,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3011,7 +3011,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3045,7 +3045,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3091,7 +3091,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3139,7 +3139,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3174,7 +3174,7 @@ void TestShellClientRules::testSkipSwitcherApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3230,7 +3230,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3280,7 +3280,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3314,7 +3314,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3360,7 +3360,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3406,7 +3406,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3439,7 +3439,7 @@ void TestShellClientRules::testKeepAboveApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3495,7 +3495,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3547,7 +3547,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3581,7 +3581,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3627,7 +3627,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3673,7 +3673,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3706,7 +3706,7 @@ void TestShellClientRules::testKeepBelowApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3762,7 +3762,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3814,7 +3814,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3861,7 +3861,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -3946,7 +3946,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4019,7 +4019,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4077,7 +4077,7 @@ void TestShellClientRules::testShortcutApplyNow() { // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4158,7 +4158,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4287,7 +4287,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4322,7 +4322,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4355,7 +4355,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4397,7 +4397,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4436,7 +4436,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; @@ -4476,7 +4476,7 @@ workspace()->slotReconfigure(); // Create the test client. - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); ShellClient *client; Surface *surface; XdgShellSurface *shellSurface; diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp --- a/autotests/integration/shell_client_test.cpp +++ b/autotests/integration/shell_client_test.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include #include @@ -46,7 +45,6 @@ #include #include -#include #include #include @@ -79,23 +77,18 @@ void testWindowOutputs(); void testMinimizeActiveWindow_data(); void testMinimizeActiveWindow(); - void testFullscreenWlShell_data(); - void testFullscreenWlShell(); void testFullscreen_data(); void testFullscreen(); void testFullscreenRestore_data(); void testFullscreenRestore(); void testUserCanSetFullscreen_data(); void testUserCanSetFullscreen(); - void testUserSetFullscreenWlShell(); - void testUserSetFullscreenXdgShell_data(); - void testUserSetFullscreenXdgShell(); - - void testMaximizedToFullscreenWlShell_data(); - void testMaximizedToFullscreenWlShell(); - void testMaximizedToFullscreenXdgShell_data(); - void testMaximizedToFullscreenXdgShell(); + void testUserSetFullscreen_data(); + void testUserSetFullscreen(); + + void testMaximizedToFullscreen_data(); + void testMaximizedToFullscreen(); void testWindowOpensLargerThanScreen_data(); void testWindowOpensLargerThanScreen(); void testHidden_data(); @@ -161,12 +154,11 @@ void TestShellClient::testMapUnmapMap_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testMapUnmapMap() @@ -180,8 +172,8 @@ QVERIFY(effectsWindowHiddenSpy.isValid()); QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); // now let's render Test::render(surface.data(), QSize(100, 50), Qt::blue); @@ -271,7 +263,7 @@ { // this test verifies that the desktop presence changed signals are properly emitted QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QCOMPARE(c->desktop(), 1); @@ -305,15 +297,17 @@ // this test simulates the situation that a transient window gets reused and the parent window // moved between the two usages QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); // create the Transient window + XdgPositioner positioner(QSize(50, 40), QRect(0, 0, 5, 10)); + positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); + positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); QScopedPointer transientSurface(Test::createSurface()); - QScopedPointer transientShellSurface(Test::createShellSurface(transientSurface.data())); - transientShellSurface->setTransient(surface.data(), QPoint(5, 10)); - auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(50, 40), Qt::blue); + QScopedPointer transientShellSurface(Test::createXdgShellStablePopup(transientSurface.data(), shellSurface.data(), positioner)); + auto transient = Test::renderAndWaitForShown(transientSurface.data(), positioner.initialSize(), Qt::blue); QVERIFY(transient); QCOMPARE(transient->geometry(), QRect(c->geometry().topLeft() + QPoint(5, 10), QSize(50, 40))); @@ -337,19 +331,18 @@ void TestShellClient::testWindowOutputs_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testWindowOutputs() { QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto size = QSize(200,200); QSignalSpy outputEnteredSpy(surface.data(), &Surface::outputEntered); @@ -385,20 +378,19 @@ void TestShellClient::testMinimizeActiveWindow_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testMinimizeActiveWindow() { // this test verifies that when minimizing the active window it gets deactivated QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QVERIFY(c->isActive()); @@ -425,97 +417,25 @@ QCOMPARE(workspace()->activeClient(), c); } -void TestShellClient::testFullscreenWlShell_data() -{ - QTest::addColumn("decoMode"); - - QTest::newRow("wlShell") << ServerSideDecoration::Mode::Client; - QTest::newRow("wlShell - deco") << ServerSideDecoration::Mode::Server; -} - -void TestShellClient::testFullscreenWlShell() -{ - // this test verifies that a window can be properly fullscreened - QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - QVERIFY(shellSurface); - - // create deco - QScopedPointer deco(Test::waylandServerSideDecoration()->create(surface.data())); - QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); - QVERIFY(decoSpy.isValid()); - QVERIFY(decoSpy.wait()); - QFETCH(ServerSideDecoration::Mode, decoMode); - deco->requestMode(decoMode); - QVERIFY(decoSpy.wait()); - QCOMPARE(deco->mode(), decoMode); - - auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(c); - QVERIFY(c->isActive()); - QCOMPARE(c->layer(), NormalLayer); - QVERIFY(!c->isFullScreen()); - QCOMPARE(c->clientSize(), QSize(100, 50)); - QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); - QCOMPARE(c->sizeForClientSize(c->clientSize()), c->geometry().size()); - QSignalSpy fullscreenChangedSpy(c, &ShellClient::fullScreenChanged); - QVERIFY(fullscreenChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &ShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); - QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangeRequestedSpy.isValid()); - - shellSurface->setFullscreen(); - - QVERIFY(fullscreenChangedSpy.wait()); - QVERIFY(sizeChangeRequestedSpy.wait()); - QCOMPARE(sizeChangeRequestedSpy.count(), 1); - QCOMPARE(sizeChangeRequestedSpy.first().first().toSize(), QSize(screens()->size(0))); - // TODO: should switch to fullscreen once it's updated - QVERIFY(c->isFullScreen()); - QCOMPARE(c->clientSize(), QSize(100, 50)); - QVERIFY(geometryChangedSpy.isEmpty()); - - Test::render(surface.data(), sizeChangeRequestedSpy.first().first().toSize(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); - QCOMPARE(geometryChangedSpy.count(), 1); - QVERIFY(c->isFullScreen()); - QVERIFY(!c->isDecorated()); - QCOMPARE(c->geometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.first().first().toSize())); - QCOMPARE(c->layer(), ActiveLayer); - - // swap back to normal - shellSurface->setToplevel(); - QVERIFY(fullscreenChangedSpy.wait()); - QVERIFY(sizeChangeRequestedSpy.wait()); - QCOMPARE(sizeChangeRequestedSpy.count(), 2); - QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50)); - // TODO: should switch to fullscreen once it's updated - QVERIFY(!c->isFullScreen()); - QCOMPARE(c->layer(), NormalLayer); - QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); -} - void TestShellClient::testFullscreen_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); QTest::addColumn("decoMode"); - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << ServerSideDecoration::Mode::Client; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << ServerSideDecoration::Mode::Client; - QTest::newRow("xdgShellWmBase") << Test::ShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; - - QTest::newRow("xdgShellV5 - deco") << Test::ShellSurfaceType::XdgShellV5 << ServerSideDecoration::Mode::Server; - QTest::newRow("xdgShellV6 - deco") << Test::ShellSurfaceType::XdgShellV6 << ServerSideDecoration::Mode::Server; - QTest::newRow("xdgShellWmBase - deco") << Test::ShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << ServerSideDecoration::Mode::Client; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << ServerSideDecoration::Mode::Client; + QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; + QTest::newRow("xdgShellV5 - deco") << Test::XdgShellSurfaceType::XdgShellV5 << ServerSideDecoration::Mode::Server; + QTest::newRow("xdgShellV6 - deco") << Test::XdgShellSurfaceType::XdgShellV6 << ServerSideDecoration::Mode::Server; + QTest::newRow("xdgShellWmBase - deco") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server; } void TestShellClient::testFullscreen() { // this test verifies that a window can be properly fullscreened QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QVERIFY(shellSurface); @@ -579,18 +499,18 @@ void TestShellClient::testFullscreenRestore_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgShellWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testFullscreenRestore() { // this test verifies that windows created fullscreen can be later properly restored QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); XdgShellSurface *xdgShellSurface = Test::createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly); QSignalSpy configureRequestedSpy(xdgShellSurface, &XdgShellSurface::configureRequested); @@ -641,57 +561,38 @@ void TestShellClient::testUserCanSetFullscreen_data() { - QTest::addColumn("type"); - QTest::addColumn("expected"); - - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell << false; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << true; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << true; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << true; + QTest::addColumn("type"); + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testUserCanSetFullscreen() { QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); - auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(c); - QVERIFY(c->isActive()); - QVERIFY(!c->isFullScreen()); - QTEST(c->userCanSetFullScreen(), "expected"); -} - -void TestShellClient::testUserSetFullscreenWlShell() -{ - // wlshell cannot sync fullscreen to the client - QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QVERIFY(c->isActive()); QVERIFY(!c->isFullScreen()); - QSignalSpy fullscreenChangedSpy(c, &AbstractClient::fullScreenChanged); - QVERIFY(fullscreenChangedSpy.isValid()); - c->setFullScreen(true); - QCOMPARE(fullscreenChangedSpy.count(), 0); - QVERIFY(!c->isFullScreen()); + QVERIFY(c->userCanSetFullScreen()); } -void TestShellClient::testUserSetFullscreenXdgShell_data() +void TestShellClient::testUserSetFullscreen_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } -void TestShellClient::testUserSetFullscreenXdgShell() +void TestShellClient::testUserSetFullscreen() { QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer shellSurface(Test::createXdgShellSurface( type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); QVERIFY(!shellSurface.isNull()); @@ -742,118 +643,25 @@ QVERIFY(!c->isFullScreen()); } -void TestShellClient::testMaximizedToFullscreenWlShell_data() +void TestShellClient::testMaximizedToFullscreen_data() { + QTest::addColumn("type"); QTest::addColumn("decoMode"); - QTest::newRow("wlShell") << ServerSideDecoration::Mode::Client; - QTest::newRow("wlShell - deco") << ServerSideDecoration::Mode::Server; -} + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << ServerSideDecoration::Mode::Client; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << ServerSideDecoration::Mode::Client; + QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; -void TestShellClient::testMaximizedToFullscreenWlShell() -{ - // this test verifies that a window can be properly fullscreened after maximizing - QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - - QVERIFY(shellSurface.data()); - - // create deco - QScopedPointer deco(Test::waylandServerSideDecoration()->create(surface.data())); - QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); - QVERIFY(decoSpy.isValid()); - QVERIFY(decoSpy.wait()); - QFETCH(ServerSideDecoration::Mode, decoMode); - deco->requestMode(decoMode); - QVERIFY(decoSpy.wait()); - QCOMPARE(deco->mode(), decoMode); - - auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(c); - QVERIFY(c->isActive()); - QVERIFY(!c->isFullScreen()); - QCOMPARE(c->clientSize(), QSize(100, 50)); - QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); - QSignalSpy fullscreenChangedSpy(c, &ShellClient::fullScreenChanged); - QVERIFY(fullscreenChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &ShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); - QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &ShellSurface::sizeChanged); - QVERIFY(sizeChangeRequestedSpy.isValid()); - - shellSurface->setMaximized(); - - QVERIFY(sizeChangeRequestedSpy.wait()); - QCOMPARE(sizeChangeRequestedSpy.count(), 1); - - Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); - - QCOMPARE(c->maximizeMode(), MaximizeFull); - QCOMPARE(geometryChangedSpy.isEmpty(), false); - geometryChangedSpy.clear(); - - // fullscreen the window - shellSurface->setFullscreen(); - - QVERIFY(fullscreenChangedSpy.wait()); - if (decoMode == ServerSideDecoration::Mode::Server) { - QVERIFY(sizeChangeRequestedSpy.wait()); - QCOMPARE(sizeChangeRequestedSpy.count(), 2); - } - QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(screens()->size(0))); - // TODO: should switch to fullscreen once it's updated - QVERIFY(c->isFullScreen()); - - // render at the new size - Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); - - QVERIFY(c->isFullScreen()); - QVERIFY(!c->isDecorated()); - QCOMPARE(c->geometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.last().first().toSize())); - sizeChangeRequestedSpy.clear(); - - // swap back to normal - shellSurface->setToplevel(); - - QVERIFY(fullscreenChangedSpy.wait()); - if (decoMode == ServerSideDecoration::Mode::Server) { - QVERIFY(sizeChangeRequestedSpy.wait()); - - // TODO: we should test both cases with fixed fake decoration for autotests. - const bool hasBorders = Decoration::DecorationBridge::self()->settings()->borderSize() != KDecoration2::BorderSize::None; - - // fails if we have borders as we don't correctly call setMaximize(false) - // but realistically the only toolkits that support the deco also use XDGShell - if (hasBorders) { - QEXPECT_FAIL("wlShell - deco", "With decoration incorrect geometry requested", Continue); - } - QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50)); - } - // TODO: should switch to fullscreen once it's updated - QVERIFY(!c->isFullScreen()); - QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); + QTest::newRow("xdgShellV5 - deco") << Test::XdgShellSurfaceType::XdgShellV5 << ServerSideDecoration::Mode::Server; + QTest::newRow("xdgShellV6 - deco") << Test::XdgShellSurfaceType::XdgShellV6 << ServerSideDecoration::Mode::Server; + QTest::newRow("xdgShellWmBase - deco") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server; } -void TestShellClient::testMaximizedToFullscreenXdgShell_data() -{ - QTest::addColumn("type"); - QTest::addColumn("decoMode"); - - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << ServerSideDecoration::Mode::Client; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << ServerSideDecoration::Mode::Client; - QTest::newRow("xdgShellWmBase") << Test::ShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; - - QTest::newRow("xdgShellV5 - deco") << Test::ShellSurfaceType::XdgShellV5 << ServerSideDecoration::Mode::Server; - QTest::newRow("xdgShellV6 - deco") << Test::ShellSurfaceType::XdgShellV6 << ServerSideDecoration::Mode::Server; - QTest::newRow("xdgShellWmBase - deco") << Test::ShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server; -} - -void TestShellClient::testMaximizedToFullscreenXdgShell() +void TestShellClient::testMaximizedToFullscreen() { // this test verifies that a window can be properly fullscreened after maximizing QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); + QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QVERIFY(shellSurface); @@ -932,21 +740,20 @@ void TestShellClient::testWindowOpensLargerThanScreen_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testWindowOpensLargerThanScreen() { // this test creates a window which is as large as the screen, but is decorated // the window should get resized to fit into the screen, BUG: 366632 QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), SIGNAL(sizeChanged(QSize))); QVERIFY(sizeChangeRequestedSpy.isValid()); @@ -970,20 +777,19 @@ void TestShellClient::testHidden_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testHidden() { // this test verifies that when hiding window it doesn't get shown QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QVERIFY(c->isActive()); @@ -1013,7 +819,7 @@ // this test verifies that desktop file name is passed correctly to the window QScopedPointer surface(Test::createSurface()); // only xdg-shell as ShellSurface misses the setter - QScopedPointer shellSurface(qobject_cast(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface.data()))); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); @@ -1050,7 +856,7 @@ // see BUG 323798 comment #12 QScopedPointer surface(Test::createSurface()); // only done for xdg-shell as ShellSurface misses the setter - QScopedPointer shellSurface(qobject_cast(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface.data()))); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); const QString origTitle = QString::fromUtf8(QByteArrayLiteral("Was tun, wenn Schüler Autismus haben?\342\200\250\342\200\250\342\200\250 – Marlies Hübner - Mozilla Firefox")); shellSurface->setTitle(origTitle); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); @@ -1062,34 +868,34 @@ void TestShellClient::testCaptionMultipleWindows() { QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(qobject_cast(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface.data()))); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); shellSurface->setTitle(QStringLiteral("foo")); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QCOMPARE(c->caption(), QStringLiteral("foo")); QCOMPARE(c->captionNormal(), QStringLiteral("foo")); QCOMPARE(c->captionSuffix(), QString()); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(qobject_cast(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface2.data()))); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); shellSurface2->setTitle(QStringLiteral("foo")); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); QVERIFY(c2); QCOMPARE(c2->caption(), QStringLiteral("foo <2>")); QCOMPARE(c2->captionNormal(), QStringLiteral("foo")); QCOMPARE(c2->captionSuffix(), QStringLiteral(" <2>")); QScopedPointer surface3(Test::createSurface()); - QScopedPointer shellSurface3(qobject_cast(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface3.data()))); + QScopedPointer shellSurface3(Test::createXdgShellStableSurface(surface3.data())); shellSurface3->setTitle(QStringLiteral("foo")); auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); QVERIFY(c3); QCOMPARE(c3->caption(), QStringLiteral("foo <3>")); QCOMPARE(c3->captionNormal(), QStringLiteral("foo")); QCOMPARE(c3->captionSuffix(), QStringLiteral(" <3>")); QScopedPointer surface4(Test::createSurface()); - QScopedPointer shellSurface4(qobject_cast(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface4.data()))); + QScopedPointer shellSurface4(Test::createXdgShellStableSurface(surface4.data())); shellSurface4->setTitle(QStringLiteral("bar")); auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); QVERIFY(c4); @@ -1199,19 +1005,18 @@ void TestShellClient::testX11WindowId_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testX11WindowId() { QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QVERIFY(c->windowId() != 0); @@ -1224,7 +1029,7 @@ QVERIFY (QDBusConnection::sessionBus().registerService("org.kde.kappmenu")); QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV6, surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QScopedPointer menu(Test::waylandAppMenuManager()->create(surface.data())); @@ -1240,19 +1045,18 @@ void TestShellClient::testNoDecorationModeRequested_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testNoDecorationModeRequested() { // this test verifies that the decoration follows the default mode if no mode is explicitly requested QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); QScopedPointer deco(Test::waylandServerSideDecoration()->create(surface.data())); QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); QVERIFY(decoSpy.isValid()); @@ -1269,28 +1073,28 @@ void TestShellClient::testSendClientWithTransientToDesktop_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testSendClientWithTransientToDesktop() { // this test verifies that when sending a client to a desktop all transients are also send to that desktop VirtualDesktopManager::self()->setCount(2); QScopedPointer surface{Test::createSurface()}; - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface{qobject_cast(Test::createShellSurface(type, surface.data()))}; + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); // let's create a transient window QScopedPointer transientSurface{Test::createSurface()}; - QScopedPointer transientShellSurface{qobject_cast(Test::createShellSurface(type, transientSurface.data()))}; + QScopedPointer transientShellSurface(Test::createXdgShellSurface(type, transientSurface.data())); transientShellSurface->setTransientFor(shellSurface.data()); auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(100, 50), Qt::blue); @@ -1325,11 +1129,11 @@ void TestShellClient::testMinimizeWindowWithTransients_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void TestShellClient::testMinimizeWindowWithTransients() @@ -1339,17 +1143,15 @@ // create the main window QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(qobject_cast( - Test::createShellSurface(type, surface.data()))); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(c); QVERIFY(!c->isMinimized()); // create a transient window QScopedPointer transientSurface(Test::createSurface()); - QScopedPointer transientShellSurface(qobject_cast( - Test::createShellSurface(type, transientSurface.data()))); + QScopedPointer transientShellSurface(Test::createXdgShellSurface(type, transientSurface.data())); transientShellSurface->setTransientFor(shellSurface.data()); auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(100, 50), Qt::red); QVERIFY(transient); diff --git a/autotests/integration/showing_desktop_test.cpp b/autotests/integration/showing_desktop_test.cpp --- a/autotests/integration/showing_desktop_test.cpp +++ b/autotests/integration/showing_desktop_test.cpp @@ -25,7 +25,6 @@ #include #include -#include using namespace KWin; using namespace KWayland::Client; @@ -71,10 +70,10 @@ void ShowingDesktopTest::testRestoreFocus() { QScopedPointer surface1(Test::createSurface()); - QScopedPointer shellSurface1(Test::createShellSurface(surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); auto client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); QVERIFY(client1 != client2); @@ -94,7 +93,7 @@ QScopedPointer desktopSurface(Test::createSurface()); QVERIFY(!desktopSurface.isNull()); - QScopedPointer desktopShellSurface(Test::createShellSurface(desktopSurface.data())); + QScopedPointer desktopShellSurface(Test::createXdgShellStableSurface(desktopSurface.data())); QVERIFY(!desktopSurface.isNull()); QScopedPointer plasmaSurface(Test::waylandPlasmaShell()->createSurface(desktopSurface.data())); QVERIFY(!plasmaSurface.isNull()); @@ -106,10 +105,10 @@ // now create some windows QScopedPointer surface1(Test::createSurface()); - QScopedPointer shellSurface1(Test::createShellSurface(surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); auto client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); QVERIFY(client1 != client2); diff --git a/autotests/integration/stacking_order_test.cpp b/autotests/integration/stacking_order_test.cpp --- a/autotests/integration/stacking_order_test.cpp +++ b/autotests/integration/stacking_order_test.cpp @@ -31,7 +31,6 @@ #include "workspace.h" #include -#include #include #include @@ -100,8 +99,8 @@ KWayland::Client::Surface *parentSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(parentSurface); - KWayland::Client::ShellSurface *parentShellSurface = - Test::createShellSurface(parentSurface, parentSurface); + KWayland::Client::XdgShellSurface *parentShellSurface = + Test::createXdgShellStableSurface(parentSurface, parentSurface); QVERIFY(parentShellSurface); ShellClient *parent = Test::renderAndWaitForShown(parentSurface, QSize(256, 256), Qt::blue); QVERIFY(parent); @@ -115,10 +114,10 @@ KWayland::Client::Surface *transientSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(transientSurface); - KWayland::Client::ShellSurface *transientShellSurface = - Test::createShellSurface(transientSurface, transientSurface); + KWayland::Client::XdgShellSurface *transientShellSurface = + Test::createXdgShellStableSurface(transientSurface, transientSurface); QVERIFY(transientShellSurface); - transientShellSurface->setTransient(parentSurface, QPoint(0, 0)); + transientShellSurface->setTransientFor(parentShellSurface); ShellClient *transient = Test::renderAndWaitForShown( transientSurface, QSize(128, 128), Qt::red); QVERIFY(transient); @@ -144,8 +143,8 @@ KWayland::Client::Surface *parentSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(parentSurface); - KWayland::Client::ShellSurface *parentShellSurface = - Test::createShellSurface(parentSurface, parentSurface); + KWayland::Client::XdgShellSurface *parentShellSurface = + Test::createXdgShellStableSurface(parentSurface, parentSurface); QVERIFY(parentShellSurface); ShellClient *parent = Test::renderAndWaitForShown(parentSurface, QSize(256, 256), Qt::blue); QVERIFY(parent); @@ -159,10 +158,10 @@ KWayland::Client::Surface *transientSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(transientSurface); - KWayland::Client::ShellSurface *transientShellSurface = - Test::createShellSurface(transientSurface, transientSurface); + KWayland::Client::XdgShellSurface *transientShellSurface = + Test::createXdgShellStableSurface(transientSurface, transientSurface); QVERIFY(transientShellSurface); - transientShellSurface->setTransient(parentSurface, QPoint(0, 0)); + transientShellSurface->setTransientFor(parentShellSurface); ShellClient *transient = Test::renderAndWaitForShown( transientSurface, QSize(128, 128), Qt::red); QVERIFY(transient); @@ -176,8 +175,8 @@ KWayland::Client::Surface *anotherSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(anotherSurface); - KWayland::Client::ShellSurface *anotherShellSurface = - Test::createShellSurface(anotherSurface, anotherSurface); + KWayland::Client::XdgShellSurface *anotherShellSurface = + Test::createXdgShellStableSurface(anotherSurface, anotherSurface); QVERIFY(anotherShellSurface); ShellClient *anotherClient = Test::renderAndWaitForShown(anotherSurface, QSize(128, 128), Qt::green); QVERIFY(anotherClient); @@ -227,8 +226,8 @@ KWayland::Client::Surface *parentSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(parentSurface); - KWayland::Client::ShellSurface *parentShellSurface = - Test::createShellSurface(parentSurface, parentSurface); + KWayland::Client::XdgShellSurface *parentShellSurface = + Test::createXdgShellStableSurface(parentSurface, parentSurface); QVERIFY(parentShellSurface); ShellClient *parent = Test::renderAndWaitForShown(parentSurface, QSize(256, 256), Qt::blue); QVERIFY(parent); @@ -241,10 +240,10 @@ KWayland::Client::Surface *transient1Surface = Test::createSurface(Test::waylandCompositor()); QVERIFY(transient1Surface); - KWayland::Client::ShellSurface *transient1ShellSurface = - Test::createShellSurface(transient1Surface, transient1Surface); + KWayland::Client::XdgShellSurface *transient1ShellSurface = + Test::createXdgShellStableSurface(transient1Surface, transient1Surface); QVERIFY(transient1ShellSurface); - transient1ShellSurface->setTransient(parentSurface, QPoint(0, 0)); + transient1ShellSurface->setTransientFor(parentShellSurface); ShellClient *transient1 = Test::renderAndWaitForShown( transient1Surface, QSize(128, 128), Qt::red); QVERIFY(transient1); @@ -258,10 +257,10 @@ KWayland::Client::Surface *transient2Surface = Test::createSurface(Test::waylandCompositor()); QVERIFY(transient2Surface); - KWayland::Client::ShellSurface *transient2ShellSurface = - Test::createShellSurface(transient2Surface, transient2Surface); + KWayland::Client::XdgShellSurface *transient2ShellSurface = + Test::createXdgShellStableSurface(transient2Surface, transient2Surface); QVERIFY(transient2ShellSurface); - transient2ShellSurface->setTransient(transient1Surface, QPoint(0, 0)); + transient2ShellSurface->setTransientFor(transient1ShellSurface); ShellClient *transient2 = Test::renderAndWaitForShown( transient2Surface, QSize(128, 128), Qt::red); QVERIFY(transient2); @@ -569,8 +568,8 @@ KWayland::Client::Surface *anotherSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(anotherSurface); - KWayland::Client::ShellSurface *anotherShellSurface = - Test::createShellSurface(anotherSurface, anotherSurface); + KWayland::Client::XdgShellSurface *anotherShellSurface = + Test::createXdgShellStableSurface(anotherSurface, anotherSurface); QVERIFY(anotherShellSurface); ShellClient *anotherClient = Test::renderAndWaitForShown(anotherSurface, QSize(128, 128), Qt::green); QVERIFY(anotherClient); @@ -824,8 +823,8 @@ KWayland::Client::Surface *clientASurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(clientASurface); - KWayland::Client::ShellSurface *clientAShellSurface = - Test::createShellSurface(clientASurface, clientASurface); + KWayland::Client::XdgShellSurface *clientAShellSurface = + Test::createXdgShellStableSurface(clientASurface, clientASurface); QVERIFY(clientAShellSurface); ShellClient *clientA = Test::renderAndWaitForShown(clientASurface, QSize(128, 128), Qt::green); QVERIFY(clientA); @@ -838,8 +837,8 @@ KWayland::Client::Surface *clientBSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(clientBSurface); - KWayland::Client::ShellSurface *clientBShellSurface = - Test::createShellSurface(clientBSurface, clientBSurface); + KWayland::Client::XdgShellSurface *clientBShellSurface = + Test::createXdgShellStableSurface(clientBSurface, clientBSurface); QVERIFY(clientBShellSurface); ShellClient *clientB = Test::renderAndWaitForShown(clientBSurface, QSize(128, 128), Qt::green); QVERIFY(clientB); @@ -872,8 +871,8 @@ KWayland::Client::Surface *clientASurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(clientASurface); - KWayland::Client::ShellSurface *clientAShellSurface = - Test::createShellSurface(clientASurface, clientASurface); + KWayland::Client::XdgShellSurface *clientAShellSurface = + Test::createXdgShellStableSurface(clientASurface, clientASurface); QVERIFY(clientAShellSurface); ShellClient *clientA = Test::renderAndWaitForShown(clientASurface, QSize(128, 128), Qt::green); QVERIFY(clientA); @@ -886,8 +885,8 @@ KWayland::Client::Surface *clientBSurface = Test::createSurface(Test::waylandCompositor()); QVERIFY(clientBSurface); - KWayland::Client::ShellSurface *clientBShellSurface = - Test::createShellSurface(clientBSurface, clientBSurface); + KWayland::Client::XdgShellSurface *clientBShellSurface = + Test::createXdgShellStableSurface(clientBSurface, clientBSurface); QVERIFY(clientBShellSurface); ShellClient *clientB = Test::renderAndWaitForShown(clientBSurface, QSize(128, 128), Qt::green); QVERIFY(clientB); diff --git a/autotests/integration/start_test.cpp b/autotests/integration/start_test.cpp deleted file mode 100644 --- a/autotests/integration/start_test.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2015 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ -#include "kwin_wayland_test.h" -#include "platform.h" -#include "screens.h" -#include "wayland_server.h" -#include "workspace.h" -#include "shell_client.h" - -#include -#include -#include -#include - -namespace KWin -{ - -static const QString s_socketName = QStringLiteral("wayland_test_kwin_start_test-0"); - -class StartTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void initTestCase(); - void cleanup(); - void testScreens(); - void testNoWindowsAtStart(); - void testCreateWindow(); - void testHideShowCursor(); -}; - -void StartTest::initTestCase() -{ - QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); - QVERIFY(workspaceCreatedSpy.isValid()); - kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); - QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); - QVERIFY(waylandServer()->hasGlobalShortcutSupport()); - kwinApp()->start(); - QVERIFY(workspaceCreatedSpy.wait()); -} - -void StartTest::cleanup() -{ - Test::destroyWaylandConnection(); -} - -void StartTest::testScreens() -{ - QCOMPARE(screens()->count(), 1); - QCOMPARE(screens()->size(), QSize(1280, 1024)); - QCOMPARE(screens()->geometry(), QRect(0, 0, 1280, 1024)); -} - -void StartTest::testNoWindowsAtStart() -{ - QVERIFY(workspace()->clientList().isEmpty()); - QVERIFY(workspace()->desktopList().isEmpty()); - QVERIFY(workspace()->allClientList().isEmpty()); - QVERIFY(workspace()->deletedList().isEmpty()); - QVERIFY(workspace()->unmanagedList().isEmpty()); - QVERIFY(waylandServer()->clients().isEmpty()); -} - -void StartTest::testCreateWindow() -{ - // first we need to connect to the server - using namespace KWayland::Client; - QVERIFY(Test::setupWaylandConnection()); - - QSignalSpy shellClientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); - QVERIFY(shellClientAddedSpy.isValid()); - QSignalSpy shellClientRemovedSpy(waylandServer(), &WaylandServer::shellClientRemoved); - QVERIFY(shellClientRemovedSpy.isValid()); - - { - QScopedPointer surface(Test::createSurface()); - QVERIFY(!surface.isNull()); - QSignalSpy surfaceRenderedSpy(surface.data(), &Surface::frameRendered); - QVERIFY(surfaceRenderedSpy.isValid()); - - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - QVERIFY(!shellSurface.isNull()); - Test::flushWaylandConnection(); - QVERIFY(waylandServer()->clients().isEmpty()); - // now dispatch should give us the client - waylandServer()->dispatch(); - QTRY_COMPARE(waylandServer()->clients().count(), 1); - // but still not yet in workspace - QVERIFY(workspace()->allClientList().isEmpty()); - - // icon geometry accesses windowManagementInterface which only exists after window became visible - // verify that accessing doesnt't crash - QVERIFY(waylandServer()->clients().first()->iconGeometry().isNull()); - - // let's render - Test::render(surface.data(), QSize(100, 50), Qt::blue); - surface->commit(); - - Test::flushWaylandConnection(); - QVERIFY(shellClientAddedSpy.wait()); - QCOMPARE(workspace()->allClientList().count(), 1); - QCOMPARE(workspace()->allClientList().first(), waylandServer()->clients().first()); - QVERIFY(workspace()->activeClient()); - QCOMPARE(workspace()->activeClient()->pos(), QPoint(0, 0)); - QCOMPARE(workspace()->activeClient()->size(), QSize(100, 50)); - QCOMPARE(workspace()->activeClient()->geometry(), QRect(0, 0, 100, 50)); - - // and kwin will render it - QVERIFY(surfaceRenderedSpy.wait()); - } - // this should tear down everything again - QVERIFY(shellClientRemovedSpy.wait()); - QVERIFY(waylandServer()->clients().isEmpty()); -} - - -void StartTest::testHideShowCursor() -{ - QCOMPARE(kwinApp()->platform()->isCursorHidden(), false); - kwinApp()->platform()->hideCursor(); - QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); - kwinApp()->platform()->showCursor(); - QCOMPARE(kwinApp()->platform()->isCursorHidden(), false); - - - kwinApp()->platform()->hideCursor(); - QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); - kwinApp()->platform()->hideCursor(); - kwinApp()->platform()->hideCursor(); - kwinApp()->platform()->hideCursor(); - QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); - - kwinApp()->platform()->showCursor(); - QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); - kwinApp()->platform()->showCursor(); - QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); - kwinApp()->platform()->showCursor(); - QCOMPARE(kwinApp()->platform()->isCursorHidden(), true); - kwinApp()->platform()->showCursor(); - QCOMPARE(kwinApp()->platform()->isCursorHidden(), false); -} - -} - -WAYLANDTEST_MAIN(KWin::StartTest) -#include "start_test.moc" diff --git a/autotests/integration/struts_test.cpp b/autotests/integration/struts_test.cpp --- a/autotests/integration/struts_test.cpp +++ b/autotests/integration/struts_test.cpp @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -173,11 +172,11 @@ for (auto it = windowGeometries.constBegin(), end = windowGeometries.constEnd(); it != end; it++) { const QRect windowGeometry = *it; Surface *surface = Test::createSurface(m_compositor); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); - Q_UNUSED(shellSurface) + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface, Test::CreationSetup::CreateOnly); PlasmaShellSurface *plasmaSurface = m_plasmaShell->createSurface(surface, surface); plasmaSurface->setPosition(windowGeometry.topLeft()); plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); + Test::initXdgShellSurface(surface, shellSurface); // map the window auto c = Test::renderAndWaitForShown(surface, windowGeometry.size(), Qt::red, QImage::Format_RGB32); @@ -228,11 +227,11 @@ using namespace KWayland::Client; const QRect windowGeometry(0, 1000, 1280, 24); QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - Q_UNUSED(shellSurface) + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); plasmaSurface->setPosition(windowGeometry.topLeft()); plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); + Test::initXdgShellSurface(surface.data(), shellSurface.data()); // map the window auto c = Test::renderAndWaitForShown(surface.data(), windowGeometry.size(), Qt::red, QImage::Format_RGB32); @@ -272,11 +271,11 @@ // create first top panel const QRect windowGeometry(0, 0, 1280, 60); QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - Q_UNUSED(shellSurface) + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); plasmaSurface->setPosition(windowGeometry.topLeft()); plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); + Test::initXdgShellSurface(surface.data(), shellSurface.data()); // map the first panel auto c = Test::renderAndWaitForShown(surface.data(), windowGeometry.size(), Qt::red, QImage::Format_RGB32); @@ -295,11 +294,11 @@ // create another bottom panel const QRect windowGeometry2(0, 874, 1280, 150); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(surface2.data())); - Q_UNUSED(shellSurface2) + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data(), surface2.data(), Test::CreationSetup::CreateOnly)); QScopedPointer plasmaSurface2(m_plasmaShell->createSurface(surface2.data())); plasmaSurface2->setPosition(windowGeometry2.topLeft()); plasmaSurface2->setRole(PlasmaShellSurface::Role::Panel); + Test::initXdgShellSurface(surface2.data(), shellSurface2.data()); auto c1 = Test::renderAndWaitForShown(surface2.data(), windowGeometry2.size(), Qt::blue, QImage::Format_RGB32); @@ -314,6 +313,12 @@ QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 60, 2560, 814)); + + // Destroy test clients. + shellSurface.reset(); + QVERIFY(Test::waitForWindowDestroyed(c)); + shellSurface2.reset(); + QVERIFY(Test::waitForWindowDestroyed(c1)); } void StrutsTest::testX11Struts_data() diff --git a/autotests/integration/tabbox_test.cpp b/autotests/integration/tabbox_test.cpp --- a/autotests/integration/tabbox_test.cpp +++ b/autotests/integration/tabbox_test.cpp @@ -89,17 +89,17 @@ // first create three windows QScopedPointer surface1(Test::createSurface()); - QScopedPointer shellSurface1(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); QVERIFY(c1); QVERIFY(c1->isActive()); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::red); QVERIFY(c2); QVERIFY(c2->isActive()); QScopedPointer surface3(Test::createSurface()); - QScopedPointer shellSurface3(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface3.data())); + QScopedPointer shellSurface3(Test::createXdgShellStableSurface(surface3.data())); auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::red); QVERIFY(c3); QVERIFY(c3->isActive()); @@ -152,17 +152,17 @@ // first create three windows QScopedPointer surface1(Test::createSurface()); - QScopedPointer shellSurface1(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); QVERIFY(c1); QVERIFY(c1->isActive()); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::red); QVERIFY(c2); QVERIFY(c2->isActive()); QScopedPointer surface3(Test::createSurface()); - QScopedPointer shellSurface3(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface3.data())); + QScopedPointer shellSurface3(Test::createXdgShellStableSurface(surface3.data())); auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::red); QVERIFY(c3); QVERIFY(c3->isActive()); @@ -203,17 +203,17 @@ // first create three windows QScopedPointer surface1(Test::createSurface()); - QScopedPointer shellSurface1(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface1.data())); + QScopedPointer shellSurface1(Test::createXdgShellStableSurface(surface1.data())); auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); QVERIFY(c1); QVERIFY(c1->isActive()); QScopedPointer surface2(Test::createSurface()); - QScopedPointer shellSurface2(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface2.data())); + QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::red); QVERIFY(c2); QVERIFY(c2->isActive()); QScopedPointer surface3(Test::createSurface()); - QScopedPointer shellSurface3(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface3.data())); + QScopedPointer shellSurface3(Test::createXdgShellStableSurface(surface3.data())); auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::red); QVERIFY(c3); QVERIFY(c3->isActive()); diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -68,7 +67,6 @@ SubCompositor *subCompositor = nullptr; ServerSideDecorationManager *decoration = nullptr; ShadowManager *shadowManager = nullptr; - Shell *shell = nullptr; XdgShell *xdgShellV5 = nullptr; XdgShell *xdgShellV6 = nullptr; XdgShell *xdgShellStable = nullptr; @@ -157,10 +155,6 @@ if (!s_waylandConnection.shm->isValid()) { return false; } - s_waylandConnection.shell = registry->createShell(registry->interface(Registry::Interface::Shell).name, registry->interface(Registry::Interface::Shell).version); - if (!s_waylandConnection.shell->isValid()) { - return false; - } s_waylandConnection.xdgShellV5 = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellUnstableV5).name, registry->interface(Registry::Interface::XdgShellUnstableV5).version); if (!s_waylandConnection.xdgShellV5->isValid()) { return false; @@ -261,8 +255,6 @@ s_waylandConnection.xdgShellV6 = nullptr; delete s_waylandConnection.xdgShellStable; s_waylandConnection.xdgShellStable = nullptr; - delete s_waylandConnection.shell; - s_waylandConnection.shell = nullptr; delete s_waylandConnection.shadowManager; s_waylandConnection.shadowManager = nullptr; delete s_waylandConnection.idleInhibit; @@ -311,11 +303,6 @@ return s_waylandConnection.shadowManager; } -Shell *waylandShell() -{ - return s_waylandConnection.shell; -} - ShmPool *waylandShmPool() { return s_waylandConnection.shm; @@ -471,19 +458,6 @@ return s; } -ShellSurface *createShellSurface(Surface *surface, QObject *parent) -{ - if (!s_waylandConnection.shell) { - return nullptr; - } - auto s = s_waylandConnection.shell->createSurface(surface, parent); - if (!s->isValid()) { - delete s; - return nullptr; - } - return s; -} - XdgShellSurface *createXdgShellV5Surface(Surface *surface, QObject *parent, CreationSetup creationSetup) { if (!s_waylandConnection.xdgShellV5) { @@ -568,32 +542,14 @@ shellPopup->ackConfigure(configureRequestedSpy.last()[1].toInt()); } - -QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent) -{ - switch (type) { - case ShellSurfaceType::WlShell: - return createShellSurface(surface, parent); - case ShellSurfaceType::XdgShellV5: - return createXdgShellV5Surface(surface, parent, CreationSetup::CreateAndConfigure); - case ShellSurfaceType::XdgShellV6: - return createXdgShellV6Surface(surface, parent, CreationSetup::CreateAndConfigure); - case ShellSurfaceType::XdgShellStable: - return createXdgShellStableSurface(surface, parent, CreationSetup::CreateAndConfigure); - default: - Q_UNREACHABLE(); - return nullptr; - } -} - -KWayland::Client::XdgShellSurface *createXdgShellSurface(ShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent, CreationSetup creationSetup) +KWayland::Client::XdgShellSurface *createXdgShellSurface(XdgShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent, CreationSetup creationSetup) { switch (type) { - case ShellSurfaceType::XdgShellV5: + case XdgShellSurfaceType::XdgShellV5: return createXdgShellV5Surface(surface, parent, creationSetup); - case ShellSurfaceType::XdgShellV6: + case XdgShellSurfaceType::XdgShellV6: return createXdgShellV6Surface(surface, parent, creationSetup); - case ShellSurfaceType::XdgShellStable: + case XdgShellSurfaceType::XdgShellStable: return createXdgShellStableSurface(surface, parent, creationSetup); default: return nullptr; diff --git a/autotests/integration/touch_input_test.cpp b/autotests/integration/touch_input_test.cpp --- a/autotests/integration/touch_input_test.cpp +++ b/autotests/integration/touch_input_test.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -106,7 +105,7 @@ Surface *surface = Test::createSurface(Test::waylandCompositor()); VERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); + XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface); VERIFY(shellSurface); if (decorated) { auto deco = Test::waylandServerSideDecoration()->create(surface, surface); diff --git a/autotests/integration/transient_no_input_test.cpp b/autotests/integration/transient_no_input_test.cpp deleted file mode 100644 --- a/autotests/integration/transient_no_input_test.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2015 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ -#include "kwin_wayland_test.h" -#include "platform.h" -#include "abstract_client.h" -#include "screens.h" -#include "wayland_server.h" -#include "workspace.h" -#include "shell_client.h" - -#include -#include -#include -#include - -namespace KWin -{ - -static const QString s_socketName = QStringLiteral("wayland_test_kwin_transient_no_input-0"); - -class TransientNoInputTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void initTestCase(); - void init(); - void cleanup(); - void testTransientNoFocus(); -}; - -void TransientNoInputTest::initTestCase() -{ - qRegisterMetaType(); - QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); - QVERIFY(workspaceCreatedSpy.isValid()); - kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); - QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); - kwinApp()->start(); - QVERIFY(workspaceCreatedSpy.wait()); -} - -void TransientNoInputTest::init() -{ - QVERIFY(Test::setupWaylandConnection()); -} - -void TransientNoInputTest::cleanup() -{ - Test::destroyWaylandConnection(); -} - -void TransientNoInputTest::testTransientNoFocus() -{ - using namespace KWayland::Client; - - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); - QVERIFY(clientAddedSpy.isValid()); - - QScopedPointer surface(Test::createSurface()); - QVERIFY(!surface.isNull()); - - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); - QVERIFY(!shellSurface.isNull()); - // let's render - Test::render(surface.data(), QSize(100, 50), Qt::blue); - - Test::flushWaylandConnection(); - QVERIFY(clientAddedSpy.wait()); - AbstractClient *c = workspace()->activeClient(); - QVERIFY(c); - QCOMPARE(clientAddedSpy.first().first().value(), c); - - // let's create a transient with no input - QScopedPointer transientSurface(Test::createSurface()); - QVERIFY(!transientSurface.isNull()); - QScopedPointer transientShellSurface(Test::createShellSurface(transientSurface.data())); - QVERIFY(!transientShellSurface.isNull()); - transientShellSurface->setTransient(surface.data(), QPoint(10, 20), ShellSurface::TransientFlag::NoFocus); - Test::flushWaylandConnection(); - // let's render - Test::render(transientSurface.data(), QSize(200, 20), Qt::red); - Test::flushWaylandConnection(); - QVERIFY(clientAddedSpy.wait()); - // get the latest ShellClient - auto transientClient = clientAddedSpy.last().first().value(); - QVERIFY(transientClient != c); - QCOMPARE(transientClient->geometry(), QRect(c->x() + 10, c->y() + 20, 200, 20)); - QVERIFY(transientClient->isTransient()); - QVERIFY(!transientClient->wantsInput()); - - // workspace's active window should not have changed - QCOMPARE(workspace()->activeClient(), c); -} - -} - -WAYLANDTEST_MAIN(KWin::TransientNoInputTest) -#include "transient_no_input_test.moc" diff --git a/autotests/integration/transient_placement.cpp b/autotests/integration/transient_placement.cpp --- a/autotests/integration/transient_placement.cpp +++ b/autotests/integration/transient_placement.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -45,7 +44,6 @@ #include #include - namespace KWin { @@ -58,18 +56,9 @@ void initTestCase(); void init(); void cleanup(); - void testSimplePosition_data(); - void testSimplePosition(); - void testDecorationPosition_data(); - void testDecorationPosition(); void testXdgPopup_data(); void testXdgPopup(); void testXdgPopupWithPanel(); - -private: - AbstractClient *showWlShellWindow(const QSize &size, bool decorated = false, KWayland::Client::Surface *parent = nullptr, const QPoint &offset = QPoint()); - - KWayland::Client::Surface *surfaceForClient(AbstractClient *c) const; }; void TransientPlacementTest::initTestCase() @@ -104,128 +93,6 @@ Test::destroyWaylandConnection(); } -AbstractClient *TransientPlacementTest::showWlShellWindow(const QSize &size, bool decorated, KWayland::Client::Surface *parent, const QPoint &offset) -{ - using namespace KWayland::Client; -#define VERIFY(statement) \ - if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\ - return nullptr; -#define COMPARE(actual, expected) \ - if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ - return nullptr; - - Surface *surface = Test::createSurface(Test::waylandCompositor()); - VERIFY(surface); - ShellSurface *shellSurface = Test::createShellSurface(surface, surface); - VERIFY(shellSurface); - if (parent) { - shellSurface->setTransient(parent, offset); - } - if (decorated) { - auto deco = Test::waylandServerSideDecoration()->create(surface, surface); - QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged); - VERIFY(decoSpy.isValid()); - VERIFY(decoSpy.wait()); - deco->requestMode(ServerSideDecoration::Mode::Server); - VERIFY(decoSpy.wait()); - COMPARE(deco->mode(), ServerSideDecoration::Mode::Server); - } - // let's render - auto c = Test::renderAndWaitForShown(surface, size, Qt::blue); - - VERIFY(c); - COMPARE(workspace()->activeClient(), c); - -#undef VERIFY -#undef COMPARE - - return c; -} - -KWayland::Client::Surface *TransientPlacementTest::surfaceForClient(AbstractClient *c) const -{ - const auto &surfaces = KWayland::Client::Surface::all(); - auto it = std::find_if(surfaces.begin(), surfaces.end(), [c] (KWayland::Client::Surface *s) { return s->id() == c->surface()->id(); }); - if (it != surfaces.end()) { - return *it; - } - return nullptr; -} - -void TransientPlacementTest::testSimplePosition_data() -{ - QTest::addColumn("parentSize"); - QTest::addColumn("parentPosition"); - QTest::addColumn("transientSize"); - QTest::addColumn("transientOffset"); - QTest::addColumn("expectedGeometry"); - - QTest::newRow("0/0") << QSize(640, 512) << QPoint(0, 0) << QSize(10, 100) << QPoint(0, 0) << QRect(0, 0, 10, 100); - QTest::newRow("bottomRight") << QSize(640, 512) << QPoint(0, 0) << QSize(10, 100) << QPoint(639, 511) << QRect(639, 511, 10, 100); - QTest::newRow("offset") << QSize(640, 512) << QPoint(200, 300) << QSize(100, 10) << QPoint(320, 256) << QRect(520, 556, 100, 10); - QTest::newRow("right border") << QSize(1280, 1024) << QPoint(0, 0) << QSize(10, 100) << QPoint(1279, 50) << QRect(1270, 50, 10, 100); - QTest::newRow("bottom border") << QSize(1280, 1024) << QPoint(0, 0) << QSize(10, 100) << QPoint(512, 1020) << QRect(512, 924, 10, 100); - QTest::newRow("bottom right") << QSize(1280, 1024) << QPoint(0, 0) << QSize(10, 100) << QPoint(1279, 1020) << QRect(1270, 924, 10, 100); - QTest::newRow("top border") << QSize(1280, 1024) << QPoint(0, -100) << QSize(10, 100) << QPoint(512, 50) << QRect(512, 0, 10, 100); - QTest::newRow("left border") << QSize(1280, 1024) << QPoint(-100, 0) << QSize(100, 10) << QPoint(50, 512) << QRect(0, 512, 100, 10); - QTest::newRow("top left") << QSize(1280, 1024) << QPoint(-100, -100) << QSize(100, 100) << QPoint(50, 50) << QRect(0, 0, 100, 100); - QTest::newRow("bottom left") << QSize(1280, 1024) << QPoint(-100, 0) << QSize(100, 100) << QPoint(50, 1000) << QRect(0, 924, 100, 100); -} - -void TransientPlacementTest::testSimplePosition() -{ - // this test verifies that the position of a transient window is taken from the passed position - // there are no further constraints like window too large to fit screen, cascading transients, etc - // some test cases also verify that the transient fits on the screen - QFETCH(QSize, parentSize); - AbstractClient *parent = showWlShellWindow(parentSize); - QVERIFY(parent->clientPos().isNull()); - QVERIFY(!parent->isDecorated()); - QFETCH(QPoint, parentPosition); - parent->move(parentPosition); - QFETCH(QSize, transientSize); - QFETCH(QPoint, transientOffset); - AbstractClient *transient = showWlShellWindow(transientSize, false, surfaceForClient(parent), transientOffset); - QVERIFY(transient); - QVERIFY(!transient->isDecorated()); - QVERIFY(transient->hasTransientPlacementHint()); - QTEST(transient->geometry(), "expectedGeometry"); -} - -void TransientPlacementTest::testDecorationPosition_data() -{ - QTest::addColumn("parentSize"); - QTest::addColumn("parentPosition"); - QTest::addColumn("transientSize"); - QTest::addColumn("transientOffset"); - QTest::addColumn("expectedGeometry"); - - QTest::newRow("0/0") << QSize(640, 512) << QPoint(0, 0) << QSize(10, 100) << QPoint(0, 0) << QRect(0, 0, 10, 100); - QTest::newRow("bottomRight") << QSize(640, 512) << QPoint(0, 0) << QSize(10, 100) << QPoint(639, 511) << QRect(639, 511, 10, 100); - QTest::newRow("offset") << QSize(640, 512) << QPoint(200, 300) << QSize(100, 10) << QPoint(320, 256) << QRect(520, 556, 100, 10); -} - -void TransientPlacementTest::testDecorationPosition() -{ - // this test verifies that a transient window is correctly placed if the parent window has a - // server side decoration - QFETCH(QSize, parentSize); - AbstractClient *parent = showWlShellWindow(parentSize, true); - QVERIFY(!parent->clientPos().isNull()); - QVERIFY(parent->isDecorated()); - QFETCH(QPoint, parentPosition); - parent->move(parentPosition); - QFETCH(QSize, transientSize); - QFETCH(QPoint, transientOffset); - AbstractClient *transient = showWlShellWindow(transientSize, false, surfaceForClient(parent), transientOffset); - QVERIFY(transient); - QVERIFY(!transient->isDecorated()); - QVERIFY(transient->hasTransientPlacementHint()); - QFETCH(QRect, expectedGeometry); - expectedGeometry.translate(parent->clientPos()); - QCOMPARE(transient->geometry(), expectedGeometry); -} - void TransientPlacementTest::testXdgPopup_data() { using namespace KWayland::Client; diff --git a/autotests/integration/virtual_desktop_test.cpp b/autotests/integration/virtual_desktop_test.cpp --- a/autotests/integration/virtual_desktop_test.cpp +++ b/autotests/integration/virtual_desktop_test.cpp @@ -132,12 +132,11 @@ void VirtualDesktopTest::testLastDesktopRemoved_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void VirtualDesktopTest::testLastDesktopRemoved() @@ -153,8 +152,8 @@ // now create a window on this desktop QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(client); @@ -178,12 +177,11 @@ void VirtualDesktopTest::testWindowOnMultipleDesktops_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void VirtualDesktopTest::testWindowOnMultipleDesktops() @@ -199,8 +197,8 @@ // now create a window on this desktop QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(client); @@ -268,12 +266,11 @@ void VirtualDesktopTest::testRemoveDesktopWithWindow_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); - QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; - QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; - QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; - QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; + QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; + QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; + QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; } void VirtualDesktopTest::testRemoveDesktopWithWindow() @@ -289,8 +286,8 @@ // now create a window on this desktop QScopedPointer surface(Test::createSurface()); - QFETCH(Test::ShellSurfaceType, type); - QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QFETCH(Test::XdgShellSurfaceType, type); + QScopedPointer shellSurface(Test::createXdgShellSurface(type, surface.data())); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(client); diff --git a/autotests/integration/window_selection_test.cpp b/autotests/integration/window_selection_test.cpp --- a/autotests/integration/window_selection_test.cpp +++ b/autotests/integration/window_selection_test.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -99,7 +98,7 @@ { // this test verifies window selection through pointer works QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer pointer(Test::waylandSeat()->createPointer()); QScopedPointer keyboard(Test::waylandSeat()->createKeyboard()); QSignalSpy pointerEnteredSpy(pointer.data(), &Pointer::entered); @@ -185,7 +184,7 @@ { // this test verifies window selection through keyboard key QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer pointer(Test::waylandSeat()->createPointer()); QScopedPointer keyboard(Test::waylandSeat()->createKeyboard()); QSignalSpy pointerEnteredSpy(pointer.data(), &Pointer::entered); @@ -262,7 +261,7 @@ QSignalSpy touchCanceledSpy(touch.data(), &Touch::sequenceCanceled); QVERIFY(touchCanceledSpy.isValid()); QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(client); @@ -320,7 +319,7 @@ { // this test verifies that window selection cancels through right button click QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer pointer(Test::waylandSeat()->createPointer()); QScopedPointer keyboard(Test::waylandSeat()->createKeyboard()); QSignalSpy pointerEnteredSpy(pointer.data(), &Pointer::entered); @@ -379,7 +378,7 @@ { // this test verifies that cancel window selection through escape key works QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer pointer(Test::waylandSeat()->createPointer()); QScopedPointer keyboard(Test::waylandSeat()->createKeyboard()); QSignalSpy pointerEnteredSpy(pointer.data(), &Pointer::entered); @@ -438,7 +437,7 @@ { // this test verifies point selection through pointer works QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer pointer(Test::waylandSeat()->createPointer()); QScopedPointer keyboard(Test::waylandSeat()->createKeyboard()); QSignalSpy pointerEnteredSpy(pointer.data(), &Pointer::entered); diff --git a/autotests/integration/x11_client_test.cpp b/autotests/integration/x11_client_test.cpp --- a/autotests/integration/x11_client_test.cpp +++ b/autotests/integration/x11_client_test.cpp @@ -32,7 +32,6 @@ #include "workspace.h" #include -#include #include #include @@ -199,7 +198,7 @@ // now let's open a Wayland window QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(waylandClient); QVERIFY(waylandClient->isActive()); @@ -310,7 +309,7 @@ // create Wayland window QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(waylandClient); QVERIFY(waylandClient->isActive()); @@ -378,7 +377,7 @@ // activate a wayland window QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(waylandClient); QVERIFY(waylandClient->isActive());