Changeset View
Changeset View
Standalone View
Standalone View
scripting/scriptedeffect.h
Show All 35 Lines | |||||
36 | class KWIN_EXPORT ScriptedEffect : public KWin::AnimationEffect | 36 | class KWIN_EXPORT ScriptedEffect : public KWin::AnimationEffect | ||
37 | { | 37 | { | ||
38 | Q_OBJECT | 38 | Q_OBJECT | ||
39 | Q_ENUMS(DataRole) | 39 | Q_ENUMS(DataRole) | ||
40 | Q_ENUMS(Qt::Axis) | 40 | Q_ENUMS(Qt::Axis) | ||
41 | Q_ENUMS(Anchor) | 41 | Q_ENUMS(Anchor) | ||
42 | Q_ENUMS(MetaType) | 42 | Q_ENUMS(MetaType) | ||
43 | Q_ENUMS(EasingCurve) | 43 | Q_ENUMS(EasingCurve) | ||
44 | Q_ENUMS(ActiveFullScreenEffectState) | ||||
zzag: Leftover. | |||||
zzag: Please delete this one. | |||||
45 | Q_PROPERTY(ActiveFullScreenEffectState fullScreenEffectState READ fullScreenEffectState NOTIFY activeFullScreenEffectChanged) | ||||
zzag: ```
/**
*
**/
``` | |||||
44 | public: | 46 | public: | ||
47 | enum ActiveFullScreenEffectState { | ||||
48 | InactiveFullScreenEffect, ///< ActiveFullScreenEffect is null | ||||
zzag: Please put a whitespace between `//` and text. | |||||
49 | OwnedFullScreenEffect, ///< ActiveFullScreenEffect is us | ||||
50 | ActiveFullScreenEffect, ///< ActiveFullScreenEffect is someone else | ||||
51 | }; | ||||
52 | | ||||
45 | // copied from kwineffects.h | 53 | // copied from kwineffects.h | ||
46 | enum DataRole { | 54 | enum DataRole { | ||
47 | // Grab roles are used to force all other animations to ignore the window. | 55 | // Grab roles are used to force all other animations to ignore the window. | ||
48 | // The value of the data is set to the Effect's `this` value. | 56 | // The value of the data is set to the Effect's `this` value. | ||
49 | WindowAddedGrabRole = 1, | 57 | WindowAddedGrabRole = 1, | ||
50 | WindowClosedGrabRole, | 58 | WindowClosedGrabRole, | ||
51 | WindowMinimizedGrabRole, | 59 | WindowMinimizedGrabRole, | ||
52 | WindowUnminimizedGrabRole, | 60 | WindowUnminimizedGrabRole, | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
104 | void print(const QStringList &args); | 112 | void print(const QStringList &args); | ||
105 | Q_SCRIPTABLE void print(const QString &a1, const QString &a2=QString(), const QString &a3=QString(), const QString &a4=QString(), const QString &a5=QString(), const QString &a6=QString(), const QString &a7=QString()) { | 113 | Q_SCRIPTABLE void print(const QString &a1, const QString &a2=QString(), const QString &a3=QString(), const QString &a4=QString(), const QString &a5=QString(), const QString &a6=QString(), const QString &a7=QString()) { | ||
106 | print({a1, a2, a3, a4, a5, a6, a7}); | 114 | print({a1, a2, a3, a4, a5, a6, a7}); | ||
107 | } | 115 | } | ||
108 | 116 | | |||
109 | QHash<int, QList<QJSValue > > &screenEdgeCallbacks() { | 117 | QHash<int, QList<QJSValue > > &screenEdgeCallbacks() { | ||
110 | return m_screenEdgeCallbacks; | 118 | return m_screenEdgeCallbacks; | ||
111 | } | 119 | } | ||
120 | | ||||
121 | ActiveFullScreenEffectState fullScreenEffectState() const; | ||||
Nitpick: please add empty line between fullScreenEffectState() and public Q_SLOTS. zzag: Nitpick: please add empty line between fullScreenEffectState() and public Q_SLOTS. | |||||
122 | | ||||
112 | public Q_SLOTS: | 123 | public Q_SLOTS: | ||
113 | int animate(KWin::EffectWindow *w, Attribute a, int ms, const QJSValue &to, const QJSValue &from = QJSValue(), uint metaData = 0, int curve = QEasingCurve::Linear, int delay = 0); | 124 | int animate(KWin::EffectWindow *w, Attribute a, int ms, const QJSValue &to, const QJSValue &from = QJSValue(), uint metaData = 0, int curve = QEasingCurve::Linear, int delay = 0, bool fullScreen = false); | ||
114 | QJSValue animate(const QJSValue &object); | 125 | QJSValue animate(const QJSValue &object); | ||
115 | 126 | | |||
116 | int set(KWin::EffectWindow *w, Attribute a, int ms, const QJSValue &to, const QJSValue &from = QJSValue(), uint metaData = 0, int curve = QEasingCurve::Linear, int delay = 0); | 127 | int set(KWin::EffectWindow *w, Attribute a, int ms, const QJSValue &to, const QJSValue &from = QJSValue(), uint metaData = 0, int curve = QEasingCurve::Linear, int delay = 0, bool fullScreen = false); | ||
zzag: It would be great to add @since but other fields don't have that... | |||||
117 | QJSValue set(const QJSValue &object); | 128 | QJSValue set(const QJSValue &object); | ||
118 | 129 | | |||
119 | bool retarget(int animationId, const QJSValue &newTarget, int newRemainingTime = -1); | 130 | bool retarget(int animationId, const QJSValue &newTarget, int newRemainingTime = -1); | ||
120 | bool retarget(QList<int> animationIds, const QJSValue &newTarget, int newRemainingTime = -1); | 131 | bool retarget(QList<int> animationIds, const QJSValue &newTarget, int newRemainingTime = -1); | ||
121 | 132 | | |||
122 | bool cancel(int animationId); | 133 | bool cancel(int animationId); | ||
123 | bool cancel(QList<int> animationIds); | 134 | bool cancel(QList<int> animationIds); | ||
124 | 135 | | |||
125 | bool borderActivated(ElectricBorder border) override; | 136 | bool borderActivated(ElectricBorder border) override; | ||
126 | 137 | | |||
127 | Q_SIGNALS: | 138 | Q_SIGNALS: | ||
128 | /** | 139 | /** | ||
129 | * Signal emitted whenever the effect's config changed. | 140 | * Signal emitted whenever the effect's config changed. | ||
130 | **/ | 141 | **/ | ||
131 | void configChanged(); | 142 | void configChanged(); | ||
132 | void animationEnded(KWin::EffectWindow *w, int animationId); | 143 | void animationEnded(KWin::EffectWindow *w, int animationId); | ||
144 | void activeFullScreenEffectChanged(); | ||||
zzag: Is it emitted anymore? | |||||
133 | 145 | | |||
134 | protected: | 146 | protected: | ||
135 | ScriptedEffect(); | 147 | ScriptedEffect(); | ||
136 | QJSEngine *engine() const; | 148 | QJSEngine *engine() const; | ||
137 | bool init(const QString &effectName, const QString &pathToScript); | 149 | bool init(const QString &effectName, const QString &pathToScript); | ||
138 | void animationEnded(KWin::EffectWindow *w, Attribute a, uint meta); | 150 | void animationEnded(KWin::EffectWindow *w, Attribute a, uint meta); | ||
139 | 151 | | |||
140 | private: | 152 | private: | ||
141 | //wrapper round animateGlobal/setGlobal that parses the animations blob. | 153 | //wrapper round animateGlobal/setGlobal that parses the animations blob. | ||
142 | QJSValue startAnimation(const QJSValue &object, bool settingPersists); | 154 | QJSValue startAnimation(const QJSValue &object, bool settingPersists); | ||
143 | QJSValue createError(const QString &errorMessage); | 155 | QJSValue createError(const QString &errorMessage); | ||
144 | QJSEngine *m_engine; | 156 | QJSEngine *m_engine; | ||
145 | QString m_effectName; | 157 | QString m_effectName; | ||
146 | QString m_scriptFile; | 158 | QString m_scriptFile; | ||
147 | QHash<int, QList<QJSValue> > m_screenEdgeCallbacks; | 159 | QHash<int, QList<QJSValue> > m_screenEdgeCallbacks; | ||
148 | KConfigLoader *m_config; | 160 | KConfigLoader *m_config; | ||
149 | int m_chainPosition; | 161 | int m_chainPosition; | ||
150 | QHash<int, QAction*> m_touchScreenEdgeCallbacks; | 162 | QHash<int, QAction*> m_touchScreenEdgeCallbacks; | ||
151 | }; | 163 | }; | ||
zzag: Please put whitespace before `*`. | |||||
152 | 164 | | |||
153 | 165 | | |||
154 | } | 166 | } | ||
155 | 167 | | |||
156 | #endif // KWIN_SCRIPTEDEFFECT_H | 168 | #endif // KWIN_SCRIPTEDEFFECT_H |
Leftover.