Decorate only toplevel internal clients

Summary:
Unfortunately Aurorae decoration engine creates several internal clients
per each decoration. One of those clients represents QOffscreenSurface,
which is not a toplevel. Given that no QWindow object will be found for
such clients, m_internalWindowFlags contains undefined value.

Luckily, QOffscreenSurface sets FramelessWindowHint flag, but because
InternalClient is not able to find matching QWindow object, cached
QWindow flags won't have that hint set.

Thus InternalClient will attempt to decorate QOffscreenSurface. A new
Aurorae decoration will be created, which means a new QOffscreenSurface
will be created, which means a new Aurorae decoration will be created,
and so on.

This change restricts subset of internal clients that can be decorated.
Only clients with valid m_internalWindow can be decorated. If m_internalWindow
isn't null, then m_internalWindowFlags is guaranteed to be valid as well.

BUG: 407612
FIXED-IN: 5.16.3

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22136
icc-effect-5.17.5
Vlad Zagorodniy 2019-06-29 01:24:14 +03:00
parent 137b3fbf26
commit 61956025f0
1 changed files with 13 additions and 1 deletions

View File

@ -37,7 +37,19 @@ InternalClient::InternalClient(KWayland::Server::ShellSurfaceInterface *surface)
{
findInternalWindow();
updateInternalWindowGeometry();
updateDecoration(true);
// Qt asks our QPA to create a platform window for each QOffscreenSurface.
// Given that those windows aren't toplevels, findInternalWindow may not be
// able to find corresponding QWindow object for this client, which means
// no-border and pretty much every other property that depends on QWindow
// flags will have undefined value. Unfortunately the Aurorae decoration
// engine creates three internal clients per each decoration. One of those
// clients represents QOffscreenSurface. Thus we have to ensure that the
// QOffscreenSurface client is not decorated, otherwise kwin will fall
// into an infinite "recursion."
if (m_internalWindow) {
updateDecoration(true);
}
}
InternalClient::InternalClient(KWayland::Server::XdgShellSurfaceInterface *surface)