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 45 Lines • ▼ Show 20 Line(s) | |||||
98 | Q_SCRIPTABLE bool registerScreenEdge(int edge, const QJSValue &callback); | 106 | Q_SCRIPTABLE bool registerScreenEdge(int edge, const QJSValue &callback); | ||
99 | Q_SCRIPTABLE bool unregisterScreenEdge(int edge); | 107 | Q_SCRIPTABLE bool unregisterScreenEdge(int edge); | ||
100 | Q_SCRIPTABLE bool registerTouchScreenEdge(int edge, const QJSValue &callback); | 108 | Q_SCRIPTABLE bool registerTouchScreenEdge(int edge, const QJSValue &callback); | ||
101 | Q_SCRIPTABLE bool unregisterTouchScreenEdge(int edge); | 109 | Q_SCRIPTABLE bool unregisterTouchScreenEdge(int edge); | ||
102 | 110 | | |||
103 | QHash<int, QList<QJSValue > > &screenEdgeCallbacks() { | 111 | QHash<int, QList<QJSValue > > &screenEdgeCallbacks() { | ||
104 | return m_screenEdgeCallbacks; | 112 | return m_screenEdgeCallbacks; | ||
105 | } | 113 | } | ||
114 | | ||||
115 | 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. | |||||
116 | | ||||
106 | public Q_SLOTS: | 117 | public Q_SLOTS: | ||
107 | 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); | 118 | 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); | ||
108 | QJSValue animate(const QJSValue &object); | 119 | QJSValue animate(const QJSValue &object); | ||
109 | 120 | | |||
110 | 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); | 121 | 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... | |||||
111 | QJSValue set(const QJSValue &object); | 122 | QJSValue set(const QJSValue &object); | ||
112 | 123 | | |||
113 | bool retarget(int animationId, const QJSValue &newTarget, int newRemainingTime = -1); | 124 | bool retarget(int animationId, const QJSValue &newTarget, int newRemainingTime = -1); | ||
114 | bool retarget(const QList<int> &animationIds, const QJSValue &newTarget, int newRemainingTime = -1); | 125 | bool retarget(const QList<int> &animationIds, const QJSValue &newTarget, int newRemainingTime = -1); | ||
115 | 126 | | |||
116 | bool cancel(int animationId); | 127 | bool cancel(int animationId); | ||
117 | bool cancel(const QList<int> &animationIds); | 128 | bool cancel(const QList<int> &animationIds); | ||
118 | 129 | | |||
119 | bool borderActivated(ElectricBorder border) override; | 130 | bool borderActivated(ElectricBorder border) override; | ||
120 | 131 | | |||
121 | Q_SIGNALS: | 132 | Q_SIGNALS: | ||
122 | /** | 133 | /** | ||
123 | * Signal emitted whenever the effect's config changed. | 134 | * Signal emitted whenever the effect's config changed. | ||
124 | **/ | 135 | **/ | ||
125 | void configChanged(); | 136 | void configChanged(); | ||
126 | void animationEnded(KWin::EffectWindow *w, int animationId); | 137 | void animationEnded(KWin::EffectWindow *w, int animationId); | ||
138 | void activeFullScreenEffectChanged(); | ||||
zzag: Is it emitted anymore? | |||||
127 | 139 | | |||
128 | protected: | 140 | protected: | ||
129 | ScriptedEffect(); | 141 | ScriptedEffect(); | ||
130 | QJSEngine *engine() const; | 142 | QJSEngine *engine() const; | ||
131 | bool init(const QString &effectName, const QString &pathToScript); | 143 | bool init(const QString &effectName, const QString &pathToScript); | ||
132 | void animationEnded(KWin::EffectWindow *w, Attribute a, uint meta); | 144 | void animationEnded(KWin::EffectWindow *w, Attribute a, uint meta); | ||
133 | 145 | | |||
134 | private: | 146 | private: | ||
135 | //wrapper round animateGlobal/setGlobal that parses the animations blob. | 147 | //wrapper round animateGlobal/setGlobal that parses the animations blob. | ||
136 | QJSValue startAnimation(const QJSValue &object, bool settingPersists); | 148 | QJSValue startAnimation(const QJSValue &object, bool settingPersists); | ||
137 | QJSValue createError(const QString &errorMessage); | 149 | QJSValue createError(const QString &errorMessage); | ||
138 | QJSEngine *m_engine; | 150 | QJSEngine *m_engine; | ||
139 | QString m_effectName; | 151 | QString m_effectName; | ||
140 | QString m_scriptFile; | 152 | QString m_scriptFile; | ||
141 | QHash<int, QList<QJSValue> > m_screenEdgeCallbacks; | 153 | QHash<int, QList<QJSValue> > m_screenEdgeCallbacks; | ||
142 | KConfigLoader *m_config; | 154 | KConfigLoader *m_config; | ||
143 | int m_chainPosition; | 155 | int m_chainPosition; | ||
144 | QHash<int, QAction*> m_touchScreenEdgeCallbacks; | 156 | QHash<int, QAction*> m_touchScreenEdgeCallbacks; | ||
145 | }; | 157 | }; | ||
zzag: Please put whitespace before `*`. | |||||
146 | 158 | | |||
147 | } | 159 | } | ||
148 | 160 | | |||
149 | #endif // KWIN_SCRIPTEDEFFECT_H | 161 | #endif // KWIN_SCRIPTEDEFFECT_H |
Leftover.