From cac8ff3072548cf692a9d5560819a8498ed3aa20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Tue, 6 May 2008 23:03:23 +0000 Subject: [PATCH] Make sure m_Progress is always double. Fixes restoring of windows for me. Minimizing still doesn't animate here. :/ If someone sees the same problem, please let me know. There also seems to be something fishy with the desktopgrid -- it's not showing windows on inactive desktops, sliding animation and the grid-zoomout expose this. svn path=/trunk/KDE/kdebase/workspace/; revision=804806 --- lib/kwineffects.cpp | 11 ++++++++--- lib/kwineffects.h | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/kwineffects.cpp b/lib/kwineffects.cpp index 9497b4773c..444c106f5a 100644 --- a/lib/kwineffects.cpp +++ b/lib/kwineffects.cpp @@ -925,19 +925,19 @@ double TimeLine::valueForTime(const int msec) const void TimeLine::addTime(const int msec) { m_Time = qMin(m_Duration, m_Time + msec); - m_Progress = m_Time / m_Duration; + m_Progress = (double)m_Time / m_Duration; } void TimeLine::removeTime(const int msec) { m_Time = qMax(0, m_Time - msec); - m_Progress = m_Time / m_Duration; + m_Progress = (double)m_Time / m_Duration; } void TimeLine::setProgress(const double progress) { m_Progress = progress; - m_Time = (int)(m_Duration * progress); + m_Time = qRound(m_Duration * progress); } double TimeLine::progress() const @@ -945,6 +945,11 @@ double TimeLine::progress() const return m_Progress; } +int TimeLine::time() const + { + return m_Time; + } + void TimeLine::addProgress(const double progress) { m_Progress += progress; diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 8ffb1cf679..737111e80e 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -1084,6 +1084,11 @@ class KWIN_EXPORT TimeLine * and related methods, the y value of the current state x. */ double valueForTime(const int msec) const; + /** + * Returns the current time of the TimeLine, between 0 and duration() + * The value returned is equivalent to the x-axis on a curve. + */ + int time() const; /** * Returns the progress of the TimeLine, between 0.0 and 1.0. * The value returned is equivalent to the y-axis on a curve.