From b344afd8cd6b0f47f90c5bbf4ee87a6ba5620775 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 19 Jul 2021 09:28:50 +0300 Subject: [PATCH] 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. --- src/surfaceitem_wayland.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/surfaceitem_wayland.cpp b/src/surfaceitem_wayland.cpp index fe6a29cd28..53c89ae488 100644 --- a/src/surfaceitem_wayland.cpp +++ b/src/surfaceitem_wayland.cpp @@ -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;