From 4ff45510b2fc86b68dc237b070816392e62835ad Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 8 Feb 2020 10:52:45 +0200 Subject: [PATCH] fix blur regions calculations --do not send faulty blurred regions to KWin BUG:417254 FIXED-IN:0.9.9 --- app/view/effects.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/app/view/effects.cpp b/app/view/effects.cpp index 5e3ebb64f..ec677c07a 100644 --- a/app/view/effects.cpp +++ b/app/view/effects.cpp @@ -395,6 +395,8 @@ void Effects::updateEffects() return; } + bool clearEffects{true}; + if (m_drawEffects && !m_rect.isNull() && !m_rect.isEmpty()) { //! this is used when compositing is disabled and provides //! the correct way for the mask to be painted in order for @@ -407,29 +409,24 @@ void Effects::updateEffects() m_background->setImagePath(QStringLiteral("widgets/panel-background")); } - QRect inWindowRect = m_rect; - if (KWindowSystem::compositingActive()) { - inWindowRect = m_rect.intersected(QRect(0, 0, m_view->width(), m_view->height())); - } - m_background->setEnabledBorders(m_enabledBorders); - m_background->resizeFrame(inWindowRect.size()); + m_background->resizeFrame(m_rect.size()); QRegion fixedMask = m_background->mask(); - fixedMask.translate(inWindowRect.x(), inWindowRect.y()); - - //! fix1, for KF5.32 that return empty QRegion's for the mask - if (fixedMask.isEmpty()) { - fixedMask = QRegion(inWindowRect); + fixedMask.translate(m_rect.x(), m_rect.y()); + + if (!fixedMask.isEmpty()) { + clearEffects = false; + KWindowEffects::enableBlurBehind(m_view->winId(), true, fixedMask); + KWindowEffects::enableBackgroundContrast(m_view->winId(), + m_theme.backgroundContrastEnabled(), + m_backEffectContrast, + m_backEffectIntesity, + m_backEffectSaturation, + fixedMask); } + } - KWindowEffects::enableBlurBehind(m_view->winId(), true, fixedMask); - KWindowEffects::enableBackgroundContrast(m_view->winId(), - m_theme.backgroundContrastEnabled(), - m_backEffectContrast, - m_backEffectIntesity, - m_backEffectSaturation, - fixedMask); - } else { + if (clearEffects) { KWindowEffects::enableBlurBehind(m_view->winId(), false); KWindowEffects::enableBackgroundContrast(m_view->winId(), false); }