material-decoration icon indicating copy to clipboard operation
material-decoration copied to clipboard

Blur breaks with plasma 5.25

Open nicman23 opened this issue 3 years ago • 7 comments

I run this with kvantum and while windows are properly blurred their decoration isn't

example:

image image

nicman23 avatar Aug 15 '22 15:08 nicman23

Same here. @Zren is there a fix?

tejasraman avatar Aug 28 '22 23:08 tejasraman

@Zren fixed it https://github.com/nicman23/material-decoration/commit/16ac01a107dff0113d74d3a3ae9436a6c97acb59

nicman23 avatar Aug 30 '22 08:08 nicman23

@nicman23 It works fine on my Plasma system with your fork. Thanks!

tejasraman avatar Sep 16 '22 04:09 tejasraman

I found this issue after trying to get blurred decorations not knowing it was a bug, it may not be immediately noticeable because some windows can set explicitly its blur and it forces the decoration to be blurred too, as it happens with konsole or when using the "force blur" kwin script, but even then is glitchy.

I couldn't build @nicman23 fork but I made a patch out of his changes for last commit 4784647e622c37a078cb119626916ac53155bdb9

--- a/src/Decoration.cc	2023-01-12 23:37:53.407256227 -0600
+++ b/src/Decoration.cc	2023-01-12 23:37:16.340695505 -0600
@@ -200,6 +200,7 @@ void Decoration::paint(QPainter *painter, const QRect &repaintRegion)
     if (settings()->borderSize() >= KDecoration2::BorderSize::Normal) {
         paintOutline(painter, repaintRegion);
     }
+    setBlurRegion( QRegion(this->titleBar()) );
 }
 
 void Decoration::init()
@@ -319,7 +320,7 @@ void Decoration::hoverEnterEvent(QHoverEvent *event)
 {
     KDecoration2::Decoration::hoverEnterEvent(event);
     qCDebug(category) << "Decoration::hoverEnterEvent" << event;
-
+    setBlurRegion( QRegion(this->titleBar()) );
     // m_menuButtons->setHovered(true);
 }
 
@@ -345,6 +346,7 @@ void Decoration::hoverMoveEvent(QHoverEvent *event)
     // } else if (wasHovered && contains) {
     //     // HoverMove
     // }
+    setBlurRegion( QRegion(this->titleBar()) );
 }
 
 void Decoration::mouseReleaseEvent(QMouseEvent *event)
@@ -353,6 +355,7 @@ Decoration::mouseReleaseEvent(QMouseEvent *event)
     // qCDebug(category) << "Decoration::mouseReleaseEvent" << event;
 
     resetDragMove();
+    setBlurRegion( QRegion(this->titleBar()) );
 }
 
 void Decoration::hoverLeaveEvent(QHoverEvent *event)
@@ -361,7 +364,7 @@ void Decoration::hoverLeaveEvent(QHoverEvent *event)
     qCDebug(category) << "Decoration::hoverLeaveEvent" << event;
 
     resetDragMove();
-
+    setBlurRegion( QRegion(this->titleBar()) );
     // m_menuButtons->setHovered(false);
 }

@Zren This indeed fixed the blur.

K4in-5037 avatar Jan 15 '23 06:01 K4in-5037

  • https://invent.kde.org/plasma/kdecoration/-/merge_requests/17 (Decoration::setBlurRegion)
  • Aurorae implementation:
    https://invent.kde.org/plasma/kwin/-/merge_requests/196
  • Breeze has no implementation
  • SierraBreezeEnhanced:
    https://github.com/kupiqu/SierraBreezeEnhanced/blob/master/breezedecoration.cpp#L754-L763
  • Klassy:
    https://github.com/paulmcauley/klassy/blob/master/kdecoration/breezedecoration.cpp#L1623-L1635

Hmm, I need to check if the frame left/bottom/right is transparent blurred and make sure that works too. I always use no borders though so I can see it not being tested.

SierraBreezeEnhaced and Klassy uses:

setBlurRegion( QRegion( m_windowPath->toFillPolygon().toPolygon()) ) ;

Zren avatar Jan 15 '23 08:01 Zren

I moved the setBlurRegion() calls to it's own function. I also changed the region to:

void Decoration::updateBlur()
{
#if HAVE_KDecoration2_5_25
    setBlurRegion(QRegion(0, 0, size().width(), size().height()));
#endif
}

Which seem to blur fine. Not sure why the outline is offset though. Need to test on a non busted GPU.

2023-01-15___03-50-13

Zren avatar Jan 15 '23 08:01 Zren

@Zren you were right, I had no borders set and didn't noticed the Left/Right/Bottom borders

Screenshot_20230115_085226

Using setBlurRegion(QRegion(0, 0, size().width(), size().height()));

Screenshot_20230115_085357

Applies blur to all sides.

I've got that weird outline too before and after, this is on an old Intel HD 5500 GPU.

K4in-5037 avatar Jan 15 '23 15:01 K4in-5037