make animate() return something JS understands

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 <mgraesslin@kde.org>
This commit is contained in:
Marco Martin 2016-02-10 16:55:22 +01:00
parent 7ccca92c3e
commit 5e6f0b8b4f

View file

@ -262,9 +262,10 @@ QScriptValue kwinEffectAnimate(QScriptContext *context, QScriptEngine *engine)
return engine->undefinedValue();
}
QList<QVariant> 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)