Expose transientFor and only blur underneath when transientParent is dock

This commit is contained in:
Niccolò Venerandi 2020-08-02 10:25:28 +00:00
parent d4cd2b5a6a
commit e41c5af676
5 changed files with 27 additions and 1 deletions

View file

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

View file

@ -1984,6 +1984,21 @@ EffectWindow* EffectWindowImpl::findModal()
return nullptr;
}
EffectWindow* EffectWindowImpl::transientFor()
{
auto client = qobject_cast<AbstractClient *>(toplevel);
if (!client) {
return nullptr;
}
AbstractClient *transientFor = client->transientFor();
if (transientFor) {
return transientFor->effectWindow();
}
return nullptr;
}
QWindow *EffectWindowImpl::internalWindow() const
{
auto client = qobject_cast<InternalClient *>(toplevel);

View file

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

View file

@ -604,9 +604,12 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, const QRegion &region, 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());
}
}

View file

@ -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<KWin::EffectWindow*> mainWindows() const = 0;
/**