Make the client shadowOpacity() return a relative opacity instead of absolute.
svn path=/trunk/KDE/kdebase/workspace/; revision=873440
This commit is contained in:
parent
a9d2f462de
commit
154c19b0e7
22 changed files with 51 additions and 53 deletions
8
client.h
8
client.h
|
@ -286,7 +286,7 @@ class Client
|
|||
|
||||
// Decorations <-> Effects
|
||||
QList<QRect> shadowQuads( ShadowType type ) const;
|
||||
double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
double shadowOpacity( ShadowType type ) const;
|
||||
double shadowBrightness( ShadowType type ) const;
|
||||
double shadowSaturation( ShadowType type ) const;
|
||||
|
||||
|
@ -802,11 +802,11 @@ inline QList<QRect> Client::shadowQuads( ShadowType type ) const
|
|||
return QList<QRect>();
|
||||
}
|
||||
|
||||
inline double Client::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
inline double Client::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
if( KDecorationUnstable* decoration2 = dynamic_cast< KDecorationUnstable* >( decoration ))
|
||||
return decoration2->shadowOpacity( type, dataOpacity );
|
||||
return dataOpacity;
|
||||
return decoration2->shadowOpacity( type );
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
inline double Client::shadowBrightness( ShadowType type ) const
|
||||
|
|
|
@ -367,9 +367,9 @@ QList<QRect> OxygenFactory::shadowQuads( ShadowType type, QSize size ) const
|
|||
return quads;
|
||||
}
|
||||
|
||||
double OxygenFactory::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double OxygenFactory::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
} //namespace Oxygen
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
virtual QList< QList<QImage> > shadowTextures();
|
||||
virtual int shadowTextureList( ShadowType type ) const;
|
||||
virtual QList<QRect> shadowQuads( ShadowType type, QSize size ) const;
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
|
||||
static bool initialized();
|
||||
static Qt::Alignment titleAlignment();
|
||||
|
|
|
@ -449,12 +449,12 @@ QList<QRect> OxygenClient::shadowQuads( ShadowType type ) const
|
|||
return quads;
|
||||
}
|
||||
|
||||
double OxygenClient::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double OxygenClient::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
switch( type ) {
|
||||
case ShadowBorderedActive:
|
||||
if( isActive() )
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
return 0.0;
|
||||
case ShadowBorderedInactive:
|
||||
if( isActive() )
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
virtual void init();
|
||||
|
||||
virtual QList<QRect> shadowQuads( ShadowType type ) const;
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
|
|
@ -373,9 +373,9 @@ QList<QRect> OxygenFactory::shadowQuads( ShadowType type, QSize size ) const
|
|||
return quads;
|
||||
}
|
||||
|
||||
double OxygenFactory::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double OxygenFactory::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
} //namespace Oxygen
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
virtual QList< QList<QImage> > shadowTextures();
|
||||
virtual int shadowTextureList( ShadowType type ) const;
|
||||
virtual QList<QRect> shadowQuads( ShadowType type, QSize size ) const;
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
|
||||
static bool initialized();
|
||||
static Qt::Alignment titleAlignment();
|
||||
|
|
|
@ -458,12 +458,12 @@ QList<QRect> OxygenClient::shadowQuads( ShadowType type ) const
|
|||
return quads;
|
||||
}
|
||||
|
||||
double OxygenClient::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double OxygenClient::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
switch( type ) {
|
||||
case ShadowBorderedActive:
|
||||
if( isActive() )
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
return 0.0;
|
||||
case ShadowBorderedInactive:
|
||||
if( isActive() )
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
virtual void init();
|
||||
|
||||
virtual QList<QRect> shadowQuads( ShadowType type ) const;
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
|
|
@ -1347,16 +1347,15 @@ QList<QRect> EffectWindowImpl::shadowQuads( ShadowType type ) const
|
|||
return toplevel->workspace()->decorationShadowQuads( type, toplevel->size() );
|
||||
}
|
||||
|
||||
double EffectWindowImpl::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double EffectWindowImpl::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
dataOpacity *= opacity();
|
||||
if( type == ShadowBorderedActive || type == ShadowBorderedInactive )
|
||||
{
|
||||
if( Client* c = dynamic_cast< Client* >( toplevel ))
|
||||
return c->shadowOpacity( type, dataOpacity );
|
||||
return dataOpacity;
|
||||
return c->shadowOpacity( type );
|
||||
return 1.0;
|
||||
}
|
||||
return toplevel->workspace()->decorationShadowOpacity( type, dataOpacity );
|
||||
return toplevel->workspace()->decorationShadowOpacity( type );
|
||||
}
|
||||
|
||||
double EffectWindowImpl::shadowBrightness( ShadowType type ) const
|
||||
|
|
|
@ -239,7 +239,7 @@ class EffectWindowImpl : public EffectWindow
|
|||
virtual EffectWindowList mainWindows() const;
|
||||
|
||||
virtual QList<QRect> shadowQuads( ShadowType type ) const;
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
virtual double shadowBrightness( ShadowType type ) const;
|
||||
virtual double shadowSaturation( ShadowType type ) const;
|
||||
|
||||
|
|
|
@ -530,7 +530,7 @@ void ShadowEffect::drawShadow( EffectWindow* window, int mask, QRegion region, c
|
|||
{ // Decorated windows
|
||||
// Active shadow
|
||||
mShadowTextures.at( texture ).at( quad.id() )->bind();
|
||||
glColor4f( 1.0, 1.0, 1.0, window->shadowOpacity( ShadowBorderedActive, data.opacity ));
|
||||
glColor4f( 1.0, 1.0, 1.0, data.opacity * window->shadowOpacity( ShadowBorderedActive ));
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
mShadowTextures.at( texture ).at( quad.id() )->enableNormalizedTexCoords();
|
||||
renderGLGeometry( region, 4, verts.data(), texcoords.data() );
|
||||
|
@ -540,7 +540,7 @@ void ShadowEffect::drawShadow( EffectWindow* window, int mask, QRegion region, c
|
|||
// Inactive shadow
|
||||
texture = effects->shadowTextureList( ShadowBorderedInactive );
|
||||
mShadowTextures.at( texture ).at( quad.id() )->bind();
|
||||
glColor4f( 1.0, 1.0, 1.0, window->shadowOpacity( ShadowBorderedInactive, data.opacity ));
|
||||
glColor4f( 1.0, 1.0, 1.0, data.opacity * window->shadowOpacity( ShadowBorderedInactive ));
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
mShadowTextures.at( texture ).at( quad.id() )->enableNormalizedTexCoords();
|
||||
renderGLGeometry( region, 4, verts.data(), texcoords.data() );
|
||||
|
@ -550,11 +550,13 @@ void ShadowEffect::drawShadow( EffectWindow* window, int mask, QRegion region, c
|
|||
else if( effects->shadowTextureList( ShadowBorderlessActive ) == texture )
|
||||
{ // Decoration-less normal windows
|
||||
if( effects->activeWindow() == window )
|
||||
glColor4f( 1.0, 1.0, 1.0, window->shadowOpacity( ShadowBorderlessActive, data.opacity ));
|
||||
glColor4f( 1.0, 1.0, 1.0,
|
||||
data.opacity * window->shadowOpacity( ShadowBorderlessActive ));
|
||||
else
|
||||
{
|
||||
texture = effects->shadowTextureList( ShadowBorderlessInactive );
|
||||
glColor4f( 1.0, 1.0, 1.0, window->shadowOpacity( ShadowBorderlessInactive, data.opacity ));
|
||||
glColor4f( 1.0, 1.0, 1.0,
|
||||
data.opacity * window->shadowOpacity( ShadowBorderlessInactive ));
|
||||
}
|
||||
mShadowTextures.at( texture ).at( quad.id() )->bind();
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
@ -566,7 +568,7 @@ void ShadowEffect::drawShadow( EffectWindow* window, int mask, QRegion region, c
|
|||
else
|
||||
{ // Other windows
|
||||
mShadowTextures.at( texture ).at( quad.id() )->bind();
|
||||
glColor4f( 1.0, 1.0, 1.0, window->shadowOpacity( ShadowOther, data.opacity ));
|
||||
glColor4f( 1.0, 1.0, 1.0, data.opacity * window->shadowOpacity( ShadowOther ));
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
mShadowTextures.at( texture ).at( quad.id() )->enableNormalizedTexCoords();
|
||||
renderGLGeometry( region, 4, verts.data(), texcoords.data() );
|
||||
|
|
|
@ -1238,12 +1238,12 @@ QList<QRect> KCommonDecorationUnstable::shadowQuads( ShadowType type ) const
|
|||
Q_UNUSED( type );
|
||||
return QList<QRect>();
|
||||
}
|
||||
double KCommonDecorationUnstable::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double KCommonDecorationUnstable::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
if( isActive() && type == ShadowBorderedActive )
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
else if( !isActive() && type == ShadowBorderedInactive )
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
return 0.0;
|
||||
}
|
||||
double KCommonDecorationUnstable::shadowBrightness( ShadowType type ) const
|
||||
|
|
|
@ -370,7 +370,7 @@ class KWIN_EXPORT KCommonDecorationUnstable
|
|||
KCommonDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory);
|
||||
virtual ~KCommonDecorationUnstable();
|
||||
virtual QList<QRect> shadowQuads( ShadowType type ) const;
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
virtual double shadowBrightness( ShadowType type ) const;
|
||||
virtual double shadowSaturation( ShadowType type ) const;
|
||||
void repaintShadow();
|
||||
|
|
|
@ -120,11 +120,11 @@ QList<QRect> KCommonDecorationWrapper::shadowQuads( ShadowType type ) const
|
|||
return QList<QRect>();
|
||||
}
|
||||
|
||||
double KCommonDecorationWrapper::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double KCommonDecorationWrapper::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
if( KCommonDecorationUnstable *decoration2 = dynamic_cast<KCommonDecorationUnstable*>( decoration ))
|
||||
return decoration2->shadowOpacity( type, dataOpacity );
|
||||
return dataOpacity;
|
||||
return decoration2->shadowOpacity( type );
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double KCommonDecorationWrapper::shadowBrightness( ShadowType type ) const
|
||||
|
|
|
@ -60,7 +60,7 @@ class KCommonDecorationWrapper
|
|||
virtual void reset( unsigned long changed );
|
||||
|
||||
virtual QList<QRect> shadowQuads( ShadowType type ) const;
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
virtual double shadowBrightness( ShadowType type ) const;
|
||||
virtual double shadowSaturation( ShadowType type ) const;
|
||||
private:
|
||||
|
|
|
@ -399,12 +399,12 @@ QList<QRect> KDecorationUnstable::shadowQuads( ShadowType type ) const
|
|||
return QList<QRect>();
|
||||
}
|
||||
|
||||
double KDecorationUnstable::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double KDecorationUnstable::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
if( isActive() && type == ShadowBorderedActive )
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
else if( !isActive() && type == ShadowBorderedInactive )
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
|
|
@ -882,10 +882,9 @@ class KWIN_EXPORT KDecorationUnstable
|
|||
*/
|
||||
virtual QList<QRect> shadowQuads( ShadowType type ) const;
|
||||
/**
|
||||
* This function should return the opacity of the shadow. This is not multiplied
|
||||
* with the opacity of the window afterwards but is instead provided as \a dataOpacity
|
||||
* This function should return the desired opacity of the shadow.
|
||||
*/
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
/**
|
||||
* This function should return the desired brightness of the shadow.
|
||||
*/
|
||||
|
|
|
@ -97,10 +97,10 @@ QList<QRect> KDecorationFactoryUnstable::shadowQuads( ShadowType type, QSize siz
|
|||
return QList<QRect>();
|
||||
}
|
||||
|
||||
double KDecorationFactoryUnstable::shadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double KDecorationFactoryUnstable::shadowOpacity( ShadowType type ) const
|
||||
{
|
||||
Q_UNUSED( type );
|
||||
return dataOpacity;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double KDecorationFactoryUnstable::shadowBrightness( ShadowType type ) const
|
||||
|
|
|
@ -141,10 +141,9 @@ class KWIN_EXPORT KDecorationFactoryUnstable
|
|||
*/
|
||||
virtual QList<QRect> shadowQuads( ShadowType type, QSize size ) const;
|
||||
/**
|
||||
* This function should return the opacity of the shadow. This is not multiplied
|
||||
* with the opacity of the window afterwards but is instead provided as \a dataOpacity
|
||||
* This function should return the desired opacity of the shadow.
|
||||
*/
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
virtual double shadowOpacity( ShadowType type ) const;
|
||||
/**
|
||||
* This function should return the desired brightness of the shadow.
|
||||
*/
|
||||
|
|
|
@ -825,10 +825,9 @@ class KWIN_EXPORT EffectWindow
|
|||
*/
|
||||
virtual QList<QRect> shadowQuads( ShadowType type ) const = 0;
|
||||
/**
|
||||
* Returns the opacity of the shadow. This has already been pre-multiplied by
|
||||
* the window's opacity if the decoration desires so.
|
||||
* Returns the desired opacity of the shadow.
|
||||
*/
|
||||
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const = 0;
|
||||
virtual double shadowOpacity( ShadowType type ) const = 0;
|
||||
/**
|
||||
* Returns the desired brightness of the shadow.
|
||||
*/
|
||||
|
|
|
@ -248,7 +248,7 @@ class Workspace : public QObject, public KDecorationDefines
|
|||
QList< QList<QImage> > decorationShadowTextures();
|
||||
int decorationShadowTextureList( ShadowType type ) const;
|
||||
QList<QRect> decorationShadowQuads( ShadowType type, QSize size ) const;
|
||||
double decorationShadowOpacity( ShadowType type, double dataOpacity ) const;
|
||||
double decorationShadowOpacity( ShadowType type ) const;
|
||||
double decorationShadowBrightness( ShadowType type ) const;
|
||||
double decorationShadowSaturation( ShadowType type ) const;
|
||||
|
||||
|
@ -1022,11 +1022,11 @@ QList<QRect> Workspace::decorationShadowQuads( ShadowType type, QSize size ) con
|
|||
}
|
||||
|
||||
inline
|
||||
double Workspace::decorationShadowOpacity( ShadowType type, double dataOpacity ) const
|
||||
double Workspace::decorationShadowOpacity( ShadowType type ) const
|
||||
{
|
||||
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() ))
|
||||
return factory->shadowOpacity( type, dataOpacity );
|
||||
return dataOpacity;
|
||||
return factory->shadowOpacity( type );
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
inline
|
||||
|
|
Loading…
Reference in a new issue