effects/blur: Properly handle empty blur regions set by internal windows
The task switcher has a valid empty blur region and the blur effect misdetects that, which results in no blurred background. BUG: 433131
This commit is contained in:
parent
34bfc25759
commit
cade5064c3
1 changed files with 9 additions and 6 deletions
|
@ -259,10 +259,10 @@ void BlurEffect::reconfigure(ReconfigureFlags flags)
|
||||||
void BlurEffect::updateBlurRegion(EffectWindow *w) const
|
void BlurEffect::updateBlurRegion(EffectWindow *w) const
|
||||||
{
|
{
|
||||||
QRegion region;
|
QRegion region;
|
||||||
QByteArray value;
|
bool valid = false;
|
||||||
|
|
||||||
if (net_wm_blur_region != XCB_ATOM_NONE) {
|
if (net_wm_blur_region != XCB_ATOM_NONE) {
|
||||||
value = w->readProperty(net_wm_blur_region, XCB_ATOM_CARDINAL, 32);
|
const QByteArray value = w->readProperty(net_wm_blur_region, XCB_ATOM_CARDINAL, 32);
|
||||||
if (value.size() > 0 && !(value.size() % (4 * sizeof(uint32_t)))) {
|
if (value.size() > 0 && !(value.size() % (4 * sizeof(uint32_t)))) {
|
||||||
const uint32_t *cardinals = reinterpret_cast<const uint32_t*>(value.constData());
|
const uint32_t *cardinals = reinterpret_cast<const uint32_t*>(value.constData());
|
||||||
for (unsigned int i = 0; i < value.size() / sizeof(uint32_t);) {
|
for (unsigned int i = 0; i < value.size() / sizeof(uint32_t);) {
|
||||||
|
@ -273,30 +273,33 @@ void BlurEffect::updateBlurRegion(EffectWindow *w) const
|
||||||
region += QRect(x, y, w, h);
|
region += QRect(x, y, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
valid = !value.isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
KWaylandServer::SurfaceInterface *surf = w->surface();
|
KWaylandServer::SurfaceInterface *surf = w->surface();
|
||||||
|
|
||||||
if (surf && surf->blur()) {
|
if (surf && surf->blur()) {
|
||||||
region = surf->blur()->region();
|
region = surf->blur()->region();
|
||||||
|
valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto internal = w->internalWindow()) {
|
if (auto internal = w->internalWindow()) {
|
||||||
const auto property = internal->property("kwin_blur");
|
const auto property = internal->property("kwin_blur");
|
||||||
if (property.isValid()) {
|
if (property.isValid()) {
|
||||||
region = property.value<QRegion>();
|
region = property.value<QRegion>();
|
||||||
|
valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//!value.isNull() full window in X11 case, surf->blur()
|
// If the specified blur region is empty, enable blur for the whole window.
|
||||||
//valid, full window in wayland case
|
if (region.isEmpty() && valid) {
|
||||||
if (region.isEmpty() && (!value.isNull() || (surf && surf->blur()))) {
|
|
||||||
// Set the data to a dummy value.
|
// Set the data to a dummy value.
|
||||||
// This is needed to be able to distinguish between the value not
|
// This is needed to be able to distinguish between the value not
|
||||||
// being set, and being set to an empty region.
|
// being set, and being set to an empty region.
|
||||||
w->setData(WindowBlurBehindRole, 1);
|
w->setData(WindowBlurBehindRole, 1);
|
||||||
} else
|
} else {
|
||||||
w->setData(WindowBlurBehindRole, region);
|
w->setData(WindowBlurBehindRole, region);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlurEffect::slotWindowAdded(EffectWindow *w)
|
void BlurEffect::slotWindowAdded(EffectWindow *w)
|
||||||
|
|
Loading…
Reference in a new issue