Commit ed113171 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

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.
parent 87ff6e4b
...@@ -511,5 +511,10 @@ void ContrastEffect::doContrast(EffectWindow *w, const QRegion& shape, const QRe ...@@ -511,5 +511,10 @@ void ContrastEffect::doContrast(EffectWindow *w, const QRegion& shape, const QRe
shader->unbind(); shader->unbind();
} }
bool ContrastEffect::isActive() const
{
return !effects->isScreenLocked();
}
} // namespace KWin } // namespace KWin
...@@ -43,6 +43,7 @@ public: ...@@ -43,6 +43,7 @@ public:
void paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity) override; void paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity) override;
bool provides(Feature feature) override; bool provides(Feature feature) override;
bool isActive() const override;
int requestedEffectChainPosition() const override { int requestedEffectChainPosition() const override {
return 76; return 76;
......
...@@ -809,5 +809,10 @@ void BlurEffect::copyScreenSampleTexture(GLVertexBuffer *vbo, int blurRectCount, ...@@ -809,5 +809,10 @@ void BlurEffect::copyScreenSampleTexture(GLVertexBuffer *vbo, int blurRectCount,
m_shader->unbind(); m_shader->unbind();
} }
bool BlurEffect::isActive() const
{
return !effects->isScreenLocked();
}
} // namespace KWin } // namespace KWin
...@@ -46,6 +46,7 @@ public: ...@@ -46,6 +46,7 @@ public:
void paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity) override; void paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity) override;
bool provides(Feature feature) override; bool provides(Feature feature) override;
bool isActive() const override;
int requestedEffectChainPosition() const override { int requestedEffectChainPosition() const override {
return 75; return 75;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment