summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp8
-rw-r--r--tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp20
2 files changed, 25 insertions, 3 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index 56d77ec4f..b6d23ac10 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -156,10 +156,12 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_close()
void QWaylandXdgSurface::Toplevel::requestWindowFlags(Qt::WindowFlags flags)
{
if (m_decoration) {
- if (flags & Qt::FramelessWindowHint)
- m_decoration->requestMode(QWaylandXdgToplevelDecorationV1::mode_client_side);
- else
+ if (flags & Qt::FramelessWindowHint) {
+ delete m_decoration;
+ m_decoration = nullptr;
+ } else {
m_decoration->unsetMode();
+ }
}
}
diff --git a/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
index 391abd83b..e02ebeff9 100644
--- a/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
+++ b/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
@@ -154,6 +154,7 @@ private slots:
void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
void clientSidePreferredByCompositor();
void initialFramelessWindowHint();
+ void delayedFramelessWindowHint();
};
void tst_xdgdecorationv1::initTestCase()
@@ -200,5 +201,24 @@ void tst_xdgdecorationv1::initialFramelessWindowHint()
QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration());
}
+void tst_xdgdecorationv1::delayedFramelessWindowHint()
+{
+ QRasterWindow window;
+ window.show();
+ QCOMPOSITOR_TRY_COMPARE(get<XdgDecorationManagerV1>()->resourceMap().size(), 1);
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([=]{
+ xdgToplevel()->sendCompleteConfigure();
+ });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+ QCOMPOSITOR_TRY_VERIFY(toplevelDecoration());
+
+ window.setFlag(Qt::FramelessWindowHint, true);
+
+ // The client should now destroy the decoration object, so the compositor is no longer
+ // able to force window decorations
+ QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration());
+}
+
QCOMPOSITOR_TEST_MAIN(tst_xdgdecorationv1)
#include "tst_xdgdecorationv1.moc"