Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinanimationeffect.cpp
Show All 39 Lines | |||||
40 | public: | 40 | public: | ||
41 | AnimationEffectPrivate() | 41 | AnimationEffectPrivate() | ||
42 | { | 42 | { | ||
43 | m_animated = m_damageDirty = m_animationsTouched = m_isInitialized = false; | 43 | m_animated = m_damageDirty = m_animationsTouched = m_isInitialized = false; | ||
44 | m_justEndedAnimation = 0; | 44 | m_justEndedAnimation = 0; | ||
45 | } | 45 | } | ||
46 | AnimationEffect::AniMap m_animations; | 46 | AnimationEffect::AniMap m_animations; | ||
47 | EffectWindowList m_zombies; | 47 | EffectWindowList m_zombies; | ||
48 | bool m_animated, m_damageDirty, m_needSceneRepaint, m_animationsTouched, m_isInitialized; | | |||
49 | quint64 m_justEndedAnimation; // protect against cancel | | |||
zzag: Looks like unrelated change. | |||||
50 | static quint64 m_animCounter; | 48 | static quint64 m_animCounter; | ||
49 | quint64 m_justEndedAnimation; // protect against cancel | ||||
50 | QWeakPointer<FullScreenEffectLock> m_fullScreenEffectLock; | ||||
51 | bool m_animated, m_damageDirty, m_needSceneRepaint, m_animationsTouched, m_isInitialized; | ||||
51 | }; | 52 | }; | ||
52 | } | 53 | } | ||
53 | 54 | | |||
54 | using namespace KWin; | 55 | using namespace KWin; | ||
55 | 56 | | |||
56 | quint64 AnimationEffectPrivate::m_animCounter = 0; | 57 | quint64 AnimationEffectPrivate::m_animCounter = 0; | ||
57 | 58 | | |||
58 | AnimationEffect::AnimationEffect() : d_ptr(new AnimationEffectPrivate()) | 59 | AnimationEffect::AnimationEffect() : d_ptr(new AnimationEffectPrivate()) | ||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 211 | if (from && !from->isValid()) { | |||
211 | from->set(0.0); | 212 | from->set(0.0); | ||
212 | } | 213 | } | ||
213 | if (to && !to->isValid()) { | 214 | if (to && !to->isValid()) { | ||
214 | to->set(1.0); | 215 | to->set(1.0); | ||
215 | } | 216 | } | ||
216 | } | 217 | } | ||
217 | } | 218 | } | ||
218 | 219 | | |||
219 | quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve, int delay, FPx2 from, bool keepAtTarget ) | 220 | quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve, int delay, FPx2 from, bool keepAtTarget, bool fullScreenEffect) | ||
220 | { | 221 | { | ||
221 | const bool waitAtSource = from.isValid(); | 222 | const bool waitAtSource = from.isValid(); | ||
222 | validate(a, meta, &from, &to, w); | 223 | validate(a, meta, &from, &to, w); | ||
223 | if (a == CrossFadePrevious) | 224 | if (a == CrossFadePrevious) | ||
224 | w->referencePreviousWindowPixmap(); | 225 | w->referencePreviousWindowPixmap(); | ||
225 | 226 | | |||
226 | Q_D(AnimationEffect); | 227 | Q_D(AnimationEffect); | ||
227 | if (!d->m_isInitialized) | 228 | if (!d->m_isInitialized) | ||
228 | init(); // needs to ensure the window gets removed if deleted in the same event cycle | 229 | init(); // needs to ensure the window gets removed if deleted in the same event cycle | ||
229 | if (d->m_animations.isEmpty()) { | 230 | if (d->m_animations.isEmpty()) { | ||
230 | connect (effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), | 231 | connect (effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), | ||
231 | SLOT(_expandedGeometryChanged(KWin::EffectWindow*,QRect))); | 232 | SLOT(_expandedGeometryChanged(KWin::EffectWindow*,QRect))); | ||
232 | connect (effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), | 233 | connect (effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), | ||
233 | SLOT(_expandedGeometryChanged(KWin::EffectWindow*,QRect))); | 234 | SLOT(_expandedGeometryChanged(KWin::EffectWindow*,QRect))); | ||
234 | connect (effects, SIGNAL(windowPaddingChanged(KWin::EffectWindow*,QRect)), | 235 | connect (effects, SIGNAL(windowPaddingChanged(KWin::EffectWindow*,QRect)), | ||
235 | SLOT(_expandedGeometryChanged(KWin::EffectWindow*,QRect))); | 236 | SLOT(_expandedGeometryChanged(KWin::EffectWindow*,QRect))); | ||
236 | } | 237 | } | ||
237 | AniMap::iterator it = d->m_animations.find(w); | 238 | AniMap::iterator it = d->m_animations.find(w); | ||
238 | if (it == d->m_animations.end()) | 239 | if (it == d->m_animations.end()) | ||
239 | it = d->m_animations.insert(w, QPair<QList<AniData>, QRect>(QList<AniData>(), QRect())); | 240 | it = d->m_animations.insert(w, QPair<QList<AniData>, QRect>(QList<AniData>(), QRect())); | ||
240 | it->first.append(AniData(a, meta, ms, to, curve, delay, from, waitAtSource, keepAtTarget)); | 241 | | ||
242 | FullScreenEffectLockPtr fullscreen; | ||||
243 | if (fullScreenEffect) { | ||||
244 | if (d->m_fullScreenEffectLock.isNull()) { | ||||
245 | fullscreen = FullScreenEffectLockPtr::create(this); | ||||
Can we use the create method? e.g. fullScreenLock = FullScreenEffectLockPtr::create(this); zzag: Can we use the create method? e.g.
```lang=cpp
fullScreenLock = FullScreenEffectLockPtr… | |||||
246 | d->m_fullScreenEffectLock = fullscreen.toWeakRef(); | ||||
247 | } else { | ||||
248 | fullscreen = d->m_fullScreenEffectLock.toStrongRef(); | ||||
249 | } | ||||
250 | } | ||||
251 | it->first.append(AniData(a, meta, ms, to, curve, delay, from, waitAtSource, keepAtTarget, fullscreen)); | ||||
241 | quint64 ret_id = ++d->m_animCounter; | 252 | quint64 ret_id = ++d->m_animCounter; | ||
242 | it->first.last().id = ret_id; | 253 | it->first.last().id = ret_id; | ||
243 | it->second = QRect(); | 254 | it->second = QRect(); | ||
244 | 255 | | |||
245 | d->m_animationsTouched = true; | 256 | d->m_animationsTouched = true; | ||
246 | 257 | | |||
247 | if (delay > 0) { | 258 | if (delay > 0) { | ||
248 | QTimer::singleShot(delay, this, SLOT(triggerRepaint())); | 259 | QTimer::singleShot(delay, this, SLOT(triggerRepaint())); | ||
▲ Show 20 Lines • Show All 700 Lines • ▼ Show 20 Line(s) | |||||
949 | } | 960 | } | ||
950 | 961 | | |||
951 | AnimationEffect::AniMap AnimationEffect::state() const | 962 | AnimationEffect::AniMap AnimationEffect::state() const | ||
952 | { | 963 | { | ||
953 | Q_D(const AnimationEffect); | 964 | Q_D(const AnimationEffect); | ||
954 | return d->m_animations; | 965 | return d->m_animations; | ||
955 | } | 966 | } | ||
956 | 967 | | |||
968 | FullScreenEffectLock::FullScreenEffectLock(Effect *effect) | ||||
969 | { | ||||
970 | effects->setActiveFullScreenEffect(effect); | ||||
971 | } | ||||
972 | | ||||
973 | FullScreenEffectLock::~FullScreenEffectLock() | ||||
974 | { | ||||
975 | effects->setActiveFullScreenEffect(nullptr); | ||||
976 | } | ||||
957 | 977 | | |||
958 | #include "moc_kwinanimationeffect.cpp" | 978 | #include "moc_kwinanimationeffect.cpp" |
Looks like unrelated change.