diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h
index b5b3763348..4c7b183c3d 100644
--- a/autotests/integration/kwin_wayland_test.h
+++ b/autotests/integration/kwin_wayland_test.h
@@ -46,6 +46,7 @@ class Shell;
class ShellSurface;
class ShmPool;
class Surface;
+class XdgDecorationManager;
}
}
@@ -89,7 +90,8 @@ enum class AdditionalWaylandInterface {
PointerConstraints = 1 << 4,
IdleInhibition = 1 << 5,
AppMenu = 1 << 6,
- ShadowManager = 1 << 7
+ ShadowManager = 1 << 7,
+ XdgDecoration = 1 << 8,
};
Q_DECLARE_FLAGS(AdditionalWaylandInterfaces, AdditionalWaylandInterface)
/**
@@ -120,7 +122,7 @@ KWayland::Client::PlasmaWindowManagement *waylandWindowManagement();
KWayland::Client::PointerConstraints *waylandPointerConstraints();
KWayland::Client::IdleInhibitManager *waylandIdleInhibitManager();
KWayland::Client::AppMenuManager *waylandAppMenuManager();
-
+KWayland::Client::XdgDecorationManager *xdgDecorationManager();
bool waitForWaylandPointer();
bool waitForWaylandTouch();
diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp
index 59d0202b9a..186d566cb5 100644
--- a/autotests/integration/shell_client_test.cpp
+++ b/autotests/integration/shell_client_test.cpp
@@ -36,12 +36,13 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
#include
#include
#include
-
+#include
// system
#include
@@ -96,6 +97,8 @@ private Q_SLOTS:
void testSendClientWithTransientToDesktop();
void testMinimizeWindowWithTransients_data();
void testMinimizeWindowWithTransients();
+ void testXdgDecoration_data();
+ void testXdgDecoration();
};
void TestShellClient::initTestCase()
@@ -122,6 +125,7 @@ void TestShellClient::initTestCase()
void TestShellClient::init()
{
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration |
+ Test::AdditionalWaylandInterface::XdgDecoration |
Test::AdditionalWaylandInterface::AppMenu));
screens()->setCurrent(0);
@@ -1196,5 +1200,44 @@ void TestShellClient::testMinimizeWindowWithTransients()
QVERIFY(!transient->isMinimized());
}
+void TestShellClient::testXdgDecoration_data()
+{
+ QTest::addColumn("requestedMode");
+ QTest::addColumn("expectedMode");
+
+ QTest::newRow("client side requested") << XdgDecoration::Mode::ClientSide << XdgDecoration::Mode::ClientSide;
+ QTest::newRow("server side requested") << XdgDecoration::Mode::ServerSide << XdgDecoration::Mode::ServerSide;
+}
+
+void TestShellClient::testXdgDecoration()
+{
+ QScopedPointer surface(Test::createSurface());
+ QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data()));
+ QScopedPointer deco(Test::xdgDecorationManager()->getToplevelDecoration(shellSurface.data()));
+
+ QSignalSpy decorationConfiguredSpy(deco.data(), &XdgDecoration::modeChanged);
+ QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested);
+
+ QFETCH(KWayland::Client::XdgDecoration::Mode, requestedMode);
+ QFETCH(KWayland::Client::XdgDecoration::Mode, expectedMode);
+
+ //request a mode
+ deco->setMode(requestedMode);
+
+ //kwin will send a configure
+ decorationConfiguredSpy.wait();
+ configureRequestedSpy.wait();
+
+ QCOMPARE(decorationConfiguredSpy.count(), 1);
+ QCOMPARE(decorationConfiguredSpy.first()[0].value(), expectedMode);
+ QVERIFY(configureRequestedSpy.count() > 0);
+
+ shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt());
+
+ auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
+ QCOMPARE(c->userCanSetNoBorder(), expectedMode == XdgDecoration::Mode::ServerSide);
+ QCOMPARE(c->isDecorated(), expectedMode == XdgDecoration::Mode::ServerSide);
+}
+
WAYLANDTEST_MAIN(TestShellClient)
#include "shell_client_test.moc"
diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp
index a949455f0f..72405a56cd 100644
--- a/autotests/integration/test_helpers.cpp
+++ b/autotests/integration/test_helpers.cpp
@@ -39,6 +39,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
//screenlocker
@@ -78,6 +79,7 @@ static struct {
QVector