ScriptedEffect: gauss curve anim and ended signal
latter allows to chain actions in scripted effects and former prevents the need to do that for a continuous in/out animation
This commit is contained in:
parent
0103b0fee6
commit
83a42c55be
2 changed files with 26 additions and 2 deletions
|
@ -498,6 +498,12 @@ bool ScriptedEffect::init(const QString &effectName, const QString &pathToScript
|
|||
return true;
|
||||
}
|
||||
|
||||
void ScriptedEffect::animationEnded(KWin::EffectWindow *w, Attribute a, uint meta)
|
||||
{
|
||||
AnimationEffect::animationEnded(w, a, meta);
|
||||
emit animationEnded(w, 0);
|
||||
}
|
||||
|
||||
void ScriptedEffect::signalHandlerException(const QScriptValue &value)
|
||||
{
|
||||
if (value.isError()) {
|
||||
|
@ -514,12 +520,22 @@ void ScriptedEffect::signalHandlerException(const QScriptValue &value)
|
|||
|
||||
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)
|
||||
{
|
||||
return AnimationEffect::animate(w, a, metaData, ms, to, QEasingCurve(curve), delay, from);
|
||||
QEasingCurve qec;
|
||||
if (curve < QEasingCurve::Custom)
|
||||
qec.setType(curve);
|
||||
else if (static_cast<int>(curve) == static_cast<int>(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)
|
||||
{
|
||||
return AnimationEffect::set(w, a, metaData, ms, to, QEasingCurve(curve), delay, from);
|
||||
QEasingCurve qec;
|
||||
if (curve < QEasingCurve::Custom)
|
||||
qec.setType(curve);
|
||||
else if (static_cast<int>(curve) == static_cast<int>(GaussianCurve))
|
||||
qec.setCustomType(qecGaussian);
|
||||
return AnimationEffect::set(w, a, metaData, ms, to, qec, delay, from);
|
||||
}
|
||||
|
||||
bool ScriptedEffect::isGrabbed(EffectWindow* w, ScriptedEffect::DataRole grabRole)
|
||||
|
|
|
@ -37,6 +37,7 @@ class ScriptedEffect : public KWin::AnimationEffect
|
|||
Q_ENUMS(Qt::Axis)
|
||||
Q_ENUMS(Anchor)
|
||||
Q_ENUMS(MetaType)
|
||||
Q_ENUMS(EasingCurve)
|
||||
public:
|
||||
// copied from kwineffects.h
|
||||
enum DataRole {
|
||||
|
@ -52,6 +53,9 @@ public:
|
|||
WindowBackgroundContrastRole, ///< For single windows to enable Background contrast
|
||||
LanczosCacheRole
|
||||
};
|
||||
enum EasingCurve {
|
||||
GaussianCurve = 128
|
||||
};
|
||||
const QString &scriptFile() const {
|
||||
return m_scriptFile;
|
||||
}
|
||||
|
@ -97,6 +101,10 @@ Q_SIGNALS:
|
|||
* Signal emitted whenever the effect's config changed.
|
||||
**/
|
||||
void configChanged();
|
||||
void animationEnded(KWin::EffectWindow *w, quint64 animationId);
|
||||
|
||||
protected:
|
||||
void animationEnded(KWin::EffectWindow *w, Attribute a, uint meta);
|
||||
|
||||
private Q_SLOTS:
|
||||
void signalHandlerException(const QScriptValue &value);
|
||||
|
|
Loading…
Reference in a new issue