From 5e6f0b8b4fc3b896fe0350dc8a94d65c68053875 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 10 Feb 2016 16:55:22 +0100 Subject: [PATCH] make animate() return something JS understands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the result of animate is an array of animids: in order for dumb QScript to understand what it is, we have to build it as an actual JavaScript Array reviewed-by: Martin Gräßlin --- scripting/scriptedeffect.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripting/scriptedeffect.cpp b/scripting/scriptedeffect.cpp index 7ab065b908..2d6537fe08 100644 --- a/scripting/scriptedeffect.cpp +++ b/scripting/scriptedeffect.cpp @@ -262,9 +262,10 @@ QScriptValue kwinEffectAnimate(QScriptContext *context, QScriptEngine *engine) return engine->undefinedValue(); } - QList animIds; + QScriptValue array = engine->newArray(settings.length()); + int i = 0; foreach (const AnimationSettings &setting, settings) { - animIds << QVariant(effect->animate(window, + array.setProperty(i, (uint)effect->animate(window, setting.type, setting.duration, setting.to, @@ -272,8 +273,9 @@ QScriptValue kwinEffectAnimate(QScriptContext *context, QScriptEngine *engine) setting.metaData, setting.curve, setting.delay)); + ++i; } - return engine->newVariant(animIds); + return array; } QScriptValue kwinEffectSet(QScriptContext *context, QScriptEngine *engine)