diff --git a/effects/backgroundcontrast/contrast.cpp b/effects/backgroundcontrast/contrast.cpp index a56b5f759c..3ef1cf1e0d 100644 --- a/effects/backgroundcontrast/contrast.cpp +++ b/effects/backgroundcontrast/contrast.cpp @@ -67,8 +67,9 @@ ContrastEffect::ContrastEffect() ); // Fetch the contrast regions for all windows - foreach (EffectWindow *window, effects->stackingOrder()) + for (EffectWindow *window: effects->stackingOrder()) { updateContrastRegion(window); + } } ContrastEffect::~ContrastEffect() @@ -78,7 +79,14 @@ ContrastEffect::~ContrastEffect() void ContrastEffect::slotScreenGeometryChanged() { - effects->reloadEffect(this); + effects->makeOpenGLContextCurrent(); + if (!supported()) { + effects->reloadEffect(this); + return; + } + for (EffectWindow *window: effects->stackingOrder()) { + updateContrastRegion(window); + } } void ContrastEffect::reconfigure(ReconfigureFlags flags) diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index 5f031d4a4f..b4a4d0139a 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -46,14 +46,7 @@ BlurEffect::BlurEffect() qCDebug(KWINEFFECTS) << "Simple blur shader failed to load"; } - // Offscreen texture that's used as the target for the horizontal blur pass - // and the source for the vertical pass. - tex = GLTexture(GL_RGBA8, effects->virtualScreenSize()); - tex.setFilter(GL_LINEAR); - tex.setWrapMode(GL_CLAMP_TO_EDGE); - - target = new GLRenderTarget(tex); - + updateTexture(); reconfigure(ReconfigureAll); // ### Hackish way to announce support. @@ -97,7 +90,23 @@ BlurEffect::~BlurEffect() void BlurEffect::slotScreenGeometryChanged() { - effects->reloadEffect(this); + effects->makeOpenGLContextCurrent(); + updateTexture(); + // Fetch the blur regions for all windows + foreach (EffectWindow *window, effects->stackingOrder()) + updateBlurRegion(window); + effects->doneOpenGLContextCurrent(); +} + +void BlurEffect::updateTexture() { + delete target; + // Offscreen texture that's used as the target for the horizontal blur pass + // and the source for the vertical pass. + tex = GLTexture(GL_RGBA8, effects->virtualScreenSize()); + tex.setFilter(GL_LINEAR); + tex.setWrapMode(GL_CLAMP_TO_EDGE); + + target = new GLRenderTarget(tex); } void BlurEffect::reconfigure(ReconfigureFlags flags) diff --git a/effects/blur/blur.h b/effects/blur/blur.h index e6f44946db..85a7b4ae61 100644 --- a/effects/blur/blur.h +++ b/effects/blur/blur.h @@ -76,6 +76,7 @@ public Q_SLOTS: void slotScreenGeometryChanged(); private: + void updateTexture(); QRect expand(const QRect &rect) const; QRegion expand(const QRegion ®ion) const; QRegion blurRegion(const EffectWindow *w) const; @@ -90,7 +91,7 @@ private: private: BlurShader *shader; GLShader *m_simpleShader; - GLRenderTarget *target; + GLRenderTarget *target = nullptr; GLTexture tex; long net_wm_blur_region; QRegion m_damagedArea; // keeps track of the area which has been damaged (from bottom to top)