diff --git a/effects/shadow/shadow.cpp b/effects/shadow/shadow.cpp index 60c81e60c9..f9ed6aeba8 100644 --- a/effects/shadow/shadow.cpp +++ b/effects/shadow/shadow.cpp @@ -38,6 +38,10 @@ namespace KWin KWIN_EFFECT( shadow, ShadowEffect ) +enum { + ShadowOverrideRole = 0x22A982D1 +}; + ShadowEffect::ShadowEffect() : shadowSize( 0 ) { @@ -45,6 +49,8 @@ ShadowEffect::ShadowEffect() reconfigure( ReconfigureAll ); connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SLOT(updateShadowColor())); + shadowOverride = XInternAtom( display(), "_KDE_SHADOW_OVERRIDE", False ); + effects->registerPropertyType( shadowOverride, true ); } ShadowEffect::~ShadowEffect() @@ -57,6 +63,7 @@ ShadowEffect::~ShadowEffect() for( int i = 0; i < mDefaultShadowPics.size(); i++ ) delete mDefaultShadowPics.at( i ); #endif + effects->registerPropertyType( shadowOverride, false ); } void ShadowEffect::reconfigure( ReconfigureFlags ) @@ -364,6 +371,21 @@ QRect ShadowEffect::transformWindowDamage( EffectWindow* w, const QRect& r ) return effects->transformWindowDamage( w, r2 ); } +void ShadowEffect::propertyNotify( EffectWindow* w, long atom ) + { + if ( atom != shadowOverride ) + return; + const QByteArray value = w->readProperty( atom, atom, 32 ); + w->setData( ShadowOverrideRole, !value.isNull() ); + effects->addRepaint( shadowRectangle( w, w->geometry() )); + } + +void ShadowEffect::windowAdded( EffectWindow* c ) + { + const QByteArray value = c->readProperty( shadowOverride, shadowOverride, 32 ); + c->setData( ShadowOverrideRole, !value.isNull() ); + } + void ShadowEffect::windowClosed( EffectWindow* c ) { effects->addRepaint( shadowRectangle( c, c->geometry() )); @@ -374,6 +396,8 @@ bool ShadowEffect::useShadow( EffectWindow* w ) const return !w->isDeleted() && !w->isDesktop() && !w->isDock() // popups may have shadow even if shaped, their shape is almost rectangular && ( !w->hasOwnShape() || w->isDropdownMenu() || w->isPopupMenu() || w->isComboBox()) + // Ignore windows that draw their own shadows + && !w->data( ShadowOverrideRole ).toBool() // If decoration has it's own shadow leave it alone && !( w->hasDecoration() && effects->hasDecorationShadows() ) && !( w->windowClass() == "ksmserver ksmserver" && diff --git a/effects/shadow/shadow.h b/effects/shadow/shadow.h index bf7a7d7c2d..a03bc14612 100644 --- a/effects/shadow/shadow.h +++ b/effects/shadow/shadow.h @@ -42,9 +42,11 @@ class ShadowEffect virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ); virtual void drawWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data ); + virtual void windowAdded( EffectWindow* c ); virtual void windowClosed( EffectWindow* c ); virtual void buildQuads( EffectWindow* w, WindowQuadList& quadList ); virtual QRect transformWindowDamage( EffectWindow* w, const QRect& r ); + virtual void propertyNotify( EffectWindow* w, long atom ); private slots: void updateShadowColor(); @@ -71,6 +73,7 @@ class ShadowEffect int shadowSize; bool intensifyActiveShadow; QColor shadowColor, cachedColor; + Atom shadowOverride; #ifdef KWIN_HAVE_OPENGL_COMPOSITING QList mDefaultShadowTextures; #endif