Make it possible for effects to store arbitrary data in EffectWindow.

svn path=/trunk/KDE/kdebase/workspace/; revision=1069539
This commit is contained in:
Fredrik Höglund 2010-01-03 17:50:38 +00:00
parent ab85881232
commit b95c6f721c
3 changed files with 26 additions and 1 deletions

View file

@ -1531,6 +1531,21 @@ bool EffectWindowImpl::visibleInClientGroup() const
return false; return false;
} }
void EffectWindowImpl::setData( int role, const QVariant &data )
{
if ( !data.isNull() )
dataMap[ role ] = data;
else
dataMap.remove( role );
}
QVariant EffectWindowImpl::data( int role ) const
{
if( !dataMap.contains( role ) )
return QVariant();
return dataMap[ role ];
}
EffectWindow* effectWindow( Toplevel* w ) EffectWindow* effectWindow( Toplevel* w )
{ {
EffectWindowImpl* ret = w->effectWindow(); EffectWindowImpl* ret = w->effectWindow();

View file

@ -277,9 +277,13 @@ class EffectWindowImpl : public EffectWindow
void setSceneWindow( Scene::Window* w ); // internal void setSceneWindow( Scene::Window* w ); // internal
const Scene::Window* sceneWindow() const; // internal const Scene::Window* sceneWindow() const; // internal
Scene::Window* sceneWindow(); // internal Scene::Window* sceneWindow(); // internal
void setData( int role, const QVariant &data );
QVariant data( int role ) const;
private: private:
Toplevel* toplevel; Toplevel* toplevel;
Scene::Window* sw; // This one is used only during paint pass. Scene::Window* sw; // This one is used only during paint pass.
QMap<int, QVariant> dataMap;
}; };
class EffectWindowGroupImpl class EffectWindowGroupImpl

View file

@ -170,7 +170,7 @@ X-KDE-Library=kwin4_effect_cooleffect
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor )) #define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
#define KWIN_EFFECT_API_VERSION_MAJOR 0 #define KWIN_EFFECT_API_VERSION_MAJOR 0
#define KWIN_EFFECT_API_VERSION_MINOR 111 #define KWIN_EFFECT_API_VERSION_MINOR 112
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \ #define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR ) KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
@ -964,6 +964,12 @@ class KWIN_EXPORT EffectWindow
virtual void closeWindow() const = 0; virtual void closeWindow() const = 0;
virtual bool visibleInClientGroup() const = 0; virtual bool visibleInClientGroup() const = 0;
/**
* Can be used to by effects to store arbitrary data in the EffectWindow.
*/
virtual void setData( int role, const QVariant &data ) = 0;
virtual QVariant data( int role ) const = 0;
}; };
class KWIN_EXPORT EffectWindowGroup class KWIN_EXPORT EffectWindowGroup