effects: Disable blur and contrast effect when screen is locked

The results of the blur and the background contrast effect will never
be seen if the screen locker is active.

In order to avoid wasting computational resources, we could temporarily
disable the blur effect until the screen is unlocked.

Furthermore, given that the blur effect shrinks the clip region, it is
guaranteed that the compositor will have to render the desktop window
behind the lockscreen window. With this change, all windows behind the
screen locker will be properly clipped away.
master
Vlad Zahorodnii 2020-08-31 21:11:06 +03:00
parent 87ff6e4b44
commit ed113171f3
4 changed files with 12 additions and 0 deletions

View File

@ -511,5 +511,10 @@ void ContrastEffect::doContrast(EffectWindow *w, const QRegion& shape, const QRe
shader->unbind();
}
bool ContrastEffect::isActive() const
{
return !effects->isScreenLocked();
}
} // namespace KWin

View File

@ -43,6 +43,7 @@ public:
void paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity) override;
bool provides(Feature feature) override;
bool isActive() const override;
int requestedEffectChainPosition() const override {
return 76;

View File

@ -809,5 +809,10 @@ void BlurEffect::copyScreenSampleTexture(GLVertexBuffer *vbo, int blurRectCount,
m_shader->unbind();
}
bool BlurEffect::isActive() const
{
return !effects->isScreenLocked();
}
} // namespace KWin

View File

@ -46,6 +46,7 @@ public:
void paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity) override;
bool provides(Feature feature) override;
bool isActive() const override;
int requestedEffectChainPosition() const override {
return 75;