wayland: Fix glitchy steam during interactive resize

Xwayland windows have two geometry types that are used during rendering
- wl_surface's geometry and x11 window's geometry. Unfortunately, it's
not possible just ignore the x11 window geometry because the window may
have a custom shape region. Pixels outside the shape region can have
arbitrary values; it's not guaranteed that the area outside the shape
region will be transparent.

In some cases, the x11 window geometry can be larger than the wl_surface
rect. That breaks repaint logic as the SurfaceItemXwayland can draw
outside the bounding rect.

Specifically, this issue can be seen while resizing Steam interactively.
Another example is where a video game enters fullscreen mode. I
occasionally see that Red Dead Redemption II window leaves a ghost after
itself when it switches to fullscreen mode.

It's not a perfect solution, but on the other hand, it doesn't look like
there's a better way to handle this due to the fact that there are two
conflicting geometry sources.
This commit is contained in:
Vlad Zahorodnii 2021-07-19 09:28:50 +03:00
parent f14350e1bb
commit b344afd8cd

View file

@ -205,7 +205,7 @@ SurfaceItemXwayland::SurfaceItemXwayland(Scene::Window *window, Item *parent)
QRegion SurfaceItemXwayland::shape() const
{
const Toplevel *toplevel = window()->window();
const QRect clipRect = toplevel->clientGeometry().translated(-toplevel->bufferGeometry().topLeft());
const QRect clipRect = rect() & toplevel->clientGeometry().translated(-toplevel->bufferGeometry().topLeft());
const QRegion shape = toplevel->shapeRegion();
return shape & clipRect;