diff --git a/effects/data/shadow-texture.png b/effects/data/shadow-texture.png
index 17f92b94dd..e6a9145d78 100644
Binary files a/effects/data/shadow-texture.png and b/effects/data/shadow-texture.png differ
diff --git a/effects/shadow.cpp b/effects/shadow.cpp
index dbac01d9c0..0e6ce06a8d 100644
--- a/effects/shadow.cpp
+++ b/effects/shadow.cpp
@@ -25,6 +25,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
namespace KWin
{
@@ -39,6 +40,7 @@ ShadowEffect::ShadowEffect()
shadowOpacity = conf.readEntry( "Opacity", 0.25 );
shadowFuzzyness = conf.readEntry( "Fuzzyness", 10 );
shadowSize = conf.readEntry( "Size", 5 );
+ shadowColor = conf.readEntry( "Color", KColorScheme::shade( Qt::white, KColorScheme::ShadowShade ) );
intensifyActiveShadow = conf.readEntry( "IntensifyActiveShadow", true );
QString shadowtexture = KGlobal::dirs()->findResource("data", "kwin/shadow-texture.png");
@@ -215,7 +217,7 @@ void ShadowEffect::drawShadow( EffectWindow* window, int mask, QRegion region, W
{
opacity = 1 - (1 - shadowOpacity)*(1 - shadowOpacity);
}
- glColor4f(0, 0, 0, opacity * data.opacity * (window->width() / (double)w) * (window->height() / (double)h));
+ glColor4f(shadowColor.redF(), shadowColor.greenF(), shadowColor.blueF(), 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;
diff --git a/effects/shadow.h b/effects/shadow.h
index 24e1b0ef9f..b34669ae29 100644
--- a/effects/shadow.h
+++ b/effects/shadow.h
@@ -52,6 +52,7 @@ class ShadowEffect
int shadowFuzzyness;
int shadowSize;
bool intensifyActiveShadow;
+ QColor shadowColor;
GLTexture* mShadowTexture;
struct ShadowData
diff --git a/effects/shadow_config.cpp b/effects/shadow_config.cpp
index 96c598abee..dd09b2c8fd 100644
--- a/effects/shadow_config.cpp
+++ b/effects/shadow_config.cpp
@@ -25,6 +25,8 @@ along with this program. If not, see .
#include
#include
#include
+#include
+#include
#include
#include
@@ -36,6 +38,12 @@ along with this program. If not, see .
KWIN_EFFECT_CONFIG_FACTORY
#endif
+// Save some typing
+static QColor schemeShadowColor()
+{
+ return KColorScheme::shade(Qt::white, KColorScheme::ShadowShade);
+}
+
namespace KWin
{
@@ -77,9 +85,15 @@ ShadowEffectConfig::ShadowEffectConfig(QWidget* parent, const QVariantList& args
connect(mShadowSize, SIGNAL(valueChanged(int)), this, SLOT(changed()));
layout->addWidget(mShadowSize, 4, 1);
+ layout->addWidget(new QLabel(i18n("Shadow color:"), this), 5, 0);
+ mShadowColor = new KColorButton(this);
+ mShadowColor->setDefaultColor(schemeShadowColor());
+ connect(mShadowColor, SIGNAL(changed(QColor)), this, SLOT(changed()));
+ layout->addWidget(mShadowColor, 5, 1);
+
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->addWidget(mIntensifyActiveShadow, 6, 0, 1, 2);
layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 6, 0, 1, 2);
@@ -102,6 +116,7 @@ void ShadowEffectConfig::load()
mShadowOpacity->setValue( (int)( conf.readEntry( "Opacity", 0.25 ) * 100 ) );
mShadowFuzzyness->setValue( conf.readEntry( "Fuzzyness", 10 ) );
mShadowSize->setValue( conf.readEntry( "Size", 5 ) );
+ mShadowColor->setColor( conf.readEntry( "Color", schemeShadowColor() ) );
mIntensifyActiveShadow->setChecked( conf.readEntry( "IntensifyActiveShadow", true ) );
emit changed(false);
@@ -118,6 +133,14 @@ void ShadowEffectConfig::save()
conf.writeEntry( "Opacity", mShadowOpacity->value() / 100.0 );
conf.writeEntry( "Fuzzyness", mShadowFuzzyness->value() );
conf.writeEntry( "Size", mShadowSize->value() );
+ QColor userColor = mShadowColor->color();
+ if (userColor == schemeShadowColor()) {
+ // If the user has reset the color to the default we want to start
+ // picking up color scheme changes again in the shadow effect
+ conf.deleteEntry( "Color" );
+ } else {
+ conf.writeEntry( "Color", userColor );
+ }
conf.writeEntry( "IntensifyActiveShadow", mIntensifyActiveShadow->isChecked() );
conf.sync();
@@ -134,6 +157,7 @@ void ShadowEffectConfig::defaults()
mShadowFuzzyness->setValue( 10 );
mShadowSize->setValue( 5 );
mIntensifyActiveShadow->setChecked( true );
+ mShadowColor->setColor( schemeShadowColor() );
emit changed(true);
}
diff --git a/effects/shadow_config.h b/effects/shadow_config.h
index 1bd59a286b..d311a8310f 100644
--- a/effects/shadow_config.h
+++ b/effects/shadow_config.h
@@ -27,6 +27,7 @@ along with this program. If not, see .
class QSpinBox;
class QCheckBox;
+class KColorButton;
namespace KWin
{
@@ -48,6 +49,7 @@ class ShadowEffectConfig : public KCModule
QSpinBox* mShadowOpacity;
QSpinBox* mShadowFuzzyness;
QSpinBox* mShadowSize;
+ KColorButton* mShadowColor;
QCheckBox* mIntensifyActiveShadow;
};