diff --git a/effects/blur/blur.h b/effects/blur/blur.h --- a/effects/blur/blur.h +++ b/effects/blur/blur.h @@ -76,6 +76,7 @@ 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: 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) diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -46,14 +46,7 @@ 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 @@ 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)