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 <johan.helsing@qt.io>
This commit is contained in:
David Edmundson 2019-05-22 23:49:20 +01:00
parent 3eb4e7ca76
commit c2e19ca64e
3 changed files with 10 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -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);