diff --git a/effects/glide/glide.cpp b/effects/glide/glide.cpp index 954ab913e6..22f648e576 100644 --- a/effects/glide/glide.cpp +++ b/effects/glide/glide.cpp @@ -35,23 +35,17 @@ static const int IsGlideWindow = 0x22A982D4; GlideEffect::GlideEffect() : Effect() - , m_atom(QByteArrayLiteral("_KDE_SLIDE")) { - if (m_atom.isValid()) { - effects->registerPropertyType( m_atom, true ); - } reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*))); connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); + + + connect(effects, &EffectsHandler::windowDataChanged, this, &GlideEffect::cancelWindowGrab); } -GlideEffect::~GlideEffect() -{ - if (m_atom.isValid()) { - effects->registerPropertyType( m_atom, false ); - } -} +GlideEffect::~GlideEffect() = default; bool GlideEffect::supported() { @@ -214,8 +208,6 @@ bool GlideEffect::isGlideWindow(EffectWindow* w) return false; if (w->data(IsGlideWindow).toBool()) return true; - if (m_atom.isValid() && !w->readProperty( m_atom, m_atom, 32 ).isNull()) - return false; if (w->hasDecoration()) return true; if (!w->isManaged() || w->isMenu() || w->isNotification() || w->isDesktop() || @@ -229,6 +221,20 @@ bool GlideEffect::isActive() const return !windows.isEmpty(); } +void GlideEffect::cancelWindowGrab(EffectWindow *w, int grabRole) +{ + if (grabRole != WindowAddedGrabRole && grabRole != WindowClosedGrabRole) { + return; + } + if (!w->data(IsGlideWindow).toBool()) { + return; + } + if (w->data(grabRole).value() != this) { + windows.remove(w); + w->setData(IsGlideWindow, false); + } +} + GlideEffect::WindowInfo::WindowInfo() : deleted(false) , added(false) diff --git a/effects/glide/glide.h b/effects/glide/glide.h index 3adda141f6..28b6923a07 100644 --- a/effects/glide/glide.h +++ b/effects/glide/glide.h @@ -24,7 +24,6 @@ along with this program. If not, see . #define KWIN_GLIDE_H #include -#include class QTimeLine; @@ -75,7 +74,7 @@ private: void glideIn(EffectWindow* w, WindowPaintData& data, const InfoHash::const_iterator &info); void glideOut(EffectWindow* w, WindowPaintData& data, const InfoHash::const_iterator &info); bool isGlideWindow(EffectWindow* w); - Xcb::Atom m_atom; + void cancelWindowGrab(EffectWindow *w, int grabRole); InfoHash windows; float duration; int angle;