Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinanimationeffect.h
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 35 | public: | |||
---|---|---|---|---|---|
83 | inline void set(float v) { f[0] = v; valid = true; } | 83 | inline void set(float v) { f[0] = v; valid = true; } | ||
84 | inline void set(float v1, float v2) { f[0] = v1; f[1] = v2; valid = true; } | 84 | inline void set(float v1, float v2) { f[0] = v1; f[1] = v2; valid = true; } | ||
85 | 85 | | |||
86 | private: | 86 | private: | ||
87 | float f[2]; | 87 | float f[2]; | ||
88 | bool valid; | 88 | bool valid; | ||
89 | }; | 89 | }; | ||
90 | 90 | | |||
91 | /** | ||||
92 | * Wraps effects->setActiveFullScreenEffect for the duration of it's lifespan | ||||
93 | */ | ||||
94 | class FullScreenEffectLock | ||||
95 | { | ||||
96 | public: | ||||
97 | FullScreenEffectLock(Effect *effect); | ||||
98 | ~FullScreenEffectLock(); | ||||
99 | private: | ||||
zzag: Maybe, we have to delete copy constructor and copy assignment.
IIRC, QSharedPointer doesn't… | |||||
100 | void *d; //unused currently | ||||
101 | }; | ||||
102 | typedef QSharedPointer<FullScreenEffectLock> FullScreenEffectLockPtr; | ||||
103 | | ||||
91 | class AniData; | 104 | class AniData; | ||
92 | class AnimationEffectPrivate; | 105 | class AnimationEffectPrivate; | ||
93 | class KWINEFFECTS_EXPORT AnimationEffect : public Effect | 106 | class KWINEFFECTS_EXPORT AnimationEffect : public Effect | ||
94 | { | 107 | { | ||
95 | Q_OBJECT | 108 | Q_OBJECT | ||
96 | Q_ENUMS(Anchor) | 109 | Q_ENUMS(Anchor) | ||
97 | Q_ENUMS(Attribute) | 110 | Q_ENUMS(Attribute) | ||
98 | Q_ENUMS(MetaType) | 111 | Q_ENUMS(MetaType) | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 166 | protected: | |||
156 | * @param w - The EffectWindow to manipulate | 169 | * @param w - The EffectWindow to manipulate | ||
157 | * @param a - The @enum Attribute to manipulate | 170 | * @param a - The @enum Attribute to manipulate | ||
158 | * @param meta - Basically a wildcard to carry various extra information, eg. the anchor, relativity or rotation axis. You will probably use require it when performing Generic animations. | 171 | * @param meta - Basically a wildcard to carry various extra information, eg. the anchor, relativity or rotation axis. You will probably use require it when performing Generic animations. | ||
159 | * @param ms - How long the transition will last | 172 | * @param ms - How long the transition will last | ||
160 | * @param to - The target value. FPx2 is an agnostic two component float type (like QPointF or QSizeF, but without requiring to be either and supporting an invalid state) | 173 | * @param to - The target value. FPx2 is an agnostic two component float type (like QPointF or QSizeF, but without requiring to be either and supporting an invalid state) | ||
161 | * @param shape - How the animation progresses, eg. Linear progresses constantly while Exponential start slow and becomes very fast in the end | 174 | * @param shape - How the animation progresses, eg. Linear progresses constantly while Exponential start slow and becomes very fast in the end | ||
162 | * @param delay - When the animation will start compared to "now" (the window will remain at the "from" position until then) | 175 | * @param delay - When the animation will start compared to "now" (the window will remain at the "from" position until then) | ||
163 | * @param from - the starting value, the default is invalid, ie. the attribute for the window is not transformed in the beginning | 176 | * @param from - the starting value, the default is invalid, ie. the attribute for the window is not transformed in the beginning | ||
164 | * @return an ID that you can use to cancel a running animation | 177 | * @return an ID that you can use to cancel a running animation | ||
zzag: Capitalize "sets" | |||||
165 | */ | 178 | */ | ||
166 | quint64 animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve = QEasingCurve(), int delay = 0, FPx2 from = FPx2() ) | 179 | quint64 animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve = QEasingCurve(), int delay = 0, FPx2 from = FPx2() ) | ||
167 | { return p_animate(w, a, meta, ms, to, curve, delay, from, false); } | 180 | { return p_animate(w, a, meta, ms, to, curve, delay, from, false, false); } | ||
181 | | ||||
182 | //TODO next ABI break, merge with above with an argument | ||||
183 | quint64 animateFullScreen( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve = QEasingCurve(), int delay = 0, FPx2 from = FPx2()) | ||||
That other thread made me think maybe I should just do this now and bump the ABI. Will simplify the scripted effect code. Opinions? davidedmundson: That other thread made me think maybe I should just do this now and bump the ABI. Will simplify… | |||||
Well, it's already bumped so 3rd-party effects have to be recompiled. I have nothing against that. :-) zzag: Well, it's already bumped so 3rd-party effects have to be recompiled.
I have nothing against… | |||||
184 | { return p_animate(w, a, meta, ms, to, curve, delay, from, false, true); } | ||||
168 | 185 | | |||
169 | /** | 186 | /** | ||
170 | * Equal to ::animate() with one important difference: | 187 | * Equal to ::animate() with one important difference: | ||
171 | * The target value for the attribute is kept until you ::cancel() this animation | 188 | * The target value for the attribute is kept until you ::cancel() this animation | ||
172 | * @return an ID that you need to use to cancel this manipulation | 189 | * @return an ID that you need to use to cancel this manipulation | ||
173 | */ | 190 | */ | ||
174 | quint64 set( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve = QEasingCurve(), int delay = 0, FPx2 from = FPx2() ) | 191 | quint64 set( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve = QEasingCurve(), int delay = 0, FPx2 from = FPx2() ) | ||
175 | { return p_animate(w, a, meta, ms, to, curve, delay, from, true); } | 192 | { return p_animate(w, a, meta, ms, to, curve, delay, from, true, false); } | ||
193 | | ||||
194 | quint64 setFullScreen( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve = QEasingCurve(), int delay = 0, FPx2 from = FPx2()) | ||||
195 | { return p_animate(w, a, meta, ms, to, curve, delay, from, true, true); } | ||||
176 | 196 | | |||
177 | /** | 197 | /** | ||
178 | * this allows to alter the target (but not type or curve) of a running animation | 198 | * this allows to alter the target (but not type or curve) of a running animation | ||
179 | * with the ID @param animationId | 199 | * with the ID @param animationId | ||
180 | * @param newTarget alters the "to" parameter of the animation | 200 | * @param newTarget alters the "to" parameter of the animation | ||
181 | * If @param newRemainingTime allows to lengthen (or shorten) the remaining time | 201 | * If @param newRemainingTime allows to lengthen (or shorten) the remaining time | ||
182 | * of the animation. By default (-1) the remaining time remains unchanged | 202 | * of the animation. By default (-1) the remaining time remains unchanged | ||
183 | * | 203 | * | ||
Show All 22 Lines | |||||
206 | */ | 226 | */ | ||
207 | virtual void genericAnimation( EffectWindow *w, WindowPaintData &data, float progress, uint meta ) | 227 | virtual void genericAnimation( EffectWindow *w, WindowPaintData &data, float progress, uint meta ) | ||
208 | {Q_UNUSED(w); Q_UNUSED(data); Q_UNUSED(progress); Q_UNUSED(meta);} | 228 | {Q_UNUSED(w); Q_UNUSED(data); Q_UNUSED(progress); Q_UNUSED(meta);} | ||
209 | 229 | | |||
210 | //Internal for unit tests | 230 | //Internal for unit tests | ||
211 | AniMap state() const; | 231 | AniMap state() const; | ||
212 | 232 | | |||
213 | private: | 233 | private: | ||
214 | quint64 p_animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve, int delay, FPx2 from, bool keepAtTarget ); | 234 | quint64 p_animate(EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve, int delay, FPx2 from, bool keepAtTarget , bool fullScreenEffect); | ||
zzag: please dlete extra space before comma | |||||
215 | QRect clipRect(const QRect &windowRect, const AniData&) const; | 235 | QRect clipRect(const QRect &windowRect, const AniData&) const; | ||
216 | void clipWindow(const EffectWindow *, const AniData &, WindowQuadList &) const; | 236 | void clipWindow(const EffectWindow *, const AniData &, WindowQuadList &) const; | ||
217 | float interpolated( const AniData&, int i = 0 ) const; | 237 | float interpolated( const AniData&, int i = 0 ) const; | ||
218 | float progress( const AniData& ) const; | 238 | float progress( const AniData& ) const; | ||
219 | void disconnectGeometryChanges(); | 239 | void disconnectGeometryChanges(); | ||
220 | void updateLayerRepaints(); | 240 | void updateLayerRepaints(); | ||
221 | void validate(Attribute a, uint &meta, FPx2 *from, FPx2 *to, const EffectWindow *w) const; | 241 | void validate(Attribute a, uint &meta, FPx2 *from, FPx2 *to, const EffectWindow *w) const; | ||
222 | private Q_SLOTS: | 242 | private Q_SLOTS: | ||
Show All 17 Lines |
Maybe, we have to delete copy constructor and copy assignment.
IIRC, QSharedPointer doesn't make copies of the pointed object so it should compile.