Make the strength of the blur effect configurable.
svn path=/trunk/KDE/kdebase/workspace/; revision=1102771
This commit is contained in:
parent
66d770d821
commit
087f1a6fef
4 changed files with 32 additions and 8 deletions
|
@ -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 )
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#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 )
|
||||
|
|
Loading…
Reference in a new issue