Merge lp:~compiz-team/compiz-animation-plugin/compiz-animation-plugin.fix_864476 into lp:compiz-animation-plugin

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 392
Proposed branch: lp:~compiz-team/compiz-animation-plugin/compiz-animation-plugin.fix_864476
Merge into: lp:compiz-animation-plugin
Diff against target: 91 lines (+45/-23)
1 file modified
src/animation.cpp (+45/-23)
To merge this branch: bzr merge lp:~compiz-team/compiz-animation-plugin/compiz-animation-plugin.fix_864476
Reviewer Review Type Date Requested Status
Robert Carr (community) Approve
Review via email: mp+77806@code.launchpad.net

Description of the change

Clean up animations and apply attributes to windows in donePaint rather than preparePaint.

Cleaning up animations in preparePaint allowed for a one-frame race condition to occurr
where we would not longer be painting the window in it's animated state yet still awaiting
a return to the next frame in order to change the attributes of the window. This meant that
for one frame, the window would be visible in it's pre-animation state if the screen
was being consistently, or if damage was applied outside the animated area. This was visible
with eg, the shade and unshade animations, where the decor plugin would paint the full size
of the decorations for one frame since the frame geometry hadn't been updated yet.

Fixes LP #864476

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Clean up animations and apply attributes to windows in donePaint rather than preparePaint.

Cleaning up animations in preparePaint allowed for a one-frame race condition to occurr
where we would not longer be painting the window in it's animated state yet still awaiting
a return to the next frame in order to change the attributes of the window. This meant that
for one frame, the window would be visible in it's pre-animation state if the screen
was being consistently, or if damage was applied outside the animated area. This was visible
with eg, the shade and unshade animations, where the decor plugin would paint the full size
of the decorations for one frame since the frame geometry hadn't been updated yet.

Fixes LP #864476

Revision history for this message
Robert Carr (robertcarr) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/animation.cpp'
2--- src/animation.cpp 2011-09-19 05:59:09 +0000
3+++ src/animation.cpp 2011-10-02 07:31:24 +0000
4@@ -1343,35 +1343,13 @@
5 }
6 }
7
8- popLockedPaintList ();
9-
10- foreach (CompWindow *w, windowsFinishedAnimations)
11- {
12- AnimWindow *aw = AnimWindow::get (w);
13- aw->priv->notifyAnimation (false);
14- aw->priv->postAnimationCleanUp ();
15- }
16-
17- const CompWindowList &ppl = pushLockedPaintList ();
18-
19- foreach (CompWindow *w, ppl)
20+ foreach (CompWindow *w, pl)
21 {
22 PrivateAnimWindow *aw = AnimWindow::get (w)->priv;
23 if (aw->curAnimation ())
24 aw->curAnimation ()->postPreparePaint ();
25 }
26
27- if (!animStillInProgress)
28- {
29- activateEvent (false);
30- mLastRedrawTimeFresh = false;
31-
32- // Reset stacking related info after all animations are done.
33- ExtensionPluginAnimation *extPlugin =
34- static_cast<ExtensionPluginAnimation *> (mExtensionPlugins[0]);
35- extPlugin->resetStackingInfo ();
36- }
37-
38 popLockedPaintList ();
39 }
40
41@@ -1396,6 +1374,50 @@
42 {
43 assert (mAnimInProgress);
44
45+ const CompWindowList &pl = pushLockedPaintList ();
46+ CompWindowList windowsFinishedAnimations;
47+
48+ bool animStillInProgress = false;
49+
50+ /* Paint list includes destroyed windows */
51+ for (CompWindowList::const_reverse_iterator rit = pl.rbegin ();
52+ rit != pl.rend (); rit++)
53+ {
54+ CompWindow *w = (*rit);
55+ AnimWindow *animWin = AnimWindow::get (w);
56+ PrivateAnimWindow *aw = animWin->priv;
57+ Animation *curAnim = aw->curAnimation ();
58+
59+ if (curAnim)
60+ {
61+ bool finished = (curAnim->remainingTime () <= 0);
62+ if (finished) // Animation is done
63+ windowsFinishedAnimations.push_back (w);
64+ else
65+ animStillInProgress = true;
66+ }
67+ }
68+
69+ popLockedPaintList ();
70+
71+ foreach (CompWindow *w, windowsFinishedAnimations)
72+ {
73+ AnimWindow *aw = AnimWindow::get (w);
74+ aw->priv->notifyAnimation (false);
75+ aw->priv->postAnimationCleanUp ();
76+ }
77+
78+ if (!animStillInProgress)
79+ {
80+ activateEvent (false);
81+ mLastRedrawTimeFresh = false;
82+
83+ // Reset stacking related info after all animations are done.
84+ ExtensionPluginAnimation *extPlugin =
85+ static_cast<ExtensionPluginAnimation *> (mExtensionPlugins[0]);
86+ extPlugin->resetStackingInfo ();
87+ }
88+
89 cScreen->damagePending ();
90
91 cScreen->donePaint ();

Subscribers

People subscribed via source and target branches

to all changes: