diff --git a/client.h b/client.h index 1161a9c3a7..b05e29fc8a 100644 --- a/client.h +++ b/client.h @@ -286,7 +286,7 @@ class Client // Decorations <-> Effects QList 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 Client::shadowQuads( ShadowType type ) const return QList(); } -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 diff --git a/clients/oxygen/oxygen.cpp b/clients/oxygen/oxygen.cpp index 90941a1251..ea5eef697e 100644 --- a/clients/oxygen/oxygen.cpp +++ b/clients/oxygen/oxygen.cpp @@ -367,9 +367,9 @@ QList 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 diff --git a/clients/oxygen/oxygen.h b/clients/oxygen/oxygen.h index b6fafed5ad..4376c179c6 100644 --- a/clients/oxygen/oxygen.h +++ b/clients/oxygen/oxygen.h @@ -65,7 +65,7 @@ public: virtual QList< QList > shadowTextures(); virtual int shadowTextureList( ShadowType type ) const; virtual QList 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(); diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index ab7035ea46..1d453050e9 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -449,12 +449,12 @@ QList 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() ) diff --git a/clients/oxygen/oxygenclient.h b/clients/oxygen/oxygenclient.h index 9ead2a1ffe..0e99eb3d19 100644 --- a/clients/oxygen/oxygenclient.h +++ b/clients/oxygen/oxygenclient.h @@ -52,7 +52,7 @@ public: virtual void init(); virtual QList shadowQuads( ShadowType type ) const; - virtual double shadowOpacity( ShadowType type, double dataOpacity ) const; + virtual double shadowOpacity( ShadowType type ) const; private: void paintEvent(QPaintEvent *e); diff --git a/clients/ozone/oxygen.cpp b/clients/ozone/oxygen.cpp index 91799c8148..7c6ab8a420 100644 --- a/clients/ozone/oxygen.cpp +++ b/clients/ozone/oxygen.cpp @@ -373,9 +373,9 @@ QList 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 diff --git a/clients/ozone/oxygen.h b/clients/ozone/oxygen.h index e4f034100e..2c6457c9c9 100644 --- a/clients/ozone/oxygen.h +++ b/clients/ozone/oxygen.h @@ -67,7 +67,7 @@ public: virtual QList< QList > shadowTextures(); virtual int shadowTextureList( ShadowType type ) const; virtual QList 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(); diff --git a/clients/ozone/oxygenclient.cpp b/clients/ozone/oxygenclient.cpp index 19425816f5..896f69581b 100644 --- a/clients/ozone/oxygenclient.cpp +++ b/clients/ozone/oxygenclient.cpp @@ -458,12 +458,12 @@ QList 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() ) diff --git a/clients/ozone/oxygenclient.h b/clients/ozone/oxygenclient.h index 76b8d75bac..70af9f246c 100644 --- a/clients/ozone/oxygenclient.h +++ b/clients/ozone/oxygenclient.h @@ -54,7 +54,7 @@ public: virtual void init(); virtual QList shadowQuads( ShadowType type ) const; - virtual double shadowOpacity( ShadowType type, double dataOpacity ) const; + virtual double shadowOpacity( ShadowType type ) const; private: void paintEvent(QPaintEvent *e); diff --git a/effects.cpp b/effects.cpp index c0886442ea..488b0438c9 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1347,16 +1347,15 @@ QList 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 diff --git a/effects.h b/effects.h index f00f87d378..8eaeb4fb7c 100644 --- a/effects.h +++ b/effects.h @@ -239,7 +239,7 @@ class EffectWindowImpl : public EffectWindow virtual EffectWindowList mainWindows() const; virtual QList 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; diff --git a/effects/shadow.cpp b/effects/shadow.cpp index 54d5c78111..d07401589b 100644 --- a/effects/shadow.cpp +++ b/effects/shadow.cpp @@ -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() ); diff --git a/lib/kcommondecoration.cpp b/lib/kcommondecoration.cpp index 76ac14270f..2330119a39 100644 --- a/lib/kcommondecoration.cpp +++ b/lib/kcommondecoration.cpp @@ -1238,12 +1238,12 @@ QList KCommonDecorationUnstable::shadowQuads( ShadowType type ) const Q_UNUSED( type ); return QList(); } -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 diff --git a/lib/kcommondecoration.h b/lib/kcommondecoration.h index d194e5ca15..4b2cb867db 100644 --- a/lib/kcommondecoration.h +++ b/lib/kcommondecoration.h @@ -370,7 +370,7 @@ class KWIN_EXPORT KCommonDecorationUnstable KCommonDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory); virtual ~KCommonDecorationUnstable(); virtual QList 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(); diff --git a/lib/kcommondecoration_p.cpp b/lib/kcommondecoration_p.cpp index d5697e9ce6..733b9d93d8 100644 --- a/lib/kcommondecoration_p.cpp +++ b/lib/kcommondecoration_p.cpp @@ -120,11 +120,11 @@ QList KCommonDecorationWrapper::shadowQuads( ShadowType type ) const return QList(); } -double KCommonDecorationWrapper::shadowOpacity( ShadowType type, double dataOpacity ) const +double KCommonDecorationWrapper::shadowOpacity( ShadowType type ) const { if( KCommonDecorationUnstable *decoration2 = dynamic_cast( decoration )) - return decoration2->shadowOpacity( type, dataOpacity ); - return dataOpacity; + return decoration2->shadowOpacity( type ); + return 1.0; } double KCommonDecorationWrapper::shadowBrightness( ShadowType type ) const diff --git a/lib/kcommondecoration_p.h b/lib/kcommondecoration_p.h index e389e5b059..e152a28b87 100644 --- a/lib/kcommondecoration_p.h +++ b/lib/kcommondecoration_p.h @@ -60,7 +60,7 @@ class KCommonDecorationWrapper virtual void reset( unsigned long changed ); virtual QList 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: diff --git a/lib/kdecoration.cpp b/lib/kdecoration.cpp index 837b5cbf2e..b1d349907c 100644 --- a/lib/kdecoration.cpp +++ b/lib/kdecoration.cpp @@ -399,12 +399,12 @@ QList KDecorationUnstable::shadowQuads( ShadowType type ) const return QList(); } -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; } diff --git a/lib/kdecoration.h b/lib/kdecoration.h index e90c948d39..cf3a8abb35 100644 --- a/lib/kdecoration.h +++ b/lib/kdecoration.h @@ -882,10 +882,9 @@ class KWIN_EXPORT KDecorationUnstable */ virtual QList 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. */ diff --git a/lib/kdecorationfactory.cpp b/lib/kdecorationfactory.cpp index 2485c31e5f..a5314b98c8 100644 --- a/lib/kdecorationfactory.cpp +++ b/lib/kdecorationfactory.cpp @@ -97,10 +97,10 @@ QList KDecorationFactoryUnstable::shadowQuads( ShadowType type, QSize siz return QList(); } -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 diff --git a/lib/kdecorationfactory.h b/lib/kdecorationfactory.h index 984fd02d63..f61a0da6a8 100644 --- a/lib/kdecorationfactory.h +++ b/lib/kdecorationfactory.h @@ -141,10 +141,9 @@ class KWIN_EXPORT KDecorationFactoryUnstable */ virtual QList 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. */ diff --git a/lib/kwineffects.h b/lib/kwineffects.h index d51a30e9ae..0afd8f0931 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -825,10 +825,9 @@ class KWIN_EXPORT EffectWindow */ virtual QList 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. */ diff --git a/workspace.h b/workspace.h index 3eeb622f64..9203c601fd 100644 --- a/workspace.h +++ b/workspace.h @@ -248,7 +248,7 @@ class Workspace : public QObject, public KDecorationDefines QList< QList > decorationShadowTextures(); int decorationShadowTextureList( ShadowType type ) const; QList 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 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