From b11dacc0042b0ba902bcb92c4ce16562ad63aae2 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 30 Jan 2020 22:01:34 +0200 Subject: [PATCH] compute blur area correctly on startup --improve calculations for Effects area during startup and at the same time when the dock is totally hidden so it should not paint any effects area at all. BUG:416928 FIXED-IN:0.9.9 --- app/view/effects.cpp | 29 ++++++++---------- containment/package/contents/ui/PanelBox.qml | 31 ++++++++++++++------ 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/app/view/effects.cpp b/app/view/effects.cpp index 6f598e3ee..5e3ebb64f 100644 --- a/app/view/effects.cpp +++ b/app/view/effects.cpp @@ -294,22 +294,12 @@ QRect Effects::rect() const void Effects::setRect(QRect area) { - if (KWindowSystem::compositingActive()) { - QRect inWindowRect = area.intersected(QRect(0, 0, m_view->width(), m_view->height())); - - if (m_rect == inWindowRect) { - return; - } - - m_rect = inWindowRect; - } else { - if (m_rect == area) { - return; - } - - m_rect = area; + if (m_rect == area) { + return; } + m_rect = area; + emit rectChanged(); } @@ -417,14 +407,19 @@ 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(m_rect.size()); + m_background->resizeFrame(inWindowRect.size()); QRegion fixedMask = m_background->mask(); - fixedMask.translate(m_rect.x(), m_rect.y()); + fixedMask.translate(inWindowRect.x(), inWindowRect.y()); //! fix1, for KF5.32 that return empty QRegion's for the mask if (fixedMask.isEmpty()) { - fixedMask = QRegion(m_rect); + fixedMask = QRegion(inWindowRect); } KWindowEffects::enableBlurBehind(m_view->winId(), true, fixedMask); diff --git a/containment/package/contents/ui/PanelBox.qml b/containment/package/contents/ui/PanelBox.qml index 90a146dfd..24852581b 100644 --- a/containment/package/contents/ui/PanelBox.qml +++ b/containment/package/contents/ui/PanelBox.qml @@ -402,7 +402,7 @@ Item{ //! Fix for FrameSvgItem QML version not updating its margins after a theme change //! with this hack we enforce such update. I could use the repaintNeeded signal but //! it is called more often than the themeChanged one. - Connections{ + Connections { target: themeExtended onThemeChanged: { solidBackground.adjustPrefix(); @@ -412,6 +412,12 @@ Item{ } } + Connections { + target: latteView ? latteView.visibility : null + onIsHiddenChanged: solidBackground.updateEffectsArea(); + } + + Connections{ target: plasmoid onLocationChanged: solidBackground.adjustPrefix(); @@ -421,17 +427,24 @@ Item{ if (!latteView) return; - if (!root.behaveAsPlasmaPanel) { - var rootGeometry = mapToItem(root, 0, 0); - efGeometry.x = rootGeometry.x; - efGeometry.y = rootGeometry.y; - } else { + if (latteView.visibility.isHidden) { efGeometry.x = 0; efGeometry.y = 0; - } + efGeometry.width = 0; + efGeometry.height = 0; + } else { + if (!root.behaveAsPlasmaPanel) { + var rootGeometry = mapToItem(root, 0, 0); + efGeometry.x = rootGeometry.x; + efGeometry.y = rootGeometry.y; + } else { + efGeometry.x = 0; + efGeometry.y = 0; + } - efGeometry.width = width; - efGeometry.height = height; + efGeometry.width = width; + efGeometry.height = height; + } latteView.effects.rect = efGeometry;