1
=== modified file 'animation/src/animation.cpp'
2
Index: compiz-plugins-main-0.9.5.94+bzr20110919/animation/src/animation.cpp
3
===================================================================
4
--- compiz-plugins-main-0.9.5.94+bzr20110919.orig/animation/src/animation.cpp 2011-09-16 02:36:40.000000000 +0200
5
+++ compiz-plugins-main-0.9.5.94+bzr20110919/animation/src/animation.cpp 2011-09-20 10:09:48.223997183 +0200
8
if (shouldInitPersistentData)
10
+ const CompWindowList &pl = pushLockedPaintList ();
11
// Initialize persistent window data for the extension plugin
12
- foreach (CompWindow *w, ::screen->windows ())
13
+ foreach (CompWindow *w, pl)
15
AnimWindow *aw = AnimWindow::get (w);
16
extensionPluginInfo->initPersistentData (aw);
19
+ popLockedPaintList ();
24
PrivateAnimScreen::removeExtension (ExtensionPluginInfo *extensionPluginInfo)
26
// Stop all ongoing animations
27
- foreach (CompWindow *w, ::screen->windows ())
28
+ const CompWindowList &pl = pushLockedPaintList ();
30
+ foreach (CompWindow *w, pl)
32
PrivateAnimWindow *aw = AnimWindow::get (w)->priv;
33
if (aw->curAnimation ())
34
aw->postAnimationCleanUp ();
37
+ popLockedPaintList ();
39
// Find the matching plugin and delete it
41
ExtensionPluginVector::iterator it = find (mExtensionPlugins.begin (),
43
updateEventEffects ((AnimEvent)e, true);
46
+ const CompWindowList &cpl = pushLockedPaintList ();
48
// Destroy persistent window data for the extension plugin
49
- foreach (CompWindow *w, ::screen->windows ())
50
+ foreach (CompWindow *w, cpl)
52
AnimWindow *aw = AnimWindow::get (w);
53
extensionPluginInfo->destroyPersistentData (aw);
56
+ popLockedPaintList ();
59
ExtensionPluginInfo::ExtensionPluginInfo (const CompString &name,
61
// Animations have finished for all windows
62
// (Keep preparePaint enabled)
64
- cScreen->getWindowPaintListSetEnabled (this, false);
65
- enablePrePaintWindowsBackToFront (false);
66
+ aScreen->enableCustomPaintList (false);
68
cScreen->donePaintSetEnabled (this, activating);
69
gScreen->glPaintOutputSetEnabled (this, activating);
73
int msSinceLastPaintActual;
74
+ const CompWindowList &pl = pushLockedPaintList ();
75
+ CompWindowList windowsFinishedAnimations;
77
struct timeval curTime;
78
gettimeofday (&curTime, 0);
79
@@ -1248,8 +1260,11 @@
81
bool animStillInProgress = false;
83
- foreach (CompWindow *w, ::screen->windows ())
84
+ /* Paint list includes destroyed windows */
85
+ for (CompWindowList::const_reverse_iterator rit = pl.rbegin ();
86
+ rit != pl.rend (); rit++)
88
+ CompWindow *w = (*rit);
89
AnimWindow *animWin = AnimWindow::get (w);
90
PrivateAnimWindow *aw = animWin->priv;
91
Animation *curAnim = aw->curAnimation ();
92
@@ -1322,16 +1337,24 @@
94
bool finished = (curAnim->remainingTime () <= 0);
95
if (finished) // Animation is done
97
- aw->notifyAnimation (false);
98
- aw->postAnimationCleanUp ();
100
+ windowsFinishedAnimations.push_back (w);
102
animStillInProgress = true;
106
- foreach (CompWindow *w, ::screen->windows ())
107
+ popLockedPaintList ();
109
+ foreach (CompWindow *w, windowsFinishedAnimations)
111
+ AnimWindow *aw = AnimWindow::get (w);
112
+ aw->priv->notifyAnimation (false);
113
+ aw->priv->postAnimationCleanUp ();
116
+ const CompWindowList &ppl = pushLockedPaintList ();
118
+ foreach (CompWindow *w, ppl)
120
PrivateAnimWindow *aw = AnimWindow::get (w)->priv;
121
if (aw->curAnimation ())
122
@@ -1348,6 +1371,8 @@
123
static_cast<ExtensionPluginAnimation *> (mExtensionPlugins[0]);
124
extPlugin->resetStackingInfo ();
127
+ popLockedPaintList ();
130
foreach (ExtensionPluginInfo *extPlugin, mExtensionPlugins)
131
@@ -1572,10 +1597,48 @@
135
+const CompWindowList &
136
+PrivateAnimScreen::pushLockedPaintList ()
138
+ if (!mLockedPaintListCnt)
140
+ mLockedPaintList = &cScreen->getWindowPaintList ();
142
+ if (!mGetWindowPaintListEnableCnt)
144
+ mGetWindowPaintListEnableCnt++;
145
+ cScreen->getWindowPaintListSetEnabled (this, true);
149
+ mLockedPaintListCnt++;
150
+ return *mLockedPaintList;
154
+PrivateAnimScreen::popLockedPaintList ()
156
+ mLockedPaintListCnt--;
158
+ if (!mLockedPaintListCnt)
160
+ mLockedPaintList = NULL;
162
+ mGetWindowPaintListEnableCnt--;
164
+ if (!mGetWindowPaintListEnableCnt)
165
+ cScreen->getWindowPaintListSetEnabled (this, false);
169
/// This is enabled only during restack animations.
170
+/// or when we need to lock it
171
const CompWindowList &
172
PrivateAnimScreen::getWindowPaintList ()
174
+ if (mLockedPaintList)
175
+ return *mLockedPaintList;
177
ExtensionPluginAnimation *extPlugin =
178
static_cast<ExtensionPluginAnimation *> (mExtensionPlugins[0]);
179
return extPlugin->getWindowPaintList ();
180
@@ -1599,9 +1662,28 @@
184
+PrivateAnimScreen::pushPaintList ()
186
+ if (!mGetWindowPaintListEnableCnt)
187
+ cScreen->getWindowPaintListSetEnabled (this, true);
189
+ mGetWindowPaintListEnableCnt++;
193
+PrivateAnimScreen::popPaintList ()
195
+ mGetWindowPaintListEnableCnt--;
197
+ if (!mGetWindowPaintListEnableCnt)
198
+ cScreen->getWindowPaintListSetEnabled (this, false);
202
AnimScreen::enableCustomPaintList (bool enabled)
204
- priv->cScreen->getWindowPaintListSetEnabled (priv, enabled);
205
+ enabled ? priv->pushPaintList () : priv->popPaintList ();
207
priv->enablePrePaintWindowsBackToFront (enabled);
210
@@ -2258,7 +2340,9 @@
211
PrivateAnimScreen::updateAnimStillInProgress ()
213
bool animStillInProgress = false;
214
- foreach (CompWindow *w, ::screen->windows ())
215
+ const CompWindowList &pl = pushLockedPaintList ();
217
+ foreach (CompWindow *w, pl)
219
PrivateAnimWindow *aw = AnimWindow::get (w)->priv;
220
if (aw->curAnimation () &&
221
@@ -2273,6 +2357,8 @@
225
+ popLockedPaintList ();
227
if (!animStillInProgress)
228
activateEvent (false);
230
@@ -2400,7 +2486,10 @@
231
mAnimInProgress (false),
232
mStartingNewPaintRound (false),
233
mPrePaintWindowsBackToFrontEnabled (false),
236
+ mLockedPaintList (NULL),
237
+ mLockedPaintListCnt (0),
238
+ mGetWindowPaintListEnableCnt (0)
240
for (int i = 0; i < WatchedScreenPluginNum; i++)
241
mPluginActive[i] = false;
242
Index: compiz-plugins-main-0.9.5.94+bzr20110919/animation/src/extensionplugin.cpp
243
===================================================================
244
--- compiz-plugins-main-0.9.5.94+bzr20110919.orig/animation/src/extensionplugin.cpp 2011-09-16 02:36:40.000000000 +0200
245
+++ compiz-plugins-main-0.9.5.94+bzr20110919/animation/src/extensionplugin.cpp 2011-09-20 10:10:57.504340729 +0200
249
// Clear all mConfigureNotified's
250
- foreach (CompWindow *w2, ::screen->windows ())
251
+ foreach (CompWindow *w2, CompositeScreen::get (::screen)->getWindowPaintList ())
253
RestackPersistentData *data =
254
static_cast<RestackPersistentData *>
257
updateLastClientList ();
259
- foreach (CompWindow *w, ::screen->windows ())
260
+ foreach (CompWindow *w, CompositeScreen::get (::screen)->getWindowPaintList ())
262
AnimWindow *aw = AnimWindow::get (w);
263
// Allocate persistent restack data if it doesn't already exist
266
if (as->isAnimEffectPossible (AnimEffectDodge))
268
- foreach (CompWindow *w, ::screen->windows ())
269
+ foreach (CompWindow *w, CompositeScreen::get (::screen)->getWindowPaintList ())
271
AnimWindow *aw = AnimWindow::get (w);
272
// Allocate persistent dodge data if it doesn't already exist
274
bool wOldAboveGood = false;
275
bool wRestackedGood = false;
277
- foreach (CompWindow *w, ::screen->windows ())
278
+ foreach (CompWindow *w, CompositeScreen::get (::screen)->getWindowPaintList ())
280
AnimWindow *aw = AnimWindow::get (w);
284
ExtensionPluginAnimation::resetStackingInfo ()
286
- foreach (CompWindow *w, ::screen->windows ())
287
+ foreach (CompWindow *w, CompositeScreen::get (::screen)->getWindowPaintList ())
289
AnimWindow *aw = AnimWindow::get (w);
290
PersistentDataMap::iterator itData =
293
ExtensionPluginAnimation::resetMarks ()
295
- foreach (CompWindow *w, ::screen->windows ())
296
+ foreach (CompWindow *w, CompositeScreen::get (::screen)->getWindowPaintList ())
298
RestackPersistentData *data = static_cast<RestackPersistentData *>
299
(AnimWindow::get (w)->persistentData["restack"]);
304
- getBottommostInExtendedFocusChain (*::screen->windows ().begin ());
305
+ getBottommostInExtendedFocusChain (*CompositeScreen::get (::screen)->getWindowPaintList ().begin ());
308
RestackPersistentData *data = static_cast<RestackPersistentData *>
309
Index: compiz-plugins-main-0.9.5.94+bzr20110919/animation/src/private.h
310
===================================================================
311
--- compiz-plugins-main-0.9.5.94+bzr20110919.orig/animation/src/private.h 2011-09-16 02:36:40.000000000 +0200
312
+++ compiz-plugins-main-0.9.5.94+bzr20110919/animation/src/private.h 2011-09-20 10:09:48.227997204 +0200
314
Window mActiveWindow;
315
CompMatch mNeverAnimateMatch;
317
+ const CompWindowList *mLockedPaintList;
318
+ unsigned int mLockedPaintListCnt;
319
+ unsigned int mGetWindowPaintListEnableCnt;
321
void updateEventEffects (AnimEvent e,
323
bool callPost = true);
325
PrivateAnimScreen (CompScreen *s, AnimScreen *);
326
~PrivateAnimScreen ();
328
+ // In order to prevent other plugins from modifying
329
+ // the paint lists as we use it we need to lock the
332
+ const CompWindowList & pushLockedPaintList ();
333
+ void popLockedPaintList ();
335
+ void pushPaintList ();
336
+ void popPaintList ();
339
void initiateOpenAnim (PrivateAnimWindow *aw);
340
void initiateCloseAnim (PrivateAnimWindow *aw);