From 5299f728fe5b08191b316113d049d9629cdb394b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Mon, 18 Mar 2013 17:08:58 +0100 Subject: [PATCH] catch geometry updates of moving clients and bind geometry change signals dynamically REVIEW: 109570 (cherry picked from commit eb2db41304f1ec1e597e9bd282a9c4f0b7dd1e54) Conflicts: kwin/libkwineffects/kwinanimationeffect.cpp --- libkwineffects/kwinanimationeffect.cpp | 40 ++++++++++++++++---------- libkwineffects/kwinanimationeffect.h | 1 + 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/libkwineffects/kwinanimationeffect.cpp b/libkwineffects/kwinanimationeffect.cpp index 67480c129d..9cdaa322f9 100644 --- a/libkwineffects/kwinanimationeffect.cpp +++ b/libkwineffects/kwinanimationeffect.cpp @@ -59,10 +59,6 @@ void AnimationEffect::init() * and has pot. started an animation so we have the window in our hash :) */ connect ( effects, SIGNAL(windowClosed(KWin::EffectWindow*)), SLOT(_windowClosed(KWin::EffectWindow*)) ); connect ( effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), SLOT(_windowDeleted(KWin::EffectWindow*)) ); - connect ( effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*, const QRect&)), - SLOT(_expandedGeometryChanged(KWin::EffectWindow*, const QRect&)) ); - connect ( effects, SIGNAL(windowPaddingChanged(KWin::EffectWindow*, const QRect&)), - SLOT(_expandedGeometryChanged(KWin::EffectWindow*, const QRect&)) ); } bool AnimationEffect::isActive() const @@ -177,6 +173,14 @@ quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int } Q_D(AnimationEffect); + if (d->m_animations.isEmpty()) { + connect (effects, SIGNAL(windowGeometryShapeChanged( KWin::EffectWindow*, const QRect&)), + SLOT(_expandedGeometryChanged( KWin::EffectWindow*, const QRect&))); + connect (effects, SIGNAL(windowStepUserMovedResized( KWin::EffectWindow*, const QRect&)), + SLOT(_expandedGeometryChanged( KWin::EffectWindow*, const QRect&))); + connect (effects, SIGNAL(windowPaddingChanged( KWin::EffectWindow*, const QRect&)), + SLOT(_expandedGeometryChanged( KWin::EffectWindow*, const QRect&))); + } AniMap::iterator it = d->m_animations.find(w); if (it == d->m_animations.end()) it = d->m_animations.insert(w, QPair, QRect>(QList(), QRect())); @@ -292,17 +296,14 @@ void AnimationEffect::prePaintScreen( ScreenPrePaintData& data, int time ) } } - // NOTICE PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS and thus now no flag should be required - // ... unless we start to get glitches ;-) -// if ( transformed ) -// data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS; //PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS; - // janitorial... - if ( !(d->m_animations.count() || d->m_zombies.isEmpty()) ) - { - foreach ( EffectWindow *w, d->m_zombies ) - w->unrefWindow(); - d->m_zombies.clear(); + if (d->m_animations.isEmpty()) { + disconnectGeometryChanges(); + if (!d->m_zombies.isEmpty()) { // this is actually not supposed to happen + foreach (EffectWindow *w, d->m_zombies) + w->unrefWindow(); + d->m_zombies.clear(); + } } effects->prePaintScreen(data, time); @@ -390,6 +391,16 @@ void AnimationEffect::clipWindow(const EffectWindow *w, const AniData &anim, Win } } +void AnimationEffect::disconnectGeometryChanges() +{ + disconnect (effects,SIGNAL(windowGeometryShapeChanged( KWin::EffectWindow*, const QRect&)), + this, SLOT(_expandedGeometryChanged( KWin::EffectWindow*, const QRect&))); + disconnect (effects,SIGNAL(windowStepUserMovedResized( KWin::EffectWindow*, const QRect&)), + this, SLOT(_expandedGeometryChanged( KWin::EffectWindow*, const QRect&))); + disconnect (effects,SIGNAL(windowPaddingChanged( KWin::EffectWindow*, const QRect&)), + this, SLOT(_expandedGeometryChanged( KWin::EffectWindow*, const QRect&))); +} + void AnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) { @@ -784,7 +795,6 @@ region_creation: void AnimationEffect::_expandedGeometryChanged(KWin::EffectWindow *w, const QRect &old) { - Q_UNUSED(old) Q_D(AnimationEffect); AniMap::const_iterator entry = d->m_animations.constFind(w); if (entry != d->m_animations.constEnd()) { diff --git a/libkwineffects/kwinanimationeffect.h b/libkwineffects/kwinanimationeffect.h index c6def67d87..c5e2d2d757 100644 --- a/libkwineffects/kwinanimationeffect.h +++ b/libkwineffects/kwinanimationeffect.h @@ -194,6 +194,7 @@ private: void clipWindow(const EffectWindow *, const AniData &, WindowQuadList &) const; float interpolated( const AniData&, int i = 0 ) const; float progress( const AniData& ) const; + void disconnectGeometryChanges(); void updateLayerRepaints(); private Q_SLOTS: void init();