From dedae9e667ce0551ec432f8471ac26ee0faca84e Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 13 Jan 2023 14:13:11 +0200 Subject: [PATCH] effects/morphingpopups: Fix glitch There's a visual glitch that looks like a random rectangle in the top left corner of morphing popup. It appears like it's caused by the blur effect, it produces wrong results when the window is captured in CrossFadeEffect::redirect(). Make CrossFadeEffect::redirect() unset blur and contrast force roles, so the backdrop effects are not included in the captured frame. --- src/libkwineffects/kwinoffscreeneffect.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libkwineffects/kwinoffscreeneffect.cpp b/src/libkwineffects/kwinoffscreeneffect.cpp index f7257d2ef5..82abea675c 100644 --- a/src/libkwineffects/kwinoffscreeneffect.cpp +++ b/src/libkwineffects/kwinoffscreeneffect.cpp @@ -350,9 +350,20 @@ void CrossFadeEffect::redirect(EffectWindow *window) } offscreenData = std::make_unique(); + // Avoid including blur and contrast effects. During a normal painting cycle they + // won't be included, but since we call effects->drawWindow() outside usual compositing + // cycle, we have to prevent backdrop effects kicking in. + const QVariant blurRole = window->data(WindowForceBlurRole); + window->setData(WindowForceBlurRole, QVariant()); + const QVariant contrastRole = window->data(WindowForceBackgroundContrastRole); + window->setData(WindowForceBackgroundContrastRole, QVariant()); + effects->makeOpenGLContextCurrent(); offscreenData->maybeRender(window); offscreenData->frameGeometryAtCapture = window->frameGeometry(); + + window->setData(WindowForceBlurRole, blurRole); + window->setData(WindowForceBackgroundContrastRole, contrastRole); } void CrossFadeEffect::unredirect(EffectWindow *window)