Rename the new decoration API and mark it as unstable. Supporting a hacked API is suicide.

Will correctly handle this in KDE 4.3 by using ARGB decorations, even if it's not pretty.

svn path=/trunk/KDE/kdebase/workspace/; revision=872795
icc-effect-5.14.5
Lucas Murray 2008-10-18 08:10:37 +00:00
parent 13398a1671
commit af1b639a9d
19 changed files with 76 additions and 70 deletions

View File

@ -28,7 +28,7 @@ namespace KWin
class Client;
class Bridge : public KDecorationBridge2
class Bridge : public KDecorationBridgeUnstable
{
public:
Bridge( Client* cl );

View File

@ -797,28 +797,28 @@ inline bool Client::hiddenPreview() const
inline QList<QRect> Client::shadowQuads( ShadowType type ) const
{
if( KDecoration2* decoration2 = dynamic_cast< KDecoration2* >( decoration ))
if( KDecorationUnstable* decoration2 = dynamic_cast< KDecorationUnstable* >( decoration ))
return decoration2->shadowQuads( type );
return QList<QRect>();
}
inline double Client::shadowOpacity( ShadowType type, double dataOpacity ) const
{
if( KDecoration2* decoration2 = dynamic_cast< KDecoration2* >( decoration ))
if( KDecorationUnstable* decoration2 = dynamic_cast< KDecorationUnstable* >( decoration ))
return decoration2->shadowOpacity( type, dataOpacity );
return dataOpacity;
}
inline double Client::shadowBrightness( ShadowType type ) const
{
if( KDecoration2* decoration2 = dynamic_cast< KDecoration2* >( decoration ))
if( KDecorationUnstable* decoration2 = dynamic_cast< KDecorationUnstable* >( decoration ))
return decoration2->shadowBrightness( type );
return 1.0;
}
inline double Client::shadowSaturation( ShadowType type ) const
{
if( KDecoration2* decoration2 = dynamic_cast< KDecoration2* >( decoration ))
if( KDecorationUnstable* decoration2 = dynamic_cast< KDecorationUnstable* >( decoration ))
return decoration2->shadowSaturation( type );
return 1.0;
}

View File

@ -53,7 +53,7 @@ enum ButtonType {
};
Q_DECLARE_FLAGS(ButtonTypes, ButtonType)
class OxygenFactory: public KDecorationFactory2
class OxygenFactory: public KDecorationFactoryUnstable
{
public:
OxygenFactory();

View File

@ -70,7 +70,7 @@ void renderDot(QPainter *p, const QPointF &point, qreal diameter)
OxygenClient::OxygenClient(KDecorationBridge *b, KDecorationFactory *f)
: KCommonDecoration2(b, f)
: KCommonDecorationUnstable(b, f)
, colorCacheInvalid_(true)
, helper_(*globalHelper)
{

View File

@ -37,7 +37,7 @@ class QPoint;
namespace Oxygen {
class OxygenClient : public KCommonDecoration2
class OxygenClient : public KCommonDecorationUnstable
{
Q_OBJECT
public:

View File

@ -55,7 +55,7 @@ enum ButtonType {
};
Q_DECLARE_FLAGS(ButtonTypes, ButtonType)
class OxygenFactory: public KDecorationFactory2
class OxygenFactory: public KDecorationFactoryUnstable
{
public:
OxygenFactory();

View File

@ -72,7 +72,7 @@ void renderDot(QPainter *p, const QPointF &point, qreal diameter)
OxygenClient::OxygenClient(KDecorationBridge *b, KDecorationFactory *f)
: KCommonDecoration2(b, f)
: KCommonDecorationUnstable(b, f)
, colorCacheInvalid_(true)
, helper_(*globalHelper)
{

View File

@ -39,7 +39,7 @@ namespace Ozone
{
namespace Oxygen {
class OxygenClient : public KCommonDecoration2
class OxygenClient : public KCommonDecorationUnstable
{
Q_OBJECT
public:

View File

@ -66,7 +66,7 @@ class KDecorationPreview
};
class KDecorationPreviewBridge
: public KDecorationBridge2
: public KDecorationBridgeUnstable
{
public:
KDecorationPreviewBridge( KDecorationPreview* preview, bool active );

View File

@ -1222,23 +1222,23 @@ KDecoration* KCommonDecoration::decoration()
}
KCommonDecoration2::KCommonDecoration2(KDecorationBridge* bridge, KDecorationFactory* factory)
KCommonDecorationUnstable::KCommonDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory)
: KCommonDecoration( bridge, factory )
{
Q_ASSERT( dynamic_cast<const KDecoration2*>( decoration() ));
Q_ASSERT( dynamic_cast<const KDecorationUnstable*>( decoration() ));
}
KCommonDecoration2::~KCommonDecoration2()
KCommonDecorationUnstable::~KCommonDecorationUnstable()
{
}
// All copied from kdecoration.cpp
QList<QRect> KCommonDecoration2::shadowQuads( ShadowType type ) const
QList<QRect> KCommonDecorationUnstable::shadowQuads( ShadowType type ) const
{
Q_UNUSED( type );
return QList<QRect>();
}
double KCommonDecoration2::shadowOpacity( ShadowType type, double dataOpacity ) const
double KCommonDecorationUnstable::shadowOpacity( ShadowType type, double dataOpacity ) const
{
if( isActive() && type == ShadowBorderedActive )
return dataOpacity;
@ -1246,32 +1246,32 @@ double KCommonDecoration2::shadowOpacity( ShadowType type, double dataOpacity )
return dataOpacity;
return 0.0;
}
double KCommonDecoration2::shadowBrightness( ShadowType type ) const
double KCommonDecorationUnstable::shadowBrightness( ShadowType type ) const
{
Q_UNUSED( type );
return 1.0;
}
double KCommonDecoration2::shadowSaturation( ShadowType type ) const
double KCommonDecorationUnstable::shadowSaturation( ShadowType type ) const
{
Q_UNUSED( type );
return 1.0;
}
void KCommonDecoration2::repaintShadow()
void KCommonDecorationUnstable::repaintShadow()
{
return static_cast<const KDecoration2*>( decoration() )->repaintShadow();
return static_cast<const KDecorationUnstable*>( decoration() )->repaintShadow();
}
bool KCommonDecoration2::compositingActive() const
bool KCommonDecorationUnstable::compositingActive() const
{
return static_cast<const KDecoration2*>( decoration() )->compositingActive();
return static_cast<const KDecorationUnstable*>( decoration() )->compositingActive();
}
bool KCommonDecoration2::shadowsActive() const
bool KCommonDecorationUnstable::shadowsActive() const
{
return static_cast<const KDecoration2*>( decoration() )->shadowsActive();
return static_cast<const KDecorationUnstable*>( decoration() )->shadowsActive();
}
double KCommonDecoration2::opacity() const
double KCommonDecorationUnstable::opacity() const
{
return static_cast<const KDecoration2*>( decoration() )->opacity();
return static_cast<const KDecorationUnstable*>( decoration() )->opacity();
}
// kate: space-indent on; indent-width 4; mixedindent off; indent-mode cstyle;

View File

@ -362,13 +362,13 @@ class KWIN_EXPORT KCommonDecoration : public QObject, public KDecorationDefines
KCommonDecorationPrivate *d;
};
class KWIN_EXPORT KCommonDecoration2
class KWIN_EXPORT KCommonDecorationUnstable
: public KCommonDecoration
{
Q_OBJECT
public:
KCommonDecoration2(KDecorationBridge* bridge, KDecorationFactory* factory);
virtual ~KCommonDecoration2();
KCommonDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory);
virtual ~KCommonDecorationUnstable();
virtual QList<QRect> shadowQuads( ShadowType type ) const;
virtual double shadowOpacity( ShadowType type, double dataOpacity ) const;
virtual double shadowBrightness( ShadowType type ) const;

View File

@ -32,7 +32,7 @@
#include "kcommondecoration_p.moc"
KCommonDecorationWrapper::KCommonDecorationWrapper( KCommonDecoration* deco, KDecorationBridge* bridge, KDecorationFactory* factory )
: KDecoration2( bridge, factory )
: KDecorationUnstable( bridge, factory )
, decoration( deco )
{
}
@ -115,28 +115,28 @@ void KCommonDecorationWrapper::reset( unsigned long changed )
QList<QRect> KCommonDecorationWrapper::shadowQuads( ShadowType type ) const
{
if( KCommonDecoration2 *decoration2 = dynamic_cast<KCommonDecoration2*>( decoration ))
if( KCommonDecorationUnstable *decoration2 = dynamic_cast<KCommonDecorationUnstable*>( decoration ))
return decoration2->shadowQuads( type );
return QList<QRect>();
}
double KCommonDecorationWrapper::shadowOpacity( ShadowType type, double dataOpacity ) const
{
if( KCommonDecoration2 *decoration2 = dynamic_cast<KCommonDecoration2*>( decoration ))
if( KCommonDecorationUnstable *decoration2 = dynamic_cast<KCommonDecorationUnstable*>( decoration ))
return decoration2->shadowOpacity( type, dataOpacity );
return dataOpacity;
}
double KCommonDecorationWrapper::shadowBrightness( ShadowType type ) const
{
if( KCommonDecoration2 *decoration2 = dynamic_cast<KCommonDecoration2*>( decoration ))
if( KCommonDecorationUnstable *decoration2 = dynamic_cast<KCommonDecorationUnstable*>( decoration ))
return decoration2->shadowBrightness( type );
return 1.0;
}
double KCommonDecorationWrapper::shadowSaturation( ShadowType type ) const
{
if( KCommonDecoration2 *decoration2 = dynamic_cast<KCommonDecoration2*>( decoration ))
if( KCommonDecorationUnstable *decoration2 = dynamic_cast<KCommonDecorationUnstable*>( decoration ))
return decoration2->shadowSaturation( type );
return 1.0;
}

View File

@ -32,13 +32,13 @@
//
class KCommonDecoration;
class KCommonDecoration2;
class KCommonDecorationUnstable;
class KDecorationBridge;
class KDecorationFactory;
// wrapper all functionality that needs reimplementing in KDecoration and forward it to KCommonDecoration
class KCommonDecorationWrapper
: public KDecoration2
: public KDecorationUnstable
{
Q_OBJECT
public:

View File

@ -383,23 +383,23 @@ KDecoration::Position KDecoration::mousePosition( const QPoint& p ) const
}
KDecoration2::KDecoration2( KDecorationBridge* bridge, KDecorationFactory* factory )
KDecorationUnstable::KDecorationUnstable( KDecorationBridge* bridge, KDecorationFactory* factory )
: KDecoration( bridge, factory )
{
Q_ASSERT( dynamic_cast< KDecorationBridge2* >( bridge ));
Q_ASSERT( dynamic_cast< KDecorationBridgeUnstable* >( bridge ));
}
KDecoration2::~KDecoration2()
KDecorationUnstable::~KDecorationUnstable()
{
}
QList<QRect> KDecoration2::shadowQuads( ShadowType type ) const
QList<QRect> KDecorationUnstable::shadowQuads( ShadowType type ) const
{
Q_UNUSED( type );
return QList<QRect>();
}
double KDecoration2::shadowOpacity( ShadowType type, double dataOpacity ) const
double KDecorationUnstable::shadowOpacity( ShadowType type, double dataOpacity ) const
{
if( isActive() && type == ShadowBorderedActive )
return dataOpacity;
@ -408,36 +408,36 @@ double KDecoration2::shadowOpacity( ShadowType type, double dataOpacity ) const
return 0.0;
}
double KDecoration2::shadowBrightness( ShadowType type ) const
double KDecorationUnstable::shadowBrightness( ShadowType type ) const
{
Q_UNUSED( type );
return 1.0;
}
double KDecoration2::shadowSaturation( ShadowType type ) const
double KDecorationUnstable::shadowSaturation( ShadowType type ) const
{
Q_UNUSED( type );
return 1.0;
}
void KDecoration2::repaintShadow()
void KDecorationUnstable::repaintShadow()
{
static_cast< KDecorationBridge2* >( bridge_ )->repaintShadow();
static_cast< KDecorationBridgeUnstable* >( bridge_ )->repaintShadow();
}
bool KDecoration2::compositingActive() const
bool KDecorationUnstable::compositingActive() const
{
return static_cast< KDecorationBridge2* >( bridge_ )->compositingActive();
return static_cast< KDecorationBridgeUnstable* >( bridge_ )->compositingActive();
}
bool KDecoration2::shadowsActive() const
bool KDecorationUnstable::shadowsActive() const
{
return static_cast< KDecorationBridge2* >( bridge_ )->shadowsActive();
return static_cast< KDecorationBridgeUnstable* >( bridge_ )->shadowsActive();
}
double KDecoration2::opacity() const
double KDecorationUnstable::opacity() const
{
return static_cast< KDecorationBridge2* >( bridge_ )->opacity();
return static_cast< KDecorationBridgeUnstable* >( bridge_ )->opacity();
}

View File

@ -859,18 +859,21 @@ class KWIN_EXPORT KDecoration
QWidget* w_;
KDecorationFactory* factory_;
friend class KDecorationOptions; // for options_
friend class KDecoration2; // for bridge_
friend class KDecorationUnstable; // for bridge_
static KDecorationOptions* options_;
KDecorationPrivate* d;
};
class KWIN_EXPORT KDecoration2
/**
* @warning THIS CLASS IS UNSTABLE AND WILL ONLY BE SUPPORTED IN KDE 4.2!
*/
class KWIN_EXPORT KDecorationUnstable
: public KDecoration
{
Q_OBJECT
public:
KDecoration2( KDecorationBridge* bridge, KDecorationFactory* factory );
virtual ~KDecoration2();
KDecorationUnstable( KDecorationBridge* bridge, KDecorationFactory* factory );
virtual ~KDecorationUnstable();
/**
* This function should return the positions of the shadow quads to be rendered.

View File

@ -89,7 +89,7 @@ class KDecorationBridge : public KDecorationDefines
virtual void grabXServer( bool grab ) = 0;
};
class KWIN_EXPORT KDecorationBridge2
class KWIN_EXPORT KDecorationBridgeUnstable
: public KDecorationBridge
{
public:

View File

@ -79,37 +79,37 @@ NET::WindowType KDecorationFactory::windowType( unsigned long supported_types, K
return bridge->windowType( supported_types );
}
QList< QList<QImage> > KDecorationFactory2::shadowTextures()
QList< QList<QImage> > KDecorationFactoryUnstable::shadowTextures()
{
return QList< QList<QImage> >();
}
int KDecorationFactory2::shadowTextureList( ShadowType type ) const
int KDecorationFactoryUnstable::shadowTextureList( ShadowType type ) const
{
Q_UNUSED( type );
return -1;
}
QList<QRect> KDecorationFactory2::shadowQuads( ShadowType type, QSize size ) const
QList<QRect> KDecorationFactoryUnstable::shadowQuads( ShadowType type, QSize size ) const
{
Q_UNUSED( type );
Q_UNUSED( size );
return QList<QRect>();
}
double KDecorationFactory2::shadowOpacity( ShadowType type, double dataOpacity ) const
double KDecorationFactoryUnstable::shadowOpacity( ShadowType type, double dataOpacity ) const
{
Q_UNUSED( type );
return dataOpacity;
}
double KDecorationFactory2::shadowBrightness( ShadowType type ) const
double KDecorationFactoryUnstable::shadowBrightness( ShadowType type ) const
{
Q_UNUSED( type );
return 1.0;
}
double KDecorationFactory2::shadowSaturation( ShadowType type ) const
double KDecorationFactoryUnstable::shadowSaturation( ShadowType type ) const
{
Q_UNUSED( type );
return 1.0;

View File

@ -115,7 +115,10 @@ class KWIN_EXPORT KDecorationFactory
KDecorationFactoryPrivate* d;
};
class KWIN_EXPORT KDecorationFactory2
/**
* @warning THIS CLASS IS UNSTABLE AND WILL ONLY BE SUPPORTED IN KDE 4.2!
*/
class KWIN_EXPORT KDecorationFactoryUnstable
: public KDecorationFactory
{
public:

View File

@ -1000,7 +1000,7 @@ bool Workspace::hasDecorationShadows() const
inline
QList< QList<QImage> > Workspace::decorationShadowTextures()
{
if( KDecorationFactory2* factory = dynamic_cast< KDecorationFactory2* >( mgr->factory() ))
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() ))
return factory->shadowTextures();
return QList< QList<QImage> >();
}
@ -1008,7 +1008,7 @@ QList< QList<QImage> > Workspace::decorationShadowTextures()
inline
int Workspace::decorationShadowTextureList( ShadowType type ) const
{
if( KDecorationFactory2* factory = dynamic_cast< KDecorationFactory2* >( mgr->factory() ))
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() ))
return factory->shadowTextureList( type );
return -1;
}
@ -1016,7 +1016,7 @@ int Workspace::decorationShadowTextureList( ShadowType type ) const
inline
QList<QRect> Workspace::decorationShadowQuads( ShadowType type, QSize size ) const
{
if( KDecorationFactory2* factory = dynamic_cast< KDecorationFactory2* >( mgr->factory() ))
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() ))
return factory->shadowQuads( type, size );
return QList<QRect>();
}
@ -1024,7 +1024,7 @@ QList<QRect> Workspace::decorationShadowQuads( ShadowType type, QSize size ) con
inline
double Workspace::decorationShadowOpacity( ShadowType type, double dataOpacity ) const
{
if( KDecorationFactory2* factory = dynamic_cast< KDecorationFactory2* >( mgr->factory() ))
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() ))
return factory->shadowOpacity( type, dataOpacity );
return dataOpacity;
}
@ -1032,7 +1032,7 @@ double Workspace::decorationShadowOpacity( ShadowType type, double dataOpacity )
inline
double Workspace::decorationShadowBrightness( ShadowType type ) const
{
if( KDecorationFactory2* factory = dynamic_cast< KDecorationFactory2* >( mgr->factory() ))
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() ))
return factory->shadowBrightness( type );
return 1.0;
}
@ -1040,7 +1040,7 @@ double Workspace::decorationShadowBrightness( ShadowType type ) const
inline
double Workspace::decorationShadowSaturation( ShadowType type ) const
{
if( KDecorationFactory2* factory = dynamic_cast< KDecorationFactory2* >( mgr->factory() ))
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() ))
return factory->shadowSaturation( type );
return 1.0;
}