Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinanimationeffect.cpp
Show First 20 Lines • Show All 214 Lines • ▼ Show 20 Line(s) | 209 | } else if (a == CrossFadePrevious) { | |||
---|---|---|---|---|---|
215 | } | 215 | } | ||
216 | } | 216 | } | ||
217 | } | 217 | } | ||
218 | 218 | | |||
219 | quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve, int delay, FPx2 from, bool keepAtTarget, bool fullScreenEffect, bool keepAlive) | 219 | quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve, int delay, FPx2 from, bool keepAtTarget, bool fullScreenEffect, bool keepAlive) | ||
220 | { | 220 | { | ||
221 | const bool waitAtSource = from.isValid(); | 221 | const bool waitAtSource = from.isValid(); | ||
222 | validate(a, meta, &from, &to, w); | 222 | validate(a, meta, &from, &to, w); | ||
223 | if (a == CrossFadePrevious) | | |||
224 | w->referencePreviousWindowPixmap(); | | |||
225 | 223 | | |||
226 | Q_D(AnimationEffect); | 224 | Q_D(AnimationEffect); | ||
227 | if (!d->m_isInitialized) | 225 | if (!d->m_isInitialized) | ||
228 | init(); // needs to ensure the window gets removed if deleted in the same event cycle | 226 | init(); // needs to ensure the window gets removed if deleted in the same event cycle | ||
229 | if (d->m_animations.isEmpty()) { | 227 | if (d->m_animations.isEmpty()) { | ||
230 | connect (effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), | 228 | connect (effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), | ||
231 | SLOT(_expandedGeometryChanged(KWin::EffectWindow*,QRect))); | 229 | SLOT(_expandedGeometryChanged(KWin::EffectWindow*,QRect))); | ||
232 | connect (effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), | 230 | connect (effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), | ||
Show All 9 Lines | |||||
242 | if (fullScreenEffect) { | 240 | if (fullScreenEffect) { | ||
243 | if (d->m_fullScreenEffectLock.isNull()) { | 241 | if (d->m_fullScreenEffectLock.isNull()) { | ||
244 | fullscreen = FullScreenEffectLockPtr::create(this); | 242 | fullscreen = FullScreenEffectLockPtr::create(this); | ||
245 | d->m_fullScreenEffectLock = fullscreen.toWeakRef(); | 243 | d->m_fullScreenEffectLock = fullscreen.toWeakRef(); | ||
246 | } else { | 244 | } else { | ||
247 | fullscreen = d->m_fullScreenEffectLock.toStrongRef(); | 245 | fullscreen = d->m_fullScreenEffectLock.toStrongRef(); | ||
248 | } | 246 | } | ||
249 | } | 247 | } | ||
250 | it->first.append(AniData(a, meta, ms, to, curve, delay, from, waitAtSource, keepAtTarget, fullscreen, keepAlive)); | 248 | | ||
249 | PreviousWindowPixmapLockPtr previousPixmap; | ||||
250 | if (a == CrossFadePrevious) { | ||||
251 | previousPixmap = PreviousWindowPixmapLockPtr::create(w); | ||||
252 | } | ||||
253 | | ||||
254 | it->first.append(AniData( | ||||
255 | a, // Attribute | ||||
256 | meta, // Metadata | ||||
257 | ms, // Duration | ||||
258 | to, // Target | ||||
259 | curve, // Easing curve | ||||
260 | delay, // Delay | ||||
261 | from, // Source | ||||
262 | waitAtSource, // Whether the animation should be kept at source | ||||
263 | keepAtTarget, // Whether the animation is persistent | ||||
264 | fullscreen, // Full screen effect lock | ||||
265 | keepAlive, // Keep alive flag | ||||
266 | previousPixmap // Previous window pixmap lock | ||||
267 | )); | ||||
268 | | ||||
251 | quint64 ret_id = ++d->m_animCounter; | 269 | quint64 ret_id = ++d->m_animCounter; | ||
252 | it->first.last().id = ret_id; | 270 | it->first.last().id = ret_id; | ||
253 | it->second = QRect(); | 271 | it->second = QRect(); | ||
254 | 272 | | |||
255 | d->m_animationsTouched = true; | 273 | d->m_animationsTouched = true; | ||
256 | 274 | | |||
257 | if (delay > 0) { | 275 | if (delay > 0) { | ||
258 | QTimer::singleShot(delay, this, SLOT(triggerRepaint())); | 276 | QTimer::singleShot(delay, this, SLOT(triggerRepaint())); | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 346 | while (anim != animEnd) { | |||
339 | if (anim->time < anim->duration || anim->keepAtTarget) { | 357 | if (anim->time < anim->duration || anim->keepAtTarget) { | ||
340 | // if (anim->attribute != Brightness && anim->attribute != Saturation && anim->attribute != Opacity) | 358 | // if (anim->attribute != Brightness && anim->attribute != Saturation && anim->attribute != Opacity) | ||
341 | // transformed = true; | 359 | // transformed = true; | ||
342 | d->m_animated = true; | 360 | d->m_animated = true; | ||
343 | ++anim; | 361 | ++anim; | ||
344 | ++animCounter; | 362 | ++animCounter; | ||
345 | } else { | 363 | } else { | ||
346 | EffectWindow *oldW = entry.key(); | 364 | EffectWindow *oldW = entry.key(); | ||
347 | AniData *aData = &(*anim); | | |||
348 | if (aData->attribute == KWin::AnimationEffect::CrossFadePrevious) { | | |||
349 | oldW->unreferencePreviousWindowPixmap(); | | |||
350 | effects->addRepaint(oldW->expandedGeometry()); | | |||
davidedmundson: This line ends up missing.
It doesn't look to make sense, but it was added explicitly… | |||||
I saw that commit and review on reviewboard, but... when exactly those glitches happen? If I maximize a translucent Konsole window, I don't see glitches. We can add repaint in the destructor of the lock, but then we need to document why that repaint is needed. zzag: I saw that commit and review on reviewboard, but... when exactly those glitches happen?
If I… | |||||
351 | } | | |||
352 | d->m_justEndedAnimation = anim->id; | 365 | d->m_justEndedAnimation = anim->id; | ||
353 | animationEnded(oldW, anim->attribute, anim->meta); | 366 | animationEnded(oldW, anim->attribute, anim->meta); | ||
354 | d->m_justEndedAnimation = 0; | 367 | d->m_justEndedAnimation = 0; | ||
355 | // NOTICE animationEnded is an external call and might have called "::animate" | 368 | // NOTICE animationEnded is an external call and might have called "::animate" | ||
356 | // as a result our iterators could now point random junk on the heap | 369 | // as a result our iterators could now point random junk on the heap | ||
357 | // so we've to restore the former states, ie. find our window list and animation | 370 | // so we've to restore the former states, ie. find our window list and animation | ||
358 | if (d->m_animationsTouched) { | 371 | if (d->m_animationsTouched) { | ||
359 | d->m_animationsTouched = false; | 372 | d->m_animationsTouched = false; | ||
▲ Show 20 Lines • Show All 613 Lines • Show Last 20 Lines |
This line ends up missing.
It doesn't look to make sense, but it was added explicitly:
b92ebe02aa49c162518b0a6ebd2481d79a1d3843