From 21a5038f8a2a6acc6dd1cc2f6bb0318d2c17f741 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 22 May 2019 23:49:20 +0100 Subject: Avoid creating decoration whilst Xdg Decoration is pending configure Currently even when we are on on a compositor with SSDs we always create a decoration instance only to discard it. Not only is this somewhat wasteful, it creates sizing problems as the frame geometry changes, leading to constantly expanding windows on kwin. This patch assumes that if we have a decoration manager we should have no decoration until it is configured to do so. This is safe because we request a mode in the constructor, a compositor must reply with a configure event and we shouldn't be showing any buffers until the first configure event is received. Behavior without a decoration manager is unchanged Change-Id: I72b2cf4423fe6461ba405612262f76cefe4d6201 Reviewed-by: Johan Helsing --- src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp | 6 ++++++ src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h | 2 ++ src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp index 345ff32ad..c6e1afabc 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp @@ -95,9 +95,15 @@ QWaylandXdgToplevelDecorationV1::mode QWaylandXdgToplevelDecorationV1::pending() return m_pending; } +bool QWaylandXdgToplevelDecorationV1::isConfigured() const +{ + return m_configured; +} + void QtWaylandClient::QWaylandXdgToplevelDecorationV1::zxdg_toplevel_decoration_v1_configure(uint32_t mode) { m_pending = zxdg_toplevel_decoration_v1::mode(mode); + m_configured = true; } } diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h index d6d8ce94e..c3a13ce32 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h @@ -80,6 +80,7 @@ public: void requestMode(mode mode); void unsetMode(); mode pending() const; + bool isConfigured() const; protected: void zxdg_toplevel_decoration_v1_configure(uint32_t mode) override; @@ -88,6 +89,7 @@ private: mode m_pending = mode_client_side; mode m_requested = mode_client_side; bool m_modeSet = false; + bool m_configured = false; }; QT_END_NAMESPACE diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 385651bbe..f55298134 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -112,7 +112,8 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() bool QWaylandXdgSurface::Toplevel::wantsDecorations() { - if (m_decoration && m_decoration->pending() == QWaylandXdgToplevelDecorationV1::mode_server_side) + if (m_decoration && (m_decoration->pending() == QWaylandXdgToplevelDecorationV1::mode_server_side + || !m_decoration->isConfigured())) return false; return !(m_pending.states & Qt::WindowFullScreen); -- cgit v1.2.3