From 3fcce012c02f57aea959a458fa80e8bcd88d110a Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Fri, 20 Apr 2018 21:15:23 +0300 Subject: [PATCH] [effects/minimizeanimation] Don't reset timeline Summary: Resetting timeline while animating a window causes some visual "glitches", see videos below. Even though we can't use `QTimer::toggleDirection`, that's safe to delete code which resets timeline because `prePaintScreen` figures out correct direction of the timeline. Before {F5809862, layout=center, size=full} After {F5809898, layout=center, size=full} Reviewers: #kwin, davidedmundson Reviewed By: davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D12254 --- .../minimizeanimation/minimizeanimation.cpp | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/effects/minimizeanimation/minimizeanimation.cpp b/effects/minimizeanimation/minimizeanimation.cpp index 3d00d3235c..f240691118 100644 --- a/effects/minimizeanimation/minimizeanimation.cpp +++ b/effects/minimizeanimation/minimizeanimation.cpp @@ -125,30 +125,26 @@ void MinimizeAnimationEffect::slotWindowMinimized(EffectWindow* w) { if (effects->activeFullScreenEffect()) return; - QTimeLine *timeline; - if (mTimeLineWindows.contains(w)) { - timeline = mTimeLineWindows[w]; - } else { - timeline = new QTimeLine(animationTime(250), this); + + if (!mTimeLineWindows.contains(w)) { + auto *timeline = new QTimeLine(animationTime(250), this); + timeline->setCurrentTime(0); + timeline->setCurveShape(QTimeLine::EaseInOutCurve); mTimeLineWindows.insert(w, timeline); } - timeline->setCurveShape(QTimeLine::EaseInCurve); - timeline->setCurrentTime(0.0); } void MinimizeAnimationEffect::slotWindowUnminimized(EffectWindow* w) { if (effects->activeFullScreenEffect()) return; - QTimeLine *timeline; - if (mTimeLineWindows.contains(w)) { - timeline = mTimeLineWindows[w]; - } else { - timeline = new QTimeLine(animationTime(250), this); + + if (!mTimeLineWindows.contains(w)) { + auto *timeline = new QTimeLine(animationTime(250), this); + timeline->setCurrentTime(timeline->duration()); + timeline->setCurveShape(QTimeLine::EaseInOutCurve); mTimeLineWindows.insert(w, timeline); } - timeline->setCurveShape(QTimeLine::EaseInOutCurve); - timeline->setCurrentTime(timeline->duration()); } bool MinimizeAnimationEffect::isActive() const