Don't draw shadows under windows that have the _KDE_SHADOW_OVERRIDE

property set.

svn path=/trunk/KDE/kdebase/workspace/; revision=1069543
This commit is contained in:
Fredrik Höglund 2010-01-03 17:59:27 +00:00
parent b95c6f721c
commit 955654560d
2 changed files with 27 additions and 0 deletions

View file

@ -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" &&

View file

@ -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<GLTexture*> mDefaultShadowTextures;
#endif