From e41c5af6766614e8cac41fd952220f8b46692d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Venerandi?= Date: Sun, 2 Aug 2020 10:25:28 +0000 Subject: [PATCH] Expose transientFor and only blur underneath when transientParent is dock --- autotests/test_window_paint_data.cpp | 6 ++++++ effects.cpp | 15 +++++++++++++++ effects.h | 1 + effects/blur/blur.cpp | 5 ++++- libkwineffects/kwineffects.h | 1 + 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/autotests/test_window_paint_data.cpp b/autotests/test_window_paint_data.cpp index 00f5811727..c7653638c1 100644 --- a/autotests/test_window_paint_data.cpp +++ b/autotests/test_window_paint_data.cpp @@ -46,6 +46,7 @@ public: void addLayerRepaint(const QRect &r) override; void addLayerRepaint(int x, int y, int w, int h) override; EffectWindow *findModal() override; + EffectWindow *transientFor() override; const EffectWindowGroup *group() const override; bool isPaintingEnabled() override; EffectWindowList mainWindows() const override; @@ -340,6 +341,11 @@ EffectWindow *MockEffectWindow::findModal() return nullptr; } +EffectWindow *MockEffectWindow::transientFor() +{ + return nullptr; +} + const EffectWindowGroup *MockEffectWindow::group() const { return nullptr; diff --git a/effects.cpp b/effects.cpp index 79cb667a0b..eafd127c3f 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1984,6 +1984,21 @@ EffectWindow* EffectWindowImpl::findModal() return nullptr; } +EffectWindow* EffectWindowImpl::transientFor() +{ + auto client = qobject_cast(toplevel); + if (!client) { + return nullptr; + } + + AbstractClient *transientFor = client->transientFor(); + if (transientFor) { + return transientFor->effectWindow(); + } + + return nullptr; +} + QWindow *EffectWindowImpl::internalWindow() const { auto client = qobject_cast(toplevel); diff --git a/effects.h b/effects.h index 9e3f9f8cab..dda7f64378 100644 --- a/effects.h +++ b/effects.h @@ -471,6 +471,7 @@ public: void deleteProperty(long atom) const override; EffectWindow* findModal() override; + EffectWindow* transientFor() override; EffectWindowList mainWindows() const override; WindowQuadList buildQuads(bool force = false) const override; diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index f4e4061090..403e27e7e9 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -604,9 +604,12 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, const QRegion ®ion, Wi shape = shape.translated(data.xTranslation(), data.yTranslation()); shape = shape & region; } + + EffectWindow* modal = w->transientFor(); + const bool transientForIsDock = (modal ? modal->isDock() : false); if (!shape.isEmpty()) { - doBlur(shape, screen, data.opacity(), data.screenProjectionMatrix(), w->isDock(), w->geometry()); + doBlur(shape, screen, data.opacity(), data.screenProjectionMatrix(), w->isDock() || transientForIsDock, w->geometry()); } } diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 3d73419915..d1b4d67c85 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -2373,6 +2373,7 @@ public: virtual bool isModal() const = 0; Q_SCRIPTABLE virtual KWin::EffectWindow* findModal() = 0; + Q_SCRIPTABLE virtual KWin::EffectWindow* transientFor() = 0; Q_SCRIPTABLE virtual QList mainWindows() const = 0; /**