Zren / material-decoration

Material-ish window decoration theme for KWin, with LIM, based on zzag's original design.
GNU General Public License v2.0
200 stars 17 forks source link

Blur breaks with plasma 5.25 #64

Open nicman23 opened 2 years ago

nicman23 commented 2 years ago

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

example:

image image

tejasraman commented 2 years ago

Same here. @Zren is there a fix?

nicman23 commented 2 years ago

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

tejasraman commented 2 years ago

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

K4in-5037 commented 1 year ago

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.

Zren commented 1 year ago

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 commented 1 year ago

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

K4in-5037 commented 1 year ago

@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.