diff --git a/effects/blur/CMakeLists.txt b/effects/blur/CMakeLists.txt index c0cf73bfe1..698b25426b 100644 --- a/effects/blur/CMakeLists.txt +++ b/effects/blur/CMakeLists.txt @@ -3,12 +3,24 @@ # Source files set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} - blur/blur.cpp - blur/blurshader.cpp - ) + blur/blur.cpp + blur/blurshader.cpp ) # .desktop files install( FILES - blur/blur.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) + blur/blur.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) + +####################################### +# Config + +# Source files +set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources} + blur/blur_config.cpp + blur/blur_config.ui ) + +# .desktop files +install( FILES + blur/blur_config.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index cfc1778c2c..914c649602 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -36,10 +36,8 @@ KWIN_EFFECT_SUPPORTED(blur, BlurEffect::supported()) BlurEffect::BlurEffect() - : radius(12) { shader = BlurShader::create(); - shader->setRadius(radius); // Offscreen texture that's used as the target for the horizontal blur pass // and the source for the vertical pass. @@ -56,6 +54,8 @@ BlurEffect::BlurEffect() // Should be included in _NET_SUPPORTED instead. XChangeProperty(display(), rootWindow(), net_wm_blur_region, net_wm_blur_region, 32, PropModeReplace, 0, 0); + + reconfigure(ReconfigureAll); } BlurEffect::~BlurEffect() @@ -68,6 +68,15 @@ BlurEffect::~BlurEffect() delete tex; } +void BlurEffect::reconfigure(ReconfigureFlags flags) +{ + Q_UNUSED(flags) + + KConfigGroup cg = EffectsHandler::effectConfig("Blur"); + int radius = qBound(2, cg.readEntry("BlurRadius", 12), 14); + shader->setRadius(radius); +} + void BlurEffect::updateBlurRegion(EffectWindow *w) const { QRegion region; @@ -113,6 +122,7 @@ bool BlurEffect::supported() QRect BlurEffect::expand(const QRect &rect) const { + const int radius = shader->radius(); return rect.adjusted(-radius, -radius, radius, radius); } diff --git a/effects/blur/blur.h b/effects/blur/blur.h index 32b25fa397..a9e71d3647 100644 --- a/effects/blur/blur.h +++ b/effects/blur/blur.h @@ -39,6 +39,7 @@ public: static bool supported(); + void reconfigure(ReconfigureFlags flags); void windowAdded(EffectWindow *w); void propertyNotify(EffectWindow *w, long atom); void paintScreen(int mask, QRegion region, ScreenPaintData &data); @@ -57,7 +58,6 @@ private: GLRenderTarget *target; GLTexture *tex; long net_wm_blur_region; - int radius; }; } // namespace KWin diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index ee57035e17..15e16d8bbc 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -34,6 +34,7 @@ along with this program. If not, see . #include "zoom/zoom_config.h" #ifdef KWIN_HAVE_OPENGL_COMPOSITING +#include "blur/blur_config.h" #include "coverswitch/coverswitch_config.h" #include "cube/cube_config.h" #include "cube/cubeslide_config.h" @@ -68,6 +69,7 @@ KWIN_EFFECT_CONFIG_MULTIPLE( builtins, KWIN_EFFECT_CONFIG_SINGLE( zoom, ZoomEffectConfig ) #ifdef KWIN_HAVE_OPENGL_COMPOSITING + KWIN_EFFECT_CONFIG_SINGLE( blur, BlurEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( coverswitch, CoverSwitchEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( cube, CubeEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( cubeslide, CubeSlideEffectConfig )