From 4bc74d6831253b545a65bf74d2714af3603f17cf Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 13 Aug 2024 22:26:43 +0300 Subject: [PATCH] scene: Ignore xwayland window shape The shape region is used to clip the window contents. But, in practice, it's used by a few applications. The most notable is xeyes. The APIs that the shape region requires are manageable, but it would be much preferred if we had a much simpler design. In terms of the shape region support on Wayland, it's not widely supported across all wayland compositors, to my knowledge, only two support it, some compositors even want to disable XSHAPE extension at all. This change makes the Xwayland windows ignore the shape region to see if any real world applications are affected by it. If not, then we could safely simplify the scene bits later. The Xorg session is unaffected by this change. --- src/scene/surfaceitem_wayland.cpp | 19 ++----------------- src/scene/surfaceitem_wayland.h | 1 - 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/scene/surfaceitem_wayland.cpp b/src/scene/surfaceitem_wayland.cpp index 4a307565c0..a4d012f774 100644 --- a/src/scene/surfaceitem_wayland.cpp +++ b/src/scene/surfaceitem_wayland.cpp @@ -252,30 +252,15 @@ SurfaceItemXwayland::SurfaceItemXwayland(X11Window *window, Item *parent) : SurfaceItemWayland(window->surface(), parent) , m_window(window) { - connect(window, &X11Window::shapeChanged, this, &SurfaceItemXwayland::discardQuads); -} - -QList SurfaceItemXwayland::shape() const -{ - QList shape = m_window->shapeRegion(); - for (QRectF &shapePart : shape) { - shapePart = shapePart.intersected(rect()); - } - return shape; } QRegion SurfaceItemXwayland::opaque() const { - QRegion shapeRegion; - for (const QRectF &shapePart : shape()) { - shapeRegion += shapePart.toRect(); - } if (!m_window->hasAlpha()) { - return shapeRegion; + return rect().toRect(); } else { - return m_window->opaqueRegion() & shapeRegion; + return m_window->opaqueRegion() & rect().toRect(); } - return QRegion(); } #endif } // namespace KWin diff --git a/src/scene/surfaceitem_wayland.h b/src/scene/surfaceitem_wayland.h index f769284172..991cd168c3 100644 --- a/src/scene/surfaceitem_wayland.h +++ b/src/scene/surfaceitem_wayland.h @@ -95,7 +95,6 @@ public: explicit SurfaceItemXwayland(X11Window *window, Item *parent = nullptr); QRegion opaque() const override; - QList shape() const override; private: X11Window *m_window;