effects/blur: Ignore xshape region

EffectWindow::shape() doesn't fit the item based design. This change
ports the blur effect away from the shape() function to the rect()
function. The XShape extension was introduced when windows with an alpha
channel wasn't really a thing. Setting a shape served as a way to clip a
window, the most notable example is xeyes.

If an application relies on the xshape extension to actually clip the
window and not to force the window manager not to put the server-side
deco, it most likely doesn't support translucency and therefore it
shouldn't set the blur region to begin with.

This change makes the blur effect ignore the xshape region similar to
the background contrast effect. It allows us to decouple a bit more
effects from the rest of rendering machinery and thus make it easier for
us to move forward with the scene redesign goal.
This commit is contained in:
Vlad Zahorodnii 2021-05-18 15:30:31 +03:00
parent c1aa1c6c09
commit de3b7a96db

View file

@ -404,21 +404,19 @@ QRegion BlurEffect::blurRegion(const EffectWindow *w) const
const QRegion appRegion = qvariant_cast<QRegion>(value);
if (!appRegion.isEmpty()) {
if (w->decorationHasAlpha() && effects->decorationSupportsBlurBehind()) {
region = w->shape() & w->rect();
region -= w->decorationInnerRect();
region = QRegion(w->rect()) - w->decorationInnerRect();
}
region |= appRegion.translated(w->contentsRect().topLeft()) &
w->decorationInnerRect();
} else {
// An empty region means that the blur effect should be enabled
// for the whole window.
region = w->shape() & w->rect();
region = w->rect();
}
} else if (w->decorationHasAlpha() && effects->decorationSupportsBlurBehind()) {
// If the client hasn't specified a blur region, we'll only enable
// the effect behind the decoration.
region = w->shape() & w->rect();
region -= w->decorationInnerRect();
region = QRegion(w->rect()) - w->decorationInnerRect();
}
return region;