diff --git a/effects/fallapart/fallapart.h b/effects/fallapart/fallapart.h --- a/effects/fallapart/fallapart.h +++ b/effects/fallapart/fallapart.h @@ -54,9 +54,10 @@ public Q_SLOTS: void slotWindowClosed(KWin::EffectWindow *c); void slotWindowDeleted(KWin::EffectWindow *w); + void slotWindowDataChanged(KWin::EffectWindow *w, int role); private: - QHash< const EffectWindow*, double > windows; + QHash< EffectWindow*, double > windows; bool isRealWindow(EffectWindow* w); int blockSize; }; diff --git a/effects/fallapart/fallapart.cpp b/effects/fallapart/fallapart.cpp --- a/effects/fallapart/fallapart.cpp +++ b/effects/fallapart/fallapart.cpp @@ -38,6 +38,7 @@ reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); + connect(effects, SIGNAL(windowDataChanged(KWin::EffectWindow*,int)), this, SLOT(slotWindowDataChanged(KWin::EffectWindow*,int))); } void FallApartEffect::reconfigure(ReconfigureFlags) @@ -157,6 +158,7 @@ const void* e = c->data(WindowClosedGrabRole).value(); if (e && e != this) return; + c->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast(this))); windows[ c ] = 0; c->refWindow(); } @@ -166,6 +168,25 @@ windows.remove(c); } +void FallApartEffect::slotWindowDataChanged(EffectWindow* w, int role) +{ + if (role != WindowClosedGrabRole) { + return; + } + + if (w->data(role).value() == this) { + return; + } + + auto it = windows.find(w); + if (it == windows.end()) { + return; + } + + it.key()->unrefWindow(); + windows.erase(it); +} + bool FallApartEffect::isActive() const { return !windows.isEmpty();