Add option to make active window's shadow stronger (on by default).
svn path=/trunk/KDE/kdebase/workspace/; revision=718304
This commit is contained in:
parent
3c195c505d
commit
0e1cb2a603
4 changed files with 29 additions and 12 deletions
|
@ -28,6 +28,7 @@ ShadowEffect::ShadowEffect()
|
|||
shadowOpacity = conf.readEntry( "Opacity", 0.2 );
|
||||
shadowFuzzyness = conf.readEntry( "Fuzzyness", 10 );
|
||||
shadowSize = conf.readEntry( "Size", 5 );
|
||||
intensifyActiveShadow = conf.readEntry( "IntensifyActiveShadow", true );
|
||||
|
||||
QString shadowtexture = KGlobal::dirs()->findResource("data", "kwin/shadow-texture.png");
|
||||
mShadowTexture = new GLTexture(shadowtexture);
|
||||
|
@ -127,7 +128,12 @@ void ShadowEffect::drawShadow( EffectWindow* window, int mask, QRegion region, W
|
|||
mShadowTexture->bind();
|
||||
// Take the transparency settings and window's transparency into account.
|
||||
// Also make the shadow more transparent if we've made it bigger
|
||||
glColor4f(0, 0, 0, shadowOpacity * data.opacity * (window->width() / (double)w) * (window->height() / (double)h));
|
||||
float opacity = shadowOpacity;
|
||||
if( intensifyActiveShadow && window == effects->activeWindow() )
|
||||
{
|
||||
opacity = 1 - (1 - shadowOpacity)*(1 - shadowOpacity);
|
||||
}
|
||||
glColor4f(0, 0, 0, opacity * data.opacity * (window->width() / (double)w) * (window->height() / (double)h));
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
// We have two elements per vertex in the verts array
|
||||
int verticesCount = verts.count() / 2;
|
||||
|
|
|
@ -38,6 +38,7 @@ class ShadowEffect
|
|||
double shadowOpacity;
|
||||
int shadowFuzzyness;
|
||||
int shadowSize;
|
||||
bool intensifyActiveShadow;
|
||||
GLTexture* mShadowTexture;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
|
||||
KWIN_EFFECT_CONFIG_FACTORY
|
||||
|
||||
|
@ -32,38 +33,42 @@ ShadowEffectConfig::ShadowEffectConfig(QWidget* parent, const QVariantList& args
|
|||
|
||||
QGridLayout* layout = new QGridLayout(this);
|
||||
|
||||
layout->addWidget(new QLabel(i18n("X offset:")), 0, 0);
|
||||
mShadowXOffset = new QSpinBox;
|
||||
layout->addWidget(new QLabel(i18n("X offset:"), this), 0, 0);
|
||||
mShadowXOffset = new QSpinBox(this);
|
||||
mShadowXOffset->setRange(-20, 20);
|
||||
connect(mShadowXOffset, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
layout->addWidget(mShadowXOffset, 0, 1);
|
||||
|
||||
layout->addWidget(new QLabel(i18n("Y offset:")), 1, 0);
|
||||
mShadowYOffset = new QSpinBox;
|
||||
layout->addWidget(new QLabel(i18n("Y offset:"), this), 1, 0);
|
||||
mShadowYOffset = new QSpinBox(this);
|
||||
mShadowYOffset->setRange(-20, 20);
|
||||
connect(mShadowYOffset, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
layout->addWidget(mShadowYOffset, 1, 1);
|
||||
|
||||
layout->addWidget(new QLabel(i18n("Shadow opacity:")), 2, 0);
|
||||
mShadowOpacity = new QSpinBox;
|
||||
layout->addWidget(new QLabel(i18n("Shadow opacity:"), this), 2, 0);
|
||||
mShadowOpacity = new QSpinBox(this);
|
||||
mShadowOpacity->setRange(0, 100);
|
||||
mShadowOpacity->setSuffix("%");
|
||||
connect(mShadowOpacity, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
layout->addWidget(mShadowOpacity, 2, 1);
|
||||
|
||||
layout->addWidget(new QLabel(i18n("Shadow fuzzyness:")), 3, 0);
|
||||
mShadowFuzzyness = new QSpinBox;
|
||||
layout->addWidget(new QLabel(i18n("Shadow fuzzyness:"), this), 3, 0);
|
||||
mShadowFuzzyness = new QSpinBox(this);
|
||||
mShadowFuzzyness->setRange(0, 20);
|
||||
connect(mShadowFuzzyness, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
layout->addWidget(mShadowFuzzyness, 3, 1);
|
||||
|
||||
layout->addWidget(new QLabel(i18n("Shadow size (relative to window):")), 4, 0);
|
||||
mShadowSize = new QSpinBox;
|
||||
layout->addWidget(new QLabel(i18n("Shadow size (relative to window):"), this), 4, 0);
|
||||
mShadowSize = new QSpinBox(this);
|
||||
mShadowSize->setRange(0, 20);
|
||||
connect(mShadowSize, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
layout->addWidget(mShadowSize, 4, 1);
|
||||
|
||||
layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 5, 0, 1, 2);
|
||||
mIntensifyActiveShadow = new QCheckBox(i18n("Active window has stronger shadow"), this);
|
||||
connect(mIntensifyActiveShadow, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
layout->addWidget(mIntensifyActiveShadow, 5, 0, 1, 2);
|
||||
|
||||
layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 6, 0, 1, 2);
|
||||
|
||||
load();
|
||||
}
|
||||
|
@ -84,6 +89,7 @@ void ShadowEffectConfig::load()
|
|||
mShadowOpacity->setValue( (int)( conf.readEntry( "Opacity", 0.2 ) * 100 ) );
|
||||
mShadowFuzzyness->setValue( conf.readEntry( "Fuzzyness", 10 ) );
|
||||
mShadowSize->setValue( conf.readEntry( "Size", 5 ) );
|
||||
mIntensifyActiveShadow->setChecked( conf.readEntry( "IntensifyActiveShadow", true ) );
|
||||
|
||||
emit changed(false);
|
||||
}
|
||||
|
@ -99,6 +105,7 @@ void ShadowEffectConfig::save()
|
|||
conf.writeEntry( "Opacity", mShadowOpacity->value() / 100.0 );
|
||||
conf.writeEntry( "Fuzzyness", mShadowFuzzyness->value() );
|
||||
conf.writeEntry( "Size", mShadowSize->value() );
|
||||
conf.writeEntry( "IntensifyActiveShadow", mIntensifyActiveShadow->isChecked() );
|
||||
conf.sync();
|
||||
|
||||
emit changed(false);
|
||||
|
@ -113,6 +120,7 @@ void ShadowEffectConfig::defaults()
|
|||
mShadowOpacity->setValue( 20 );
|
||||
mShadowFuzzyness->setValue( 10 );
|
||||
mShadowSize->setValue( 5 );
|
||||
mIntensifyActiveShadow->setChecked( true );
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
#undef KDE3_SUPPORT
|
||||
|
||||
class QSpinBox;
|
||||
class QCheckBox;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -37,6 +38,7 @@ class ShadowEffectConfig : public KCModule
|
|||
QSpinBox* mShadowOpacity;
|
||||
QSpinBox* mShadowFuzzyness;
|
||||
QSpinBox* mShadowSize;
|
||||
QCheckBox* mIntensifyActiveShadow;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in a new issue