diff --git a/thumbnailitem.cpp b/thumbnailitem.cpp index b2685be71e..66b665a685 100644 --- a/thumbnailitem.cpp +++ b/thumbnailitem.cpp @@ -23,6 +23,7 @@ along with this program. If not, see . #include "client.h" #include "effects.h" #include "workspace.h" +#include "composite.h" // Qt #include #include @@ -40,10 +41,9 @@ ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent) , m_parentWindow(0) { setFlags(flags() & ~QGraphicsItem::ItemHasNoContents); - if (effects) { - connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), SLOT(effectWindowAdded())); - connect(effects, SIGNAL(windowDamaged(KWin::EffectWindow*,QRect)), SLOT(repaint(KWin::EffectWindow*))); - } + Q_ASSERT(Compositor::isCreated()); + connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SLOT(compositingToggled())); + compositingToggled(); QTimer::singleShot(0, this, SLOT(init())); } @@ -51,6 +51,16 @@ ThumbnailItem::~ThumbnailItem() { } +void ThumbnailItem::compositingToggled() +{ + m_parent.clear(); + if (effects) { + connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), SLOT(effectWindowAdded())); + connect(effects, SIGNAL(windowDamaged(KWin::EffectWindow*,QRect)), SLOT(repaint(KWin::EffectWindow*))); + effectWindowAdded(); + } +} + void ThumbnailItem::init() { findParentEffectWindow(); diff --git a/thumbnailitem.h b/thumbnailitem.h index 9ecf6567a0..f7dc4fe621 100644 --- a/thumbnailitem.h +++ b/thumbnailitem.h @@ -60,6 +60,7 @@ private Q_SLOTS: void init(); void effectWindowAdded(); void repaint(KWin::EffectWindow* w); + void compositingToggled(); private: void findParentEffectWindow(); qulonglong m_wId;