From b95c6f721caff5ba78056512739803130e9e7b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Sun, 3 Jan 2010 17:50:38 +0000 Subject: [PATCH] Make it possible for effects to store arbitrary data in EffectWindow. svn path=/trunk/KDE/kdebase/workspace/; revision=1069539 --- effects.cpp | 15 +++++++++++++++ effects.h | 4 ++++ lib/kwineffects.h | 8 +++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/effects.cpp b/effects.cpp index ba54e5117a..505fb5e173 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1531,6 +1531,21 @@ bool EffectWindowImpl::visibleInClientGroup() const 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 ) { EffectWindowImpl* ret = w->effectWindow(); diff --git a/effects.h b/effects.h index 651a74d833..9de14467fe 100644 --- a/effects.h +++ b/effects.h @@ -277,9 +277,13 @@ class EffectWindowImpl : public EffectWindow void setSceneWindow( Scene::Window* w ); // internal const Scene::Window* sceneWindow() const; // internal Scene::Window* sceneWindow(); // internal + + void setData( int role, const QVariant &data ); + QVariant data( int role ) const; private: Toplevel* toplevel; Scene::Window* sw; // This one is used only during paint pass. + QMap dataMap; }; class EffectWindowGroupImpl diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 04e4988d59..26e2d6c502 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -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_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( \ KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR ) @@ -964,6 +964,12 @@ class KWIN_EXPORT EffectWindow virtual void closeWindow() 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