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.
This commit is contained in:
parent
ec04284518
commit
4bc74d6831
2 changed files with 2 additions and 18 deletions
|
@ -252,30 +252,15 @@ SurfaceItemXwayland::SurfaceItemXwayland(X11Window *window, Item *parent)
|
||||||
: SurfaceItemWayland(window->surface(), parent)
|
: SurfaceItemWayland(window->surface(), parent)
|
||||||
, m_window(window)
|
, m_window(window)
|
||||||
{
|
{
|
||||||
connect(window, &X11Window::shapeChanged, this, &SurfaceItemXwayland::discardQuads);
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QRectF> SurfaceItemXwayland::shape() const
|
|
||||||
{
|
|
||||||
QList<QRectF> shape = m_window->shapeRegion();
|
|
||||||
for (QRectF &shapePart : shape) {
|
|
||||||
shapePart = shapePart.intersected(rect());
|
|
||||||
}
|
|
||||||
return shape;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QRegion SurfaceItemXwayland::opaque() const
|
QRegion SurfaceItemXwayland::opaque() const
|
||||||
{
|
{
|
||||||
QRegion shapeRegion;
|
|
||||||
for (const QRectF &shapePart : shape()) {
|
|
||||||
shapeRegion += shapePart.toRect();
|
|
||||||
}
|
|
||||||
if (!m_window->hasAlpha()) {
|
if (!m_window->hasAlpha()) {
|
||||||
return shapeRegion;
|
return rect().toRect();
|
||||||
} else {
|
} else {
|
||||||
return m_window->opaqueRegion() & shapeRegion;
|
return m_window->opaqueRegion() & rect().toRect();
|
||||||
}
|
}
|
||||||
return QRegion();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
|
@ -95,7 +95,6 @@ public:
|
||||||
explicit SurfaceItemXwayland(X11Window *window, Item *parent = nullptr);
|
explicit SurfaceItemXwayland(X11Window *window, Item *parent = nullptr);
|
||||||
|
|
||||||
QRegion opaque() const override;
|
QRegion opaque() const override;
|
||||||
QList<QRectF> shape() const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
X11Window *m_window;
|
X11Window *m_window;
|
||||||
|
|
Loading…
Reference in a new issue