diff --git a/autotests/integration/effects/scripted_effects_test.cpp b/autotests/integration/effects/scripted_effects_test.cpp --- a/autotests/integration/effects/scripted_effects_test.cpp +++ b/autotests/integration/effects/scripted_effects_test.cpp @@ -291,6 +291,7 @@ QCOMPARE(animationsForWindow[0].duration, 100); QCOMPARE(animationsForWindow[0].to, FPx2(1.4)); QCOMPARE(animationsForWindow[0].attribute, AnimationEffect::Scale); + QCOMPARE(animationsForWindow[0].curve.type(), QEasingCurve::OutQuad); QCOMPARE(animationsForWindow[0].keepAtTarget, false); timePassed = animationsForWindow[0].time; if (animationCount == 2) { diff --git a/autotests/integration/effects/scripts/animationTest.js b/autotests/integration/effects/scripts/animationTest.js --- a/autotests/integration/effects/scripts/animationTest.js +++ b/autotests/integration/effects/scripts/animationTest.js @@ -1,5 +1,5 @@ effects.windowAdded.connect(function(w) { - w.anim1 = effect.animate(w, Effect.Scale, 100, 1.4, 0.2); + w.anim1 = effect.animate(w, Effect.Scale, 100, 1.4, 0.2, 0, QEasingCurve.OutQuad); sendTestResponse(typeof(w.anim1) == "number"); }); diff --git a/autotests/integration/effects/scripts/animationTestMulti.js b/autotests/integration/effects/scripts/animationTestMulti.js --- a/autotests/integration/effects/scripts/animationTestMulti.js +++ b/autotests/integration/effects/scripts/animationTestMulti.js @@ -4,11 +4,11 @@ duration: 100, animations: [{ type: Effect.Scale, - curve: Effect.GaussianCurve, - to: 1.4 + to: 1.4, + curve: QEasingCurve.OutQuad }, { type: Effect.Opacity, - curve: Effect.GaussianCurve, + curve: QEasingCurve.OutQuad, to: 0.0 }] }); diff --git a/scripting/scriptedeffect.h b/scripting/scriptedeffect.h --- a/scripting/scriptedeffect.h +++ b/scripting/scriptedeffect.h @@ -95,8 +95,9 @@ bool unregisterTouchScreenCallback(int edge); public Q_SLOTS: - quint64 animate(KWin::EffectWindow *w, Attribute a, int ms, KWin::FPx2 to, KWin::FPx2 from = KWin::FPx2(), uint metaData = 0, QEasingCurve::Type curve = QEasingCurve::Linear, int delay = 0); - quint64 set(KWin::EffectWindow *w, Attribute a, int ms, KWin::FPx2 to, KWin::FPx2 from = KWin::FPx2(), uint metaData = 0, QEasingCurve::Type curve = QEasingCurve::Linear, int delay = 0); + //curve should be of type QEasingCurve::type or ScriptedEffect::EasingCurve + quint64 animate(KWin::EffectWindow *w, Attribute a, int ms, KWin::FPx2 to, KWin::FPx2 from = KWin::FPx2(), uint metaData = 0, int curve = QEasingCurve::Linear, int delay = 0); + quint64 set(KWin::EffectWindow *w, Attribute a, int ms, KWin::FPx2 to, KWin::FPx2 from = KWin::FPx2(), uint metaData = 0, int curve = QEasingCurve::Linear, int delay = 0); bool retarget(quint64 animationId, KWin::FPx2 newTarget, int newRemainingTime = -1); bool cancel(quint64 animationId) { return AnimationEffect::cancel(animationId); } virtual bool borderActivated(ElectricBorder border); diff --git a/scripting/scriptedeffect.cpp b/scripting/scriptedeffect.cpp --- a/scripting/scriptedeffect.cpp +++ b/scripting/scriptedeffect.cpp @@ -581,22 +581,22 @@ } } -quint64 ScriptedEffect::animate(KWin::EffectWindow* w, KWin::AnimationEffect::Attribute a, int ms, KWin::FPx2 to, KWin::FPx2 from, uint metaData, QEasingCurve::Type curve, int delay) +quint64 ScriptedEffect::animate(KWin::EffectWindow* w, KWin::AnimationEffect::Attribute a, int ms, KWin::FPx2 to, KWin::FPx2 from, uint metaData, int curve, int delay) { QEasingCurve qec; if (curve < QEasingCurve::Custom) - qec.setType(curve); - else if (static_cast(curve) == static_cast(GaussianCurve)) + qec.setType(static_cast(curve)); + else if (curve == GaussianCurve) qec.setCustomType(qecGaussian); return AnimationEffect::animate(w, a, metaData, ms, to, qec, delay, from); } -quint64 ScriptedEffect::set(KWin::EffectWindow* w, KWin::AnimationEffect::Attribute a, int ms, KWin::FPx2 to, KWin::FPx2 from, uint metaData, QEasingCurve::Type curve, int delay) +quint64 ScriptedEffect::set(KWin::EffectWindow* w, KWin::AnimationEffect::Attribute a, int ms, KWin::FPx2 to, KWin::FPx2 from, uint metaData, int curve, int delay) { QEasingCurve qec; if (curve < QEasingCurve::Custom) - qec.setType(curve); - else if (static_cast(curve) == static_cast(GaussianCurve)) + qec.setType(static_cast(curve)); + else if (curve == GaussianCurve) qec.setCustomType(qecGaussian); return AnimationEffect::set(w, a, metaData, ms, to, qec, delay, from); }