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