[scene] Re-build window quads after creating a WindowPixmap

In order to generate window quads for a window, the scene needs a valid
WindowPixmap tree. If it's time to render the window, the scene will
build window quads for the contents, the server-side window decoration,
the drop-shadow and cache the resulting window quads. With this way of
generating window quads, we need the window pixmap tree to be valid,
or else no contents window quads will be generated.

While the window pixmap tree is guaranteed to be valid at the time of
generation of window quads for Wayland and X11 clients, this is not the
case for Xwayland clients.

When an Xwayland client is created, some time may pass between the
moment it's been created and the moment when a regular wayland surface
has been associated with the xwayland window. If the compositor decides
to render the Xwayland client in that short period of time, the window
quads cache won't have window quads cache.

In order to work around the weird asynchronous behavior of Xwayland
clients, this change makes the scene discard the window quad cache when
a new window pixmap has been created. This will ensure that the current
window quads are always in sync with the current window pixmap tree.
This commit is contained in:
Vlad Zahorodnii 2020-05-19 13:53:18 +03:00
parent bd5e34f5b4
commit 7569bdf6a3

View file

@ -1132,8 +1132,9 @@ void WindowPixmap::create()
if (kwinApp()->shouldUseWaylandForCompositing()) {
// use Buffer
update();
if (!isRoot() && isValid()) {
if (isRoot() && isValid()) {
m_window->unreferencePreviousPixmap();
m_window->invalidateQuadsCache();
}
return;
}
@ -1164,6 +1165,7 @@ void WindowPixmap::create()
m_pixmapSize = bufferGeometry.size();
m_contentsRect = QRect(toplevel()->clientPos(), toplevel()->clientSize());
m_window->unreferencePreviousPixmap();
m_window->invalidateQuadsCache();
}
void WindowPixmap::update()