Merge lp:~mc-return/compiz/compiz.merge-animation-code-cleanup into lp:compiz/0.9.11

Proposed by MC Return
Status: Merged
Approved by: MC Return
Approved revision: 3726
Merged at revision: 3781
Proposed branch: lp:~mc-return/compiz/compiz.merge-animation-code-cleanup
Merge into: lp:compiz/0.9.11
Diff against target: 5739 lines (+1325/-1054)
18 files modified
plugins/animation/src/animation.cpp (+440/-329)
plugins/animation/src/curvedfold.cpp (+18/-20)
plugins/animation/src/dodge.cpp (+95/-67)
plugins/animation/src/dream.cpp (+10/-11)
plugins/animation/src/extensionplugin.cpp (+81/-53)
plugins/animation/src/fade.cpp (+4/-5)
plugins/animation/src/focusfade.cpp (+8/-7)
plugins/animation/src/glide.cpp (+11/-11)
plugins/animation/src/grid.cpp (+41/-46)
plugins/animation/src/horizontalfold.cpp (+17/-21)
plugins/animation/src/magiclamp.cpp (+48/-57)
plugins/animation/src/options.cpp (+147/-116)
plugins/animation/src/private.h (+284/-205)
plugins/animation/src/restack.cpp (+52/-35)
plugins/animation/src/rollup.cpp (+10/-12)
plugins/animation/src/transform.cpp (+6/-7)
plugins/animation/src/wave.cpp (+9/-9)
plugins/animation/src/zoomside.cpp (+44/-43)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-animation-code-cleanup
Reviewer Review Type Date Requested Status
Sami Jaktholm (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Compiz Maintainers Pending
Review via email: mp+176672@code.launchpad.net

Commit message

Animation code cleanup:

Return ASAP, do not calculate stuff you might not need.
Declare CompWindow *w, AnimWindow *animWin, PrivateAnimWindow *aw
and Animation *curAnim outside the for loop.
grid.cpp: Declare float x, y, topiyFloat outside the for loop.
options.cpp: Declare unsigned int nOptions outside the foreach loop.
Use pre- instead of postfix de- and increments.
Declaration and assignment of variables in one line.
Merged if condition checks.
Added and removed brackets.
Added and removed newlines.
Fixed indentation.
Also initialize the non-static class members "mGridWidth" and
"mGridHeight" in the GridAnim::GridAnim ctor. (LP: #1101618)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
3726. By MC Return

Fixed bug #1101618 UNINIT_CTOR

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sami Jaktholm (sjakthol) :
review: Approve
Revision history for this message
MC Return (mc-return) wrote :

Thanks, Sami.

I am already working on a follow-up to this one ;)

Revision history for this message
MC Return (mc-return) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/animation/src/animation.cpp'
2--- plugins/animation/src/animation.cpp 2013-05-26 06:15:47 +0000
3+++ plugins/animation/src/animation.cpp 2013-07-24 17:39:26 +0000
4@@ -97,17 +97,16 @@
5 public CompPlugin::VTableForScreenAndWindow<AnimScreen, AnimWindow, ANIMATION_ABI>
6 {
7 public:
8+
9 bool init ();
10 void fini ();
11 };
12
13 COMPIZ_PLUGIN_20090315 (animation, AnimPluginVTable);
14
15-static const unsigned short FAKE_ICON_SIZE = 4;
16-
17-const unsigned short LAST_ANIM_DIRECTION = 5;
18-
19-const unsigned short NUM_EFFECTS = 16;
20+static const unsigned short FAKE_ICON_SIZE = 4;
21+const unsigned short LAST_ANIM_DIRECTION = 5;
22+const unsigned short NUM_EFFECTS = 16;
23
24 const char *eventNames[AnimEventNum] =
25 {"Open", "Close", "Minimize", "Unminimize", "Shade", "Focus"};
26@@ -167,11 +166,12 @@
27 // provided by a plugin, otherwise set it to None.
28 void
29 PrivateAnimScreen::updateEventEffects (AnimEvent e,
30- bool forRandom,
31- bool callPost)
32+ bool forRandom,
33+ bool callPost)
34 {
35 CompOption::Value::Vector *listVal;
36 EffectSet *effectSet;
37+
38 if (forRandom)
39 {
40 listVal = &getOptions ()[(unsigned)randomEffectOptionIds[e]].value ().
41@@ -184,6 +184,7 @@
42 list ();
43 effectSet = &mEventEffects[e];
44 }
45+
46 unsigned int n = listVal->size ();
47
48 effectSet->effects.clear ();
49@@ -191,7 +192,7 @@
50
51 AnimEffectVector &eventEffectsAllowed = mEventEffectsAllowed[e];
52
53- for (unsigned int r = 0; r < n; r++) // for each row
54+ for (unsigned int r = 0; r < n; ++r) // for each row
55 {
56 const CompString &animName = (*listVal)[r].s ();
57
58@@ -208,7 +209,7 @@
59
60 if (callPost)
61 {
62- foreach (ExtensionPluginInfo *extPlugin, mExtensionPlugins)
63+ foreach (ExtensionPluginInfo *extPlugin, mExtensionPlugins)
64 extPlugin->postUpdateEventEffects (e, forRandom);
65 }
66 }
67@@ -227,20 +228,22 @@
68
69 bool
70 PrivateAnimScreen::isAnimEffectInList (AnimEffect theEffect,
71- EffectSet &effectList)
72+ EffectSet &effectList)
73 {
74 for (unsigned int i = 0; i < effectList.effects.size (); ++i)
75 if (effectList.effects[i] == theEffect)
76 return true;
77+
78 return false;
79 }
80
81 bool
82 PrivateAnimScreen::isAnimEffectPossibleForEvent (AnimEffect theEffect,
83- AnimEvent event)
84+ AnimEvent event)
85 {
86 // Check all rows to see if the effect is chosen there
87 unsigned int nRows = mEventEffects[event].effects.size ();
88+
89 for (unsigned int i = 0; i < nRows; ++i)
90 {
91 AnimEffect chosenEffect = mEventEffects[event].effects[i];
92@@ -253,6 +256,7 @@
93 isAnimEffectInList (theEffect, mRandomEffects[event]))
94 return true;
95 }
96+
97 return false;
98 }
99
100@@ -262,6 +266,7 @@
101 for (int e = 0; e < AnimEventNum; ++e)
102 if (isAnimEffectPossibleForEvent (theEffect, (AnimEvent)e))
103 return true;
104+
105 return false;
106 }
107
108@@ -275,9 +280,11 @@
109 {
110 AnimEffect chosenEffect = mEventEffects[(unsigned)AnimEventFocus].
111 effects[i];
112+
113 if (chosenEffect->isRestackAnim)
114 return true;
115 }
116+
117 return false;
118 }
119
120@@ -297,7 +304,7 @@
121
122 void
123 PrivateAnimScreen::addExtension (ExtensionPluginInfo *extensionPluginInfo,
124- bool shouldInitPersistentData)
125+ bool shouldInitPersistentData)
126 {
127 mExtensionPlugins.push_back (extensionPluginInfo);
128
129@@ -324,20 +331,24 @@
130 }
131
132 for (int e = 0; e < AnimEventNum; ++e)
133+ {
134 if (eventEffectsNeedUpdate[e])
135 {
136 updateEventEffects ((AnimEvent)e, false, false);
137+
138 if (e != AnimEventFocus)
139 updateEventEffects ((AnimEvent)e, true, false);
140 }
141+ }
142
143 if (shouldInitPersistentData)
144 {
145 const CompWindowList &pl = pushLockedPaintList ();
146+ AnimWindow *aw;
147 // Initialize persistent window data for the extension plugin
148 foreach (CompWindow *w, pl)
149 {
150- AnimWindow *aw = AnimWindow::get (w);
151+ aw = AnimWindow::get (w);
152 extensionPluginInfo->initPersistentData (aw);
153 }
154
155@@ -357,9 +368,12 @@
156 // Stop all ongoing animations
157 const CompWindowList &pl = pushLockedPaintList ();
158
159+ PrivateAnimWindow *aw;
160+
161 foreach (CompWindow *w, pl)
162 {
163- PrivateAnimWindow *aw = AnimWindow::get (w)->priv;
164+ aw = AnimWindow::get (w)->priv;
165+
166 if (aw->curAnimation ())
167 aw->postAnimationCleanUp ();
168 }
169@@ -380,7 +394,6 @@
170 if (extensionPluginInfo->nEffects == 0)
171 return; // no animation effects -> we're done here
172
173-
174 // Also delete the "allowed effect" entries for that plugin
175
176 for (int e = 0; e < AnimEventNum; ++e)
177@@ -409,6 +422,7 @@
178
179 // Update event effects to complete removal
180 updateEventEffects ((AnimEvent)e, false);
181+
182 if (e != AnimEventFocus)
183 updateEventEffects ((AnimEvent)e, true);
184 }
185@@ -425,11 +439,11 @@
186 popLockedPaintList ();
187 }
188
189-ExtensionPluginInfo::ExtensionPluginInfo (const CompString &name,
190- unsigned int nEffects,
191- AnimEffect *effects,
192+ExtensionPluginInfo::ExtensionPluginInfo (const CompString &name,
193+ unsigned int nEffects,
194+ AnimEffect *effects,
195 CompOption::Vector *effectOptions,
196- unsigned int firstEffectOptionIndex) :
197+ unsigned int firstEffectOptionIndex) :
198 name (name),
199 nEffects (nEffects),
200 effects (effects),
201@@ -440,11 +454,11 @@
202
203 // End of extension functions
204
205-Animation::Animation (CompWindow *w,
206- WindowEvent curWindowEvent,
207- float duration,
208+Animation::Animation (CompWindow *w,
209+ WindowEvent curWindowEvent,
210+ float duration,
211 const AnimEffect info,
212- const CompRect &icon) :
213+ const CompRect &icon) :
214 mWindow (w),
215 mAWindow (AnimWindow::get (w)),
216 mTotalTime (duration),
217@@ -461,11 +475,11 @@
218 if (curWindowEvent == WindowEventShade ||
219 curWindowEvent == WindowEventUnshade)
220 {
221- mDecorTopHeight = w->output ().top;
222+ mDecorTopHeight = w->output ().top;
223 mDecorBottomHeight = w->output ().bottom;
224 }
225
226- texturesCache = new GLTexture::List (GLWindow::get (w)->textures ());
227+ texturesCache = new GLTexture::List (GLWindow::get (w)->textures ());
228 PrivateAnimScreen *as = mAWindow->priv->paScreen ();
229
230 mTimestep = as->optionGetTimeStep ();
231@@ -494,26 +508,32 @@
232
233 switch (mCurWindowEvent) // the old event
234 {
235- case WindowEventOpen:
236- mCurWindowEvent = WindowEventClose;
237- break;
238- case WindowEventClose:
239- mCurWindowEvent = WindowEventOpen;
240- break;
241- case WindowEventMinimize:
242- mCurWindowEvent = WindowEventUnminimize;
243- break;
244- case WindowEventUnminimize:
245- mCurWindowEvent = WindowEventMinimize;
246- break;
247- case WindowEventShade:
248- mCurWindowEvent = WindowEventUnshade;
249- break;
250- case WindowEventUnshade:
251- mCurWindowEvent = WindowEventShade;
252- break;
253- default:
254- break;
255+ case WindowEventOpen:
256+ mCurWindowEvent = WindowEventClose;
257+ break;
258+
259+ case WindowEventClose:
260+ mCurWindowEvent = WindowEventOpen;
261+ break;
262+
263+ case WindowEventMinimize:
264+ mCurWindowEvent = WindowEventUnminimize;
265+ break;
266+
267+ case WindowEventUnminimize:
268+ mCurWindowEvent = WindowEventMinimize;
269+ break;
270+
271+ case WindowEventShade:
272+ mCurWindowEvent = WindowEventUnshade;
273+ break;
274+
275+ case WindowEventUnshade:
276+ mCurWindowEvent = WindowEventShade;
277+ break;
278+
279+ default:
280+ break;
281 }
282
283 // 1: forward, 2: backward (3 - progressDir is opposite direction)
284@@ -521,13 +541,14 @@
285
286 switch (mCurWindowEvent) // the new event
287 {
288- case WindowEventClose:
289- case WindowEventMinimize:
290- case WindowEventShade:
291- progressDir = 2;
292- break;
293- default:
294- break;
295+ case WindowEventClose:
296+ case WindowEventMinimize:
297+ case WindowEventShade:
298+ progressDir = 2;
299+ break;
300+
301+ default:
302+ break;
303 }
304
305 if (mOverrideProgressDir == 0)
306@@ -536,11 +557,11 @@
307 mOverrideProgressDir = 0; // disable override
308 }
309
310-PartialWindowAnim::PartialWindowAnim (CompWindow *w,
311- WindowEvent curWindowEvent,
312- float duration,
313+PartialWindowAnim::PartialWindowAnim (CompWindow *w,
314+ WindowEvent curWindowEvent,
315+ float duration,
316 const AnimEffect info,
317- const CompRect &icon) :
318+ const CompRect &icon) :
319 Animation::Animation (w, curWindowEvent, duration, info, icon),
320 mUseDrawRegion (false),
321 mDrawRegion ()
322@@ -574,8 +595,9 @@
323 getOptions ()[(unsigned)customOptionOptionIds[e]].value ();
324
325 unsigned int nRows = valMatch.list ().size ();
326- if (nRows != eventEffects->effects.size () ||
327- nRows != valDuration.list ().size () ||
328+
329+ if (nRows != eventEffects->effects.size () ||
330+ nRows != valDuration.list ().size () ||
331 nRows != valCustomOptions.list ().size ())
332 {
333 compLogMessage ("animation", CompLogLevelError,
334@@ -605,15 +627,16 @@
335
336 AnimEffect
337 PrivateAnimScreen::getActualEffect (AnimEffect effect,
338- AnimEvent animEvent)
339+ AnimEvent animEvent)
340 {
341- bool allRandom = optionGetAllRandom ();
342+ bool allRandom = optionGetAllRandom ();
343 AnimEffectVector *randomEffects = &mRandomEffects[animEvent].effects;
344- unsigned int nRandomEffects = randomEffects->size ();
345+ unsigned int nRandomEffects = randomEffects->size ();
346
347 if ((effect == AnimEffectRandom) || allRandom)
348 {
349 unsigned int nFirstRandomEffect = 0;
350+
351 if (nRandomEffects == 0) // no random animation selected, assume "all"
352 {
353 randomEffects = &mEventEffectsAllowed[animEvent];
354@@ -622,8 +645,10 @@
355 nFirstRandomEffect = 2;
356 nRandomEffects = randomEffects->size () - 2;
357 }
358+
359 unsigned int index = nFirstRandomEffect +
360 (unsigned int)(nRandomEffects * (double)rand () / RAND_MAX);
361+
362 return (*randomEffects)[index];
363 }
364 else
365@@ -634,12 +659,10 @@
366 /// to an actual direction (up, down, left, or right).
367 AnimDirection
368 Animation::getActualAnimDirection (AnimDirection dir,
369- bool openDir)
370+ bool openDir)
371 {
372 if (dir == AnimDirectionRandom)
373- {
374 dir = (AnimDirection)(rand () % 4);
375- }
376 else if (dir == AnimDirectionAuto)
377 {
378 CompRect outRect (mAWindow->savedRectsValid () ?
379@@ -647,8 +670,8 @@
380 mWindow->outputRect ());
381
382 // away from icon
383- int centerX = outRect.x () + outRect.width () / 2 ;
384- int centerY = outRect.y () + outRect.height () / 2 ;
385+ int centerX = outRect.centerX ();
386+ int centerY = outRect.centerY ();
387 float relDiffX = ((float)centerX - mIcon.x ()) / outRect.width ();
388 float relDiffY = ((float)centerY - mIcon.y ()) / outRect.height ();
389
390@@ -683,14 +706,13 @@
391 float
392 Animation::progressLinear ()
393 {
394- float forwardProgress =
395- 1 - mRemainingTime / (mTotalTime - mTimestep);
396- forwardProgress = MIN (forwardProgress, 1);
397- forwardProgress = MAX (forwardProgress, 0);
398+ float forwardProgress = 1 - mRemainingTime / (mTotalTime - mTimestep);
399+ forwardProgress = MIN (forwardProgress, 1);
400+ forwardProgress = MAX (forwardProgress, 0);
401
402- if (mCurWindowEvent == WindowEventOpen ||
403- mCurWindowEvent == WindowEventUnminimize ||
404- mCurWindowEvent == WindowEventUnshade ||
405+ if (mCurWindowEvent == WindowEventOpen ||
406+ mCurWindowEvent == WindowEventUnminimize ||
407+ mCurWindowEvent == WindowEventUnshade ||
408 mCurWindowEvent == WindowEventFocus)
409 forwardProgress = 1 - forwardProgress;
410
411@@ -700,19 +722,17 @@
412 float
413 Animation::progressEaseInEaseOut ()
414 {
415- float forwardProgress =
416- 1 - mRemainingTime / (mTotalTime - mTimestep);
417- forwardProgress = MIN (forwardProgress, 1);
418- forwardProgress = MAX (forwardProgress, 0);
419+ float forwardProgress = 1 - mRemainingTime / (mTotalTime - mTimestep);
420+ forwardProgress = MIN (forwardProgress, 1);
421+ forwardProgress = MAX (forwardProgress, 0);
422
423 // Apply sigmoid and normalize
424- forwardProgress =
425- (sigmoid (forwardProgress) - sigmoid (0)) /
426- (sigmoid (1) - sigmoid (0));
427+ forwardProgress = (sigmoid (forwardProgress) - sigmoid (0)) /
428+ (sigmoid (1) - sigmoid (0));
429
430- if (mCurWindowEvent == WindowEventOpen ||
431- mCurWindowEvent == WindowEventUnminimize ||
432- mCurWindowEvent == WindowEventUnshade ||
433+ if (mCurWindowEvent == WindowEventOpen ||
434+ mCurWindowEvent == WindowEventUnminimize ||
435+ mCurWindowEvent == WindowEventUnshade ||
436 mCurWindowEvent == WindowEventFocus)
437 forwardProgress = 1 - forwardProgress;
438
439@@ -725,7 +745,9 @@
440 /// where minx and maxx are the
441 /// starting and ending points on the sigmoid.
442 float
443-Animation::progressDecelerateCustom (float progress, float minx, float maxx)
444+Animation::progressDecelerateCustom (float progress,
445+ float minx,
446+ float maxx)
447 {
448 float x = 1 - progress;
449 float s = 8;
450@@ -770,16 +792,20 @@
451
452 if (source.x1 < target.x1)
453 target.x1 = source.x1;
454+
455 if (source.x2 > target.x2)
456 target.x2 = source.x2;
457+
458 if (source.y1 < target.y1)
459 target.y1 = source.y1;
460+
461 if (source.y2 > target.y2)
462 target.y2 = source.y2;
463 }
464
465 void
466-AnimWindow::expandBBWithPoint (float fx, float fy)
467+AnimWindow::expandBBWithPoint (float fx,
468+ float fy)
469 {
470 Box &target = priv->BB ();
471
472@@ -794,6 +820,7 @@
473 target.y2 = y + 1;
474 return;
475 }
476+
477 if (x < target.x1)
478 target.x1 = x;
479 else if (x > target.x2)
480@@ -817,14 +844,19 @@
481 }
482
483 static bool
484-project (float objx, float objy, float objz,
485- const float modelview[16], const float projection[16],
486- const GLint viewport[4],
487- float *winx, float *winy, float *winz)
488+project (float objx,
489+ float objy,
490+ float objz,
491+ const float modelview[16],
492+ const float projection[16],
493+ const GLint viewport[4],
494+ float *winx,
495+ float *winy,
496+ float *winz)
497 {
498 unsigned int i;
499- float in[4];
500- float out[4];
501+ float in[4];
502+ float out[4];
503
504 in[0] = objx;
505 in[1] = objy;
506@@ -870,11 +902,11 @@
507
508 /// Either points or objects should be non-0.
509 bool
510-AnimWindow::expandBBWithPoints3DTransform (CompOutput &output,
511- GLMatrix &transform,
512- const float *points,
513+AnimWindow::expandBBWithPoints3DTransform (CompOutput &output,
514+ GLMatrix &transform,
515+ const float *points,
516 GridAnim::GridModel::GridObject *objects,
517- unsigned int nPoints)
518+ unsigned int nPoints)
519 {
520 GLfloat x, y, z;
521 GLint viewport[4] =
522@@ -884,16 +916,16 @@
523 output.height ()};
524
525 const float *projection =
526- GLScreen::get (::screen)->projectionMatrix ()->getMatrix ();
527+ GLScreen::get (::screen)->projectionMatrix ()->getMatrix ();
528
529 if (points) // use points
530 {
531- for (; nPoints; nPoints--, points += 3)
532+ for (; nPoints; --nPoints, points += 3)
533 {
534 if (!project (points[0], points[1], points[2],
535- transform.getMatrix (), projection,
536- viewport,
537- &x, &y, &z))
538+ transform.getMatrix (), projection,
539+ viewport,
540+ &x, &y, &z))
541 return false;
542
543 expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5);
544@@ -902,14 +934,15 @@
545 else // use grid model objects
546 {
547 GridAnim::GridModel::GridObject *object = objects;
548+
549 for (; nPoints; --nPoints, ++object)
550 {
551 if (!project (object->position ().x (),
552- object->position ().y (),
553- object->position ().z (),
554- transform.getMatrix (), projection,
555- viewport,
556- &x, &y, &z))
557+ object->position ().y (),
558+ object->position ().z (),
559+ transform.getMatrix (), projection,
560+ viewport,
561+ &x, &y, &z))
562 return false;
563
564 expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5);
565@@ -924,7 +957,8 @@
566 CompRect outRect (savedRectsValid () ?
567 savedOutRect () :
568 mWindow->outputRect ());
569- Box windowBox = {
570+ Box windowBox =
571+ {
572 static_cast <short int> (outRect.x ()), static_cast <short int> (outRect.x () + outRect.width ()),
573 static_cast <short int> (outRect.y ()), static_cast <short int> (outRect.y () + outRect.height ())
574 };
575@@ -941,8 +975,8 @@
576
577 void
578 Animation::prepareTransform (CompOutput &output,
579- GLMatrix &resultTransform,
580- GLMatrix &transform)
581+ GLMatrix &resultTransform,
582+ GLMatrix &transform)
583 {
584 GLMatrix sTransform;
585 sTransform.toScreenSpace (&output, -DEFAULT_Z_CAMERA);
586@@ -954,9 +988,9 @@
587 {
588 // Have a 1 pixel margin to prevent occasional 1 pixel line artifact
589 CompRegion region (priv->mBB.x1 - 1,
590- priv->mBB.y1 - 1,
591- priv->mBB.x2 - priv->mBB.x1 + 2,
592- priv->mBB.y2 - priv->mBB.y1 + 2);
593+ priv->mBB.y1 - 1,
594+ priv->mBB.x2 - priv->mBB.x1 + 2,
595+ priv->mBB.y2 - priv->mBB.y1 + 2);
596 priv->mStepRegion = region;
597 }
598
599@@ -978,7 +1012,8 @@
600 }
601
602 bool
603-AnimScreen::getMousePointerXY (short *x, short *y)
604+AnimScreen::getMousePointerXY (short *x,
605+ short *y)
606 {
607 Window w1, w2;
608 int xp, yp, xj, yj;
609@@ -998,21 +1033,21 @@
610 PrivateAnimWindow::getState ()
611 {
612 Atom actual;
613- int result, format;
614+ int format;
615 unsigned long n, left;
616 unsigned char *data;
617 unsigned int retval = WithdrawnState;
618
619- result = XGetWindowProperty (::screen->dpy (), mWindow->id (),
620- Atoms::wmState, 0L,
621- 1L, false,
622- Atoms::wmState,
623- &actual, &format, &n, &left, &data);
624+ int result = XGetWindowProperty (::screen->dpy (), mWindow->id (),
625+ Atoms::wmState, 0L,
626+ 1L, false,
627+ Atoms::wmState,
628+ &actual, &format, &n, &left, &data);
629
630 if (result == Success && data)
631 {
632 if (n)
633- memcpy (&retval, data, sizeof (int));
634+ memcpy (&retval, data, sizeof (int));
635
636 XFree ((void *)data);
637 }
638@@ -1039,6 +1074,7 @@
639 {
640 if (mExtensionPlugins.empty ())
641 initAnimationList ();
642+
643 foreach (CompOption::Value &val, opt->value ().list ())
644 val.match ().update ();
645 }
646@@ -1049,6 +1085,7 @@
647 {
648 if (mExtensionPlugins.empty ())
649 initAnimationList ();
650+
651 updateOptionSets (getCorrespondingAnimEvent (num));
652 }
653
654@@ -1058,6 +1095,7 @@
655 {
656 if (mExtensionPlugins.empty ())
657 initAnimationList ();
658+
659 updateEventEffects (getCorrespondingAnimEvent (num), false);
660 }
661
662@@ -1067,6 +1105,7 @@
663 {
664 if (mExtensionPlugins.empty ())
665 initAnimationList ();
666+
667 updateEventEffects (getCorrespondingAnimEvent (num), true);
668 }
669
670@@ -1076,22 +1115,21 @@
671 bool clearMatchingRow)
672 {
673 bool shouldDamageWindow = false;
674-
675+
676 notifyAnimation (false);
677
678- if (mCurAnimation)
679- {
680- if (mCurAnimation->shouldDamageWindowOnEnd ())
681- shouldDamageWindow = true;
682- }
683+ if (mCurAnimation &&
684+ mCurAnimation->shouldDamageWindowOnEnd ())
685+ shouldDamageWindow = true;
686+
687 enablePainting (false);
688
689 if (shouldDamageWindow)
690 mAWindow->expandBBWithWindow ();
691
692 if (shouldDamageWindow ||
693- (mCurAnimation &&
694- !mCurAnimation->stepRegionUsed () &&
695+ (mCurAnimation &&
696+ !mCurAnimation->stepRegionUsed () &&
697 mAWindow->BB ()->x1 != MAXSHORT)) // BB intialized
698 mAWindow->resetStepRegionWithBB ();
699
700@@ -1113,16 +1151,20 @@
701 mCurAnimSelectionRow = -1;
702
703 mFinishingAnim = true;
704+
705 if (!destructing)
706 {
707 mIgnoreDamage = true;
708+
709 while (mUnmapCnt > 0)
710 {
711 mWindow->unmap ();
712 --mUnmapCnt;
713 }
714+
715 if (mUnmapCnt < 0)
716 mUnmapCnt = 0;
717+
718 mIgnoreDamage = false;
719 }
720
721@@ -1131,6 +1173,7 @@
722 mWindow->destroy ();
723 --mDestroyCnt;
724 }
725+
726 mFinishingAnim = false;
727
728 foreach (ExtensionPluginInfo *extPlugin, mPAScreen->mExtensionPlugins)
729@@ -1175,12 +1218,10 @@
730 return;
731 }
732 else
733- {
734 // Animations have finished for all windows
735 // (Keep preparePaint enabled)
736-
737 aScreen->enableCustomPaintList (false);
738- }
739+
740 cScreen->donePaintSetEnabled (this, activating);
741 gScreen->glPaintOutputSetEnabled (this, activating);
742
743@@ -1200,49 +1241,56 @@
744 void
745 PrivateAnimWindow::notifyAnimation (bool activation)
746 {
747- CompOption::Vector o (0);
748-
749 if (!mCurAnimation)
750 return;
751-
752+
753+ CompOption::Vector o (0);
754+
755 o.push_back (CompOption ("root", CompOption::TypeInt));
756 o.push_back (CompOption ("window", CompOption::TypeInt));
757 o.push_back (CompOption ("type", CompOption::TypeString));
758 o.push_back (CompOption ("active", CompOption::TypeBool));
759-
760+
761 o[0].value ().set ((int) ::screen->root ());
762 o[1].value ().set ((int) mWindow->id ());
763-
764+
765 switch (mCurAnimation->curWindowEvent ())
766 {
767 case WindowEventOpen:
768 o[2].value ().set ("open");
769 break;
770+
771 case WindowEventClose:
772 o[2].value ().set ("close");
773 break;
774+
775 case WindowEventMinimize:
776 o[2].value ().set ("minimize");
777 break;
778+
779 case WindowEventUnminimize:
780 o[2].value ().set ("unminimize");
781 break;
782+
783 case WindowEventShade:
784 o[2].value ().set ("shade");
785 break;
786+
787 case WindowEventUnshade:
788 o[2].value ().set ("unshade");
789 break;
790+
791 case WindowEventFocus:
792 o[2].value ().set ("focus");
793 break;
794+
795 case WindowEventNum:
796 case WindowEventNone:
797 default:
798 o[2].value ().set ("none");
799 break;
800 }
801-
802+
803 o[3].value ().set (activation);
804
805 screen->handleCompizEvent ("animation", "window_animation", o);
806@@ -1254,6 +1302,7 @@
807 for (int i = 0; i < WatchedScreenPluginNum; ++i)
808 if (mPluginActive[i])
809 return true;
810+
811 return false;
812 }
813
814@@ -1261,6 +1310,7 @@
815 Animation::shouldSkipFrame (int msSinceLastPaintActual)
816 {
817 mTimeElapsedWithinTimeStep += msSinceLastPaintActual;
818+
819 if (mTimeElapsedWithinTimeStep < mTimestep) // if timestep not yet completed
820 return true;
821
822@@ -1304,7 +1354,7 @@
823 extPlugin->prePreparePaintGeneral ();
824
825 if (mAnimInProgress)
826- {
827+ {
828 int msSinceLastPaintActual;
829 const CompWindowList &pl = pushLockedPaintList ();
830 CompWindowList windowsFinishedAnimations;
831@@ -1325,14 +1375,19 @@
832 mLastRedrawTime = curTime; // Store current time for next time
833 mLastRedrawTimeFresh = true;
834
835+ CompWindow *w;
836+ AnimWindow *animWin;
837+ PrivateAnimWindow *aw;
838+ Animation *curAnim;
839+
840 /* Paint list includes destroyed windows */
841 for (CompWindowList::const_reverse_iterator rit = pl.rbegin ();
842 rit != pl.rend (); ++rit)
843 {
844- CompWindow *w = (*rit);
845- AnimWindow *animWin = AnimWindow::get (w);
846- PrivateAnimWindow *aw = animWin->priv;
847- Animation *curAnim = aw->curAnimation ();
848+ w = (*rit);
849+ animWin = AnimWindow::get (w);
850+ aw = animWin->priv;
851+ curAnim = aw->curAnimation ();
852
853 if (curAnim)
854 {
855@@ -1393,6 +1448,7 @@
856 // so reset step region here with BB.
857 animWin->resetStepRegionWithBB ();
858 }
859+
860 if (!(cScreen->damageMask () &
861 COMPOSITE_SCREEN_DAMAGE_ALL_MASK))
862 aw->damageThisAndLastStepRegion ();
863@@ -1400,6 +1456,7 @@
864 }
865
866 bool finished = (curAnim->remainingTime () <= 0);
867+
868 if (finished) // Animation is done
869 windowsFinishedAnimations.push_back (w);
870 }
871@@ -1408,6 +1465,7 @@
872 foreach (CompWindow *w, pl)
873 {
874 PrivateAnimWindow *aw = AnimWindow::get (w)->priv;
875+
876 if (aw->curAnimation ())
877 aw->curAnimation ()->postPreparePaint ();
878 }
879@@ -1423,6 +1481,7 @@
880 if (mStartCountdown)
881 {
882 --mStartCountdown;
883+
884 if (!mStartCountdown)
885 {
886 foreach (ExtensionPluginInfo *extPlugin, mExtensionPlugins)
887@@ -1440,19 +1499,24 @@
888 CompWindowList windowsFinishedAnimations;
889
890 bool animStillInProgress = false;
891+ CompWindow *w;
892+ AnimWindow *animWin;
893+ PrivateAnimWindow *aw;
894+ Animation *curAnim;
895
896 /* Paint list includes destroyed windows */
897 for (CompWindowList::const_reverse_iterator rit = pl.rbegin ();
898 rit != pl.rend (); ++rit)
899 {
900- CompWindow *w = (*rit);
901- AnimWindow *animWin = AnimWindow::get (w);
902- PrivateAnimWindow *aw = animWin->priv;
903- Animation *curAnim = aw->curAnimation ();
904+ w = (*rit);
905+ animWin = AnimWindow::get (w);
906+ aw = animWin->priv;
907+ curAnim = aw->curAnimation ();
908
909 if (curAnim)
910 {
911 bool finished = (curAnim->remainingTime () <= 0);
912+
913 if (finished) // Animation is done
914 windowsFinishedAnimations.push_back (w);
915 else
916@@ -1518,16 +1582,16 @@
917 bool
918 Animation::shouldDamageWindowOnStart ()
919 {
920- return (mCurWindowEvent == WindowEventClose ||
921- mCurWindowEvent == WindowEventMinimize ||
922+ return (mCurWindowEvent == WindowEventClose ||
923+ mCurWindowEvent == WindowEventMinimize ||
924 mCurWindowEvent == WindowEventShade);
925 }
926
927 bool
928 Animation::shouldDamageWindowOnEnd ()
929 {
930- return (mCurWindowEvent == WindowEventOpen ||
931- mCurWindowEvent == WindowEventUnminimize ||
932+ return (mCurWindowEvent == WindowEventOpen ||
933+ mCurWindowEvent == WindowEventUnminimize ||
934 mCurWindowEvent == WindowEventUnshade);
935 }
936
937@@ -1563,15 +1627,13 @@
938 }
939
940 void
941-PrivateAnimWindow::glDrawTexture (GLTexture *texture,
942- const GLMatrix &transform,
943- const GLWindowPaintAttrib &attrib,
944- unsigned int mask)
945+PrivateAnimWindow::glDrawTexture (GLTexture *texture,
946+ const GLMatrix &transform,
947+ const GLWindowPaintAttrib &attrib,
948+ unsigned int mask)
949 {
950 if (mCurAnimation)
951- {
952 mCurAnimation->setCurPaintAttrib (attrib);
953- }
954
955 gWindow->glDrawTexture (texture, transform, attrib, mask);
956 }
957@@ -1586,16 +1648,14 @@
958 mCurAnimation->drawGeometry ();
959 }
960 else
961- {
962 gWindow->glDrawGeometry ();
963- }
964 }
965 #endif
966
967 void
968-Animation::drawTexture (GLTexture *texture,
969- const GLWindowPaintAttrib &attrib,
970- unsigned int mask)
971+Animation::drawTexture (GLTexture *texture,
972+ const GLWindowPaintAttrib &attrib,
973+ unsigned int mask)
974 {
975 mCurPaintAttrib = attrib;
976 }
977@@ -1610,8 +1670,9 @@
978
979 bool
980 PrivateAnimWindow::glPaint (const GLWindowPaintAttrib &attrib,
981- const GLMatrix &transform,
982- const CompRegion &region, unsigned int mask)
983+ const GLMatrix &transform,
984+ const CompRegion &region,
985+ unsigned int mask)
986 {
987 bool status;
988
989@@ -1694,7 +1755,7 @@
990 {
991 if (!mLockedPaintListCnt)
992 {
993- const CompWindowList &pl = cScreen->getWindowPaintList ();
994+ const CompWindowList &pl = cScreen->getWindowPaintList ();
995 mLockedPaintList = &pl;
996
997 if (!mGetWindowPaintListEnableCnt)
998@@ -1705,6 +1766,7 @@
999 }
1000
1001 ++mLockedPaintListCnt;
1002+
1003 return *mLockedPaintList;
1004 }
1005
1006@@ -1734,6 +1796,7 @@
1007
1008 ExtensionPluginAnimation *extPlugin =
1009 static_cast<ExtensionPluginAnimation *> (mExtensionPlugins[0]);
1010+
1011 return extPlugin->getWindowPaintList ();
1012 }
1013
1014@@ -1803,6 +1866,7 @@
1015 ::screen->handleCompizEvent (pluginName, eventName, options);
1016
1017 for (int i = 0; i < WatchedScreenPluginNum; ++i)
1018+ {
1019 if (strcmp (pluginName, watchedScreenPlugins[i].pluginName) == 0)
1020 {
1021 if (strcmp (eventName,
1022@@ -1813,17 +1877,18 @@
1023
1024 if (!mPluginActive[i] &&
1025 (i == WatchedPluginSwitcher ||
1026- i == WatchedPluginRing ||
1027- i == WatchedPluginShift ||
1028+ i == WatchedPluginRing ||
1029+ i == WatchedPluginShift ||
1030 i == WatchedPluginScale))
1031- {
1032 mSwitcherPostWait = 1;
1033- }
1034 }
1035+
1036 break;
1037 }
1038+ }
1039
1040 for (int i = 0; i < WatchedWindowPluginNum; ++i)
1041+ {
1042 if (strcmp (pluginName,
1043 watchedWindowPlugins[i].pluginName) == 0)
1044 {
1045@@ -1845,14 +1910,17 @@
1046 false);
1047 }
1048 }
1049+
1050 break;
1051 }
1052+ }
1053 }
1054
1055 /// Returns true for windows that don't have a pixmap or certain properties,
1056 /// like the dimming layer of gksudo and x-session-manager.
1057 inline bool
1058-PrivateAnimScreen::shouldIgnoreWindowForAnim (CompWindow *w, bool checkPixmap)
1059+PrivateAnimScreen::shouldIgnoreWindowForAnim (CompWindow *w,
1060+ bool checkPixmap)
1061 {
1062 AnimWindow *aw = AnimWindow::get (w);
1063
1064@@ -1889,6 +1957,7 @@
1065
1066 if (shouldIgnoreWindowForAnim (w, true))
1067 return;
1068+
1069 int duration = 200;
1070 AnimEffect chosenEffect =
1071 getMatchingAnimSelection (w, AnimEventClose, &duration);
1072@@ -1921,9 +1990,7 @@
1073 }
1074 }*/
1075 else
1076- {
1077 aw->postAnimationCleanUpPrev (true, false);
1078- }
1079 }
1080
1081 if (startingNew)
1082@@ -1989,35 +2056,35 @@
1083
1084 // Make sure non-animated closing windows get a damage.
1085 if (!aw->curAnimation ())
1086- {
1087 aw->mAWindow->expandBBWithWindow ();
1088- }
1089 }
1090
1091 CompRect
1092-PrivateAnimScreen::getIcon (CompWindow *w, bool alwaysUseMouse)
1093+PrivateAnimScreen::getIcon (CompWindow *w,
1094+ bool alwaysUseMouse)
1095 {
1096 CompRect icon;
1097
1098 if (!alwaysUseMouse)
1099- {
1100 icon = w->iconGeometry ();
1101- }
1102+
1103 if (alwaysUseMouse ||
1104- (icon.x () == 0 &&
1105- icon.y () == 0 &&
1106+ (icon.x () == 0 &&
1107+ icon.y () == 0 &&
1108 icon.width () == 0 &&
1109 icon.height () == 0)) // that is, couldn't get icon from window
1110 {
1111 // Minimize to mouse pointer if there is no
1112 // window list or if the window skips taskbar
1113 short x, y;
1114+
1115 if (!aScreen->getMousePointerXY (&x, &y))
1116 {
1117 // Use screen center if can't get mouse coords
1118 x = ::screen->width () / 2;
1119 y = ::screen->height () / 2;
1120 }
1121+
1122 icon.setX (x);
1123 icon.setY (y);
1124 icon.setWidth (FAKE_ICON_SIZE);
1125@@ -2053,7 +2120,7 @@
1126
1127 if (chosenEffect != AnimEffectNone)
1128 {
1129- bool startingNew = true;
1130+ bool startingNew = true;
1131 WindowEvent curWindowEvent = WindowEventNone;
1132
1133 if (aw->curAnimation ())
1134@@ -2062,9 +2129,7 @@
1135 if (curWindowEvent != WindowEventNone)
1136 {
1137 if (curWindowEvent != WindowEventUnminimize)
1138- {
1139 aw->postAnimationCleanUpPrev (false, false);
1140- }
1141 else
1142 {
1143 startingNew = false;
1144@@ -2112,17 +2177,16 @@
1145
1146 if (chosenEffect != AnimEffectNone)
1147 {
1148- bool startingNew = true;
1149+ bool startingNew = true;
1150 WindowEvent curWindowEvent = WindowEventNone;
1151+
1152 if (aw->curAnimation ())
1153 curWindowEvent = aw->curAnimation ()->curWindowEvent ();
1154
1155 if (curWindowEvent != WindowEventNone)
1156 {
1157 if (curWindowEvent != WindowEventUnshade)
1158- {
1159 aw->postAnimationCleanUpPrev (false, false);
1160- }
1161 else
1162 {
1163 startingNew = false;
1164@@ -2169,6 +2233,7 @@
1165 extPlugin->preInitiateOpenAnim (aw->mAWindow);
1166
1167 WindowEvent curWindowEvent = WindowEventNone;
1168+
1169 if (aw->curAnimation ())
1170 curWindowEvent = aw->curAnimation ()->curWindowEvent ();
1171
1172@@ -2185,9 +2250,7 @@
1173 if (curWindowEvent != WindowEventNone)
1174 {
1175 if (curWindowEvent != WindowEventClose)
1176- {
1177 aw->postAnimationCleanUpPrev (false, false);
1178- }
1179 else
1180 {
1181 startingNew = false;
1182@@ -2251,15 +2314,14 @@
1183
1184 // TODO Refactor the rest? (almost the same in other initiateX methods)
1185 WindowEvent curWindowEvent = WindowEventNone;
1186+
1187 if (aw->curAnimation ())
1188 curWindowEvent = aw->curAnimation ()->curWindowEvent ();
1189
1190 if (curWindowEvent != WindowEventNone)
1191 {
1192 if (curWindowEvent != WindowEventMinimize)
1193- {
1194 aw->postAnimationCleanUpPrev (false, false);
1195- }
1196 else
1197 {
1198 startingNew = false;
1199@@ -2316,15 +2378,14 @@
1200 bool playEffect = true;
1201
1202 WindowEvent curWindowEvent = WindowEventNone;
1203+
1204 if (aw->curAnimation ())
1205 curWindowEvent = aw->curAnimation ()->curWindowEvent ();
1206
1207 if (curWindowEvent != WindowEventNone)
1208 {
1209 if (curWindowEvent != WindowEventShade)
1210- {
1211 aw->postAnimationCleanUpPrev (false, false);
1212- }
1213 else
1214 {
1215 startingNew = false;
1216@@ -2363,8 +2424,8 @@
1217 bool
1218 PrivateAnimScreen::initiateFocusAnim (PrivateAnimWindow *aw)
1219 {
1220- CompWindow *w = aw->mWindow;
1221- int duration = 200;
1222+ CompWindow *w = aw->mWindow;
1223+ int duration = 200;
1224
1225 if (aw->curAnimation () || otherPluginsActive () ||
1226 // Check the "switcher post-wait" counter that effectively prevents
1227@@ -2407,19 +2468,19 @@
1228 mUnshadePending = false;
1229 mPAScreen->initiateUnshadeAnim (this);
1230 }
1231- else if (mCurAnimation && mCurAnimation->inProgress () &&
1232+ else if (mCurAnimation && mCurAnimation->inProgress () &&
1233 // Don't let transient window open anim be interrupted with a resize notify
1234- !(mCurAnimation->curWindowEvent () == WindowEventOpen &&
1235+ !(mCurAnimation->curWindowEvent () == WindowEventOpen &&
1236 (mWindow->wmType () &
1237- (CompWindowTypeDropdownMenuMask |
1238- CompWindowTypePopupMenuMask |
1239- CompWindowTypeMenuMask |
1240- CompWindowTypeTooltipMask |
1241- CompWindowTypeNotificationMask |
1242- CompWindowTypeComboMask |
1243- CompWindowTypeDndMask))) &&
1244+ (CompWindowTypeDropdownMenuMask |
1245+ CompWindowTypePopupMenuMask |
1246+ CompWindowTypeMenuMask |
1247+ CompWindowTypeTooltipMask |
1248+ CompWindowTypeNotificationMask |
1249+ CompWindowTypeComboMask |
1250+ CompWindowTypeDndMask))) &&
1251 // Ignore resize with dx=0, dy=0, dwidth=0, dheight=0
1252- !(dx == 0 && dy == 0 && dwidth == 0 && dheight == 0) &&
1253+ !(dx == 0 && dy == 0 && dwidth == 0 && dheight == 0) &&
1254 !mCurAnimation->resizeUpdate (dx, dy, dwidth, dheight))
1255 {
1256 postAnimationCleanUp ();
1257@@ -2445,9 +2506,7 @@
1258 break;
1259 }
1260 else
1261- {
1262 aw->notifyAnimation (false);
1263- }
1264 }
1265
1266 popLockedPaintList ();
1267@@ -2462,11 +2521,11 @@
1268 bool immediate)
1269 {
1270 if (mCurAnimation && mCurAnimation->inProgress () &&
1271- (mGrabbed || !mCurAnimation->moveUpdate (dx, dy)))
1272+ (mGrabbed || !mCurAnimation->moveUpdate (dx, dy)))
1273 {
1274 // Stop the animation
1275- postAnimationCleanUp ();
1276- mPAScreen->updateAnimStillInProgress ();
1277+ postAnimationCleanUp ();
1278+ mPAScreen->updateAnimStillInProgress ();
1279 }
1280
1281 mWindow->moveNotify (dx, dy, immediate);
1282@@ -2496,7 +2555,7 @@
1283 const GLMatrix &matrix,
1284 const CompRegion &region,
1285 CompOutput *output,
1286- unsigned int mask)
1287+ unsigned int mask)
1288 {
1289 assert (mAnimInProgress);
1290
1291@@ -2530,46 +2589,88 @@
1292
1293 AnimEffectUsedFor& AnimEffectUsedFor::exclude (AnimEvent event)
1294 {
1295- switch (event) {
1296- case AnimEventOpen: open = false; break;
1297- case AnimEventClose: close = false; break;
1298- case AnimEventMinimize: minimize = false; break;
1299- case AnimEventUnminimize: unminimize = false; break;
1300- case AnimEventShade: shade = false; break;
1301- case AnimEventFocus: focus = false; break;
1302- default: break;
1303- }
1304- return *this;
1305+ switch (event)
1306+ {
1307+ case AnimEventOpen:
1308+ open = false;
1309+ break;
1310+
1311+ case AnimEventClose:
1312+ close = false;
1313+ break;
1314+
1315+ case AnimEventMinimize:
1316+ minimize = false;
1317+ break;
1318+
1319+ case AnimEventUnminimize:
1320+ unminimize = false;
1321+ break;
1322+
1323+ case AnimEventShade:
1324+ shade = false;
1325+ break;
1326+
1327+ case AnimEventFocus:
1328+ focus = false;
1329+ break;
1330+
1331+ default:
1332+ break;
1333+ }
1334+
1335+ return *this;
1336 }
1337
1338 AnimEffectUsedFor& AnimEffectUsedFor::include (AnimEvent event)
1339 {
1340- switch (event) {
1341- case AnimEventOpen: open = true; break;
1342- case AnimEventClose: close = true; break;
1343- case AnimEventMinimize: minimize = true; break;
1344- case AnimEventUnminimize: unminimize = true; break;
1345- case AnimEventShade: shade = true; break;
1346- case AnimEventFocus: focus = true; break;
1347- default: break;
1348- }
1349+ switch (event)
1350+ {
1351+ case AnimEventOpen:
1352+ open = true;
1353+ break;
1354+
1355+ case AnimEventClose:
1356+ close = true;
1357+ break;
1358+
1359+ case AnimEventMinimize:
1360+ minimize = true;
1361+ break;
1362+
1363+ case AnimEventUnminimize:
1364+ unminimize = true;
1365+ break;
1366+
1367+ case AnimEventShade:
1368+ shade = true;
1369+ break;
1370+
1371+ case AnimEventFocus:
1372+ focus = true;
1373+ break;
1374+
1375+ default:
1376+ break;
1377+ }
1378+
1379 return *this;
1380 }
1381
1382-AnimEffectInfo::AnimEffectInfo (const char *name,
1383- AnimEffectUsedFor usedFor,
1384- CreateAnimFunc create,
1385- bool isRestackAnim) :
1386+AnimEffectInfo::AnimEffectInfo (const char *name,
1387+ AnimEffectUsedFor usedFor,
1388+ CreateAnimFunc create,
1389+ bool isRestackAnim) :
1390 name (name),
1391 create (create),
1392 isRestackAnim (isRestackAnim)
1393 {
1394- usedForEvents[AnimEventOpen] = usedFor.open;
1395- usedForEvents[AnimEventClose] = usedFor.close;
1396- usedForEvents[AnimEventMinimize] = usedFor.minimize;
1397+ usedForEvents[AnimEventOpen] = usedFor.open;
1398+ usedForEvents[AnimEventClose] = usedFor.close;
1399+ usedForEvents[AnimEventMinimize] = usedFor.minimize;
1400 usedForEvents[AnimEventUnminimize] = usedFor.unminimize;
1401- usedForEvents[AnimEventShade] = usedFor.shade;
1402- usedForEvents[AnimEventFocus] = usedFor.focus;
1403+ usedForEvents[AnimEventShade] = usedFor.shade;
1404+ usedForEvents[AnimEventFocus] = usedFor.focus;
1405 }
1406
1407 bool
1408@@ -2587,7 +2688,7 @@
1409 AnimEffect animEffects[NUM_EFFECTS];
1410
1411 ExtensionPluginAnimation animExtensionPluginInfo (CompString ("animation"),
1412- NUM_EFFECTS, animEffects, 0,
1413+ NUM_EFFECTS, animEffects, 0,
1414 NUM_NONEFFECT_OPTIONS);
1415 ExtensionPluginInfo *
1416 Animation::getExtensionPluginInfo ()
1417@@ -2695,86 +2796,86 @@
1418 int i = 0;
1419
1420 animEffects[i++] = AnimEffectNone =
1421- new AnimEffectInfo ("animation:None",
1422- AnimEffectUsedFor::all(),
1423- 0);
1424+ new AnimEffectInfo ("animation:None",
1425+ AnimEffectUsedFor::all(),
1426+ 0);
1427
1428 animEffects[i++] = AnimEffectRandom =
1429- new AnimEffectInfo ("animation:Random",
1430- AnimEffectUsedFor::all().exclude(AnimEventFocus),
1431- 0);
1432+ new AnimEffectInfo ("animation:Random",
1433+ AnimEffectUsedFor::all().exclude(AnimEventFocus),
1434+ 0);
1435
1436 animEffects[i++] = AnimEffectCurvedFold =
1437- new AnimEffectInfo ("animation:Curved Fold",
1438- AnimEffectUsedFor::all().exclude(AnimEventFocus),
1439- &createAnimation<CurvedFoldAnim>);
1440-
1441+ new AnimEffectInfo ("animation:Curved Fold",
1442+ AnimEffectUsedFor::all().exclude(AnimEventFocus),
1443+ &createAnimation<CurvedFoldAnim>);
1444+
1445 animEffects[i++] = AnimEffectDodge =
1446- new AnimEffectInfo ("animation:Dodge",
1447- AnimEffectUsedFor::none().include(AnimEventFocus),
1448- &createAnimation<DodgeAnim>,
1449- true);
1450-
1451+ new AnimEffectInfo ("animation:Dodge",
1452+ AnimEffectUsedFor::none().include(AnimEventFocus),
1453+ &createAnimation<DodgeAnim>,
1454+ true);
1455+
1456 animEffects[i++] = AnimEffectDream =
1457- new AnimEffectInfo ("animation:Dream",
1458- AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1459- &createAnimation<DreamAnim>);
1460+ new AnimEffectInfo ("animation:Dream",
1461+ AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1462+ &createAnimation<DreamAnim>);
1463
1464 animEffects[i++] = AnimEffectFade =
1465- new AnimEffectInfo ("animation:Fade",
1466- AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1467- &createAnimation<FadeAnim>);
1468-
1469+ new AnimEffectInfo ("animation:Fade",
1470+ AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1471+ &createAnimation<FadeAnim>);
1472+
1473 animEffects[i++] = AnimEffectFocusFade =
1474- new AnimEffectInfo ("animation:Focus Fade",
1475- AnimEffectUsedFor::none().include(AnimEventFocus),
1476- &createAnimation<FocusFadeAnim>,
1477- true);
1478-
1479+ new AnimEffectInfo ("animation:Focus Fade",
1480+ AnimEffectUsedFor::none().include(AnimEventFocus),
1481+ &createAnimation<FocusFadeAnim>,
1482+ true);
1483+
1484 animEffects[i++] = AnimEffectGlide1 =
1485- new AnimEffectInfo ("animation:Glide 1",
1486- AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1487- &createAnimation<GlideAnim>);
1488-
1489+ new AnimEffectInfo ("animation:Glide 1",
1490+ AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1491+ &createAnimation<GlideAnim>);
1492+
1493 animEffects[i++] = AnimEffectGlide2 =
1494- new AnimEffectInfo ("animation:Glide 2",
1495- AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1496- &createAnimation<Glide2Anim>);
1497-
1498+ new AnimEffectInfo ("animation:Glide 2",
1499+ AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1500+ &createAnimation<Glide2Anim>);
1501+
1502 animEffects[i++] = AnimEffectHorizontalFolds =
1503- new AnimEffectInfo ("animation:Horizontal Folds",
1504- AnimEffectUsedFor::all().exclude(AnimEventFocus),
1505- &createAnimation<HorizontalFoldsAnim>);
1506-
1507+ new AnimEffectInfo ("animation:Horizontal Folds",
1508+ AnimEffectUsedFor::all().exclude(AnimEventFocus),
1509+ &createAnimation<HorizontalFoldsAnim>);
1510+
1511 animEffects[i++] = AnimEffectMagicLamp =
1512- new AnimEffectInfo ("animation:Magic Lamp",
1513- AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1514- &createAnimation<MagicLampAnim>);
1515-
1516+ new AnimEffectInfo ("animation:Magic Lamp",
1517+ AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1518+ &createAnimation<MagicLampAnim>);
1519+
1520 animEffects[i++] = AnimEffectMagicLampWavy =
1521- new AnimEffectInfo ("animation:Magic Lamp Wavy",
1522- AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1523- &createAnimation<MagicLampWavyAnim>);
1524-
1525+ new AnimEffectInfo ("animation:Magic Lamp Wavy",
1526+ AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1527+ &createAnimation<MagicLampWavyAnim>);
1528+
1529 animEffects[i++] = AnimEffectRollUp =
1530- new AnimEffectInfo ("animation:Roll Up",
1531- AnimEffectUsedFor::none().include(AnimEventShade),
1532- &createAnimation<RollUpAnim>);
1533-
1534+ new AnimEffectInfo ("animation:Roll Up",
1535+ AnimEffectUsedFor::none().include(AnimEventShade),
1536+ &createAnimation<RollUpAnim>);
1537+
1538 animEffects[i++] = AnimEffectSidekick =
1539- new AnimEffectInfo ("animation:Sidekick",
1540- AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1541- &createAnimation<SidekickAnim>);
1542-
1543+ new AnimEffectInfo ("animation:Sidekick",
1544+ AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1545+ &createAnimation<SidekickAnim>);
1546+
1547 animEffects[i++] = AnimEffectWave =
1548- new AnimEffectInfo ("animation:Wave",
1549- AnimEffectUsedFor::all().exclude(AnimEventShade),
1550- &createAnimation<WaveAnim>);
1551-
1552+ new AnimEffectInfo ("animation:Wave",
1553+ AnimEffectUsedFor::all().exclude(AnimEventShade),
1554+ &createAnimation<WaveAnim>);
1555+
1556 animEffects[i++] = AnimEffectZoom =
1557- new AnimEffectInfo ("animation:Zoom",
1558- AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1559- &createAnimation<ZoomAnim>);
1560+ new AnimEffectInfo ("animation:Zoom",
1561+ AnimEffectUsedFor::all().exclude(AnimEventFocus).exclude(AnimEventShade),
1562+ &createAnimation<ZoomAnim>);
1563
1564 animExtensionPluginInfo.effectOptions = &getOptions ();
1565
1566@@ -2813,18 +2914,14 @@
1567 mPluginActive[i] = false;
1568
1569 if (w->minimized ())
1570- {
1571 mState = mNewState = IconicState;
1572- }
1573 else if (w->shaded ())
1574 {
1575 mState = mNewState = NormalState;
1576 mNowShaded = true;
1577 }
1578 else
1579- {
1580 mState = mNewState = getState ();
1581- }
1582
1583 WindowInterface::setHandler (mWindow, true);
1584 GLWindowInterface::setHandler (gWindow, false);
1585@@ -2846,27 +2943,34 @@
1586 mPAScreen->initiateMinimizeAnim (this);
1587 mEventNotOpenClose = true;
1588 break;
1589+
1590 case CompWindowNotifyLeaveShowDesktopMode:
1591 case CompWindowNotifyUnminimize:
1592 mPAScreen->initiateUnminimizeAnim (this);
1593 mEventNotOpenClose = true;
1594 break;
1595+
1596 case CompWindowNotifyShade:
1597 mPAScreen->initiateShadeAnim (this);
1598 mEventNotOpenClose = true;
1599 break;
1600+
1601 case CompWindowNotifyUnshade:
1602 if (mNowShaded &&
1603 mCurAnimation &&
1604 mCurAnimation->curWindowEvent () == WindowEventShade)
1605 mPAScreen->initiateUnshadeAnim (this); // reverse the shade anim
1606+
1607 break;
1608+
1609 case CompWindowNotifyClose:
1610 if (!(mCurAnimation &&
1611 (mCurAnimation->curWindowEvent () == WindowEventClose ||
1612 mCurAnimation->curWindowEvent () == WindowEventUnminimize)))
1613 mPAScreen->initiateCloseAnim (this);
1614+
1615 break;
1616+
1617 case CompWindowNotifyShow:
1618 case CompWindowNotifyBeforeMap:
1619 // Prevent dialog disappearing when a dialog is reopened during
1620@@ -2877,7 +2981,9 @@
1621 mPAScreen->initiateOpenAnim (this);
1622 mEventNotOpenClose = false;
1623 }
1624+
1625 break;
1626+
1627 case CompWindowNotifyMap:
1628 if (mNowShaded)
1629 mUnshadePending = true;
1630@@ -2890,7 +2996,9 @@
1631 mCurAnimation->curWindowEvent () == WindowEventOpen)))
1632 mPAScreen->initiateOpenAnim (this);
1633 mEventNotOpenClose = false;
1634+
1635 break;
1636+
1637 case CompWindowNotifyBeforeUnmap:
1638 if (mCurAnimation && mCurAnimation->curWindowEvent () == WindowEventMinimize)
1639 {
1640@@ -2898,28 +3006,29 @@
1641 mWindow->incrementUnmapReference ();
1642 }
1643 break;
1644+
1645 case CompWindowNotifyBeforeDestroy:
1646 if (!mFinishingAnim)
1647 {
1648- if (mPAScreen->shouldIgnoreWindowForAnim (mWindow, true))
1649- break;
1650-
1651- /* Don't increment the destroy reference count unless
1652- * the window is already animated */
1653- if (!mCurAnimation)
1654+ if (mPAScreen->shouldIgnoreWindowForAnim (mWindow, true) ||
1655+ /* Don't increment the destroy reference count unless
1656+ * the window is already animated */
1657+ !mCurAnimation)
1658 break;
1659
1660 ++mDestroyCnt;
1661 mWindow->incrementDestroyReference ();
1662 }
1663+
1664 break;
1665+
1666 case CompWindowNotifyUnreparent:
1667- if (!mFinishingAnim)
1668- {
1669- if (mPAScreen->shouldIgnoreWindowForAnim (mWindow, false))
1670- break;
1671- }
1672+ if (!mFinishingAnim &&
1673+ mPAScreen->shouldIgnoreWindowForAnim (mWindow, false))
1674+ break;
1675+
1676 break;
1677+
1678 case CompWindowNotifyFocusChange:
1679 if (!mPAScreen->mLastActiveWindow ||
1680 mPAScreen->mLastActiveWindow != mWindow->id ())
1681@@ -2942,6 +3051,7 @@
1682 }
1683
1684 break;
1685+
1686 case CompWindowNotifyRestack:
1687 {
1688 // Prevent menu disappearing when a menu is reopened during
1689@@ -2956,18 +3066,17 @@
1690 }
1691
1692 // Handle CompWindowNotifyRestack only when necessary.
1693- if (!mPAScreen->isRestackAnimPossible ())
1694- break;
1695-
1696- if (mPAScreen->mStartCountdown) // Don't animate at startup
1697+ if (!mPAScreen->isRestackAnimPossible () ||
1698+ mPAScreen->mStartCountdown) // Don't animate at startup
1699 break;
1700
1701 foreach (ExtensionPluginInfo *extPlugin,
1702- mPAScreen->mExtensionPlugins)
1703+ mPAScreen->mExtensionPlugins)
1704 extPlugin->handleRestackNotify (mAWindow);
1705
1706 break;
1707 }
1708+
1709 default:
1710 break;
1711 }
1712@@ -2983,8 +3092,8 @@
1713
1714 AnimEffect
1715 AnimScreen::getMatchingAnimSelection (CompWindow *w,
1716- AnimEvent e,
1717- int *duration)
1718+ AnimEvent e,
1719+ int *duration)
1720 {
1721 return priv->getMatchingAnimSelection (w, e, duration);
1722 }
1723@@ -3009,7 +3118,8 @@
1724
1725 /// If duration is 0, it should be set to a positive value later.
1726 void
1727-AnimWindow::createFocusAnimation (AnimEffect effect, int duration)
1728+AnimWindow::createFocusAnimation (AnimEffect effect,
1729+ int duration)
1730 {
1731 priv->createFocusAnimation (effect, duration);
1732 }
1733@@ -3017,8 +3127,8 @@
1734 void
1735 AnimWindow::deletePersistentData (const char *name)
1736 {
1737- PersistentDataMap::iterator itData =
1738- persistentData.find (name);
1739+ PersistentDataMap::iterator itData = persistentData.find (name);
1740+
1741 if (itData != persistentData.end ()) // if found
1742 {
1743 delete itData->second;
1744@@ -3027,13 +3137,13 @@
1745 }
1746
1747 void
1748-PrivateAnimWindow::createFocusAnimation (AnimEffect effect, int duration)
1749+PrivateAnimWindow::createFocusAnimation (AnimEffect effect,
1750+ int duration)
1751 {
1752- mCurAnimation =
1753- effect->create (mWindow, WindowEventFocus,
1754- duration,
1755- effect,
1756- CompRect ());
1757+ mCurAnimation = effect->create (mWindow, WindowEventFocus,
1758+ duration,
1759+ effect,
1760+ CompRect ());
1761 enablePainting (true);
1762 }
1763
1764@@ -3069,6 +3179,7 @@
1765
1766 // Destroy each persistent data object
1767 PersistentDataMap::iterator itData = persistentData.begin ();
1768+
1769 for (; itData != persistentData.end (); ++itData)
1770 delete itData->second;
1771
1772
1773=== modified file 'plugins/animation/src/curvedfold.cpp'
1774--- plugins/animation/src/curvedfold.cpp 2013-04-25 11:07:54 +0000
1775+++ plugins/animation/src/curvedfold.cpp 2013-07-24 17:39:26 +0000
1776@@ -63,11 +63,11 @@
1777 return progressLinear ();
1778 }
1779
1780-CurvedFoldAnim::CurvedFoldAnim (CompWindow *w,
1781- WindowEvent curWindowEvent,
1782- float duration,
1783+CurvedFoldAnim::CurvedFoldAnim (CompWindow *w,
1784+ WindowEvent curWindowEvent,
1785+ float duration,
1786 const AnimEffect info,
1787- const CompRect &icon) :
1788+ const CompRect &icon) :
1789 Animation::Animation (w, curWindowEvent, duration, info, icon),
1790 TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
1791 FoldAnim::FoldAnim (w, curWindowEvent, duration, info, icon)
1792@@ -83,10 +83,10 @@
1793
1794 float
1795 CurvedFoldAnim::getObjectZ (GridAnim::GridModel *mModel,
1796- float forwardProgress,
1797- float sinForProg,
1798- float relDistToCenter,
1799- float curveMaxAmp)
1800+ float forwardProgress,
1801+ float sinForProg,
1802+ float relDistToCenter,
1803+ float curveMaxAmp)
1804 {
1805 return -(sinForProg *
1806 (1 - pow (pow (2 * relDistToCenter, 1.3), 2)) *
1807@@ -102,24 +102,20 @@
1808 float forwardProgress = getActualProgress ();
1809
1810 CompRect winRect (mAWindow->savedRectsValid () ?
1811- mAWindow->saveWinRect () :
1812- mWindow->geometry ());
1813+ mAWindow->saveWinRect () : mWindow->geometry ());
1814 CompRect inRect (mAWindow->savedRectsValid () ?
1815- mAWindow->savedInRect () :
1816- mWindow->borderRect ());
1817+ mAWindow->savedInRect () : mWindow->borderRect ());
1818 CompRect outRect (mAWindow->savedRectsValid () ?
1819- mAWindow->savedOutRect () :
1820- mWindow->outputRect ());
1821+ mAWindow->savedOutRect () : mWindow->outputRect ());
1822 CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
1823- mAWindow->savedOutExtents () :
1824- mWindow->output ());
1825+ mAWindow->savedOutExtents () : mWindow->output ());
1826
1827- int wx = winRect.x ();
1828- int wy = winRect.y ();
1829+ int wx = winRect.x ();
1830+ int wy = winRect.y ();
1831 int wheight = winRect.height ();
1832
1833- int oy = outRect.y ();
1834- int owidth = outRect.width ();
1835+ int oy = outRect.y ();
1836+ int owidth = outRect.width ();
1837 int oheight = outRect.height ();
1838
1839 float curveMaxAmp = (0.4 * pow ((float)oheight /
1840@@ -130,6 +126,7 @@
1841
1842 GridModel::GridObject *object = mModel->objects ();
1843 unsigned int n = mModel->numObjects ();
1844+
1845 for (unsigned int i = 0; i < n; ++i, ++object)
1846 {
1847 Point3d &objPos = object->position ();
1848@@ -229,6 +226,7 @@
1849
1850 GridModel::GridObject *objects = mModel->objects ();
1851 unsigned int n = mModel->numObjects ();
1852+
1853 for (unsigned int i = 0; i < n; ++i)
1854 {
1855 Point3d &pos = objects[i].position ();
1856
1857=== modified file 'plugins/animation/src/dodge.cpp'
1858--- plugins/animation/src/dodge.cpp 2013-04-25 11:07:54 +0000
1859+++ plugins/animation/src/dodge.cpp 2013-07-24 17:39:26 +0000
1860@@ -57,7 +57,8 @@
1861 }
1862
1863 bool
1864-DodgeAnim::moveUpdate (int dx, int dy)
1865+DodgeAnim::moveUpdate (int dx,
1866+ int dy)
1867 {
1868 if (mDodgeData->isDodgeSubject &&
1869 mDodgeDirection == DodgeDirectionXY)
1870@@ -73,16 +74,19 @@
1871 // Update dodge amount for the dodgers of all subjects
1872 // in the restack chain
1873 RestackPersistentData *dataCur;
1874+
1875 for (CompWindow *wCur = wBottommost; wCur;
1876 wCur = dataCur->mMoreToBePaintedNext)
1877 {
1878 AnimWindow *awCur = AnimWindow::get (wCur);
1879 dataCur = static_cast<RestackPersistentData *>
1880 (awCur->persistentData["restack"]);
1881+
1882 if (!dataCur)
1883 break;
1884
1885 Animation *curAnim = awCur->curAnimation ();
1886+
1887 if (!curAnim || curAnim->info () != AnimEffectDodge)
1888 continue;
1889
1890@@ -99,14 +103,13 @@
1891
1892 DodgeAnim *animDodger =
1893 dynamic_cast<DodgeAnim *> (adw->curAnimation ());
1894+
1895 if (!animDodger)
1896 continue;
1897
1898 if (animDodger->mDodgeSubjectWin &&
1899 animDodger->mTransformProgress <= 0.5f)
1900- {
1901 animDodger->updateDodgerDodgeAmount ();
1902- }
1903 }
1904 }
1905
1906@@ -132,15 +135,11 @@
1907 if (((mDodgeDirection == DodgeDirectionDown && newDodgeAmount > 0) ||
1908 (mDodgeDirection == DodgeDirectionUp && newDodgeAmount < 0)) &&
1909 abs (newDodgeAmount) > abs (mDodgeMaxAmountY))
1910- {
1911 mDodgeMaxAmountY = newDodgeAmount;
1912- }
1913 else if (((mDodgeDirection == DodgeDirectionRight && newDodgeAmount > 0) ||
1914 (mDodgeDirection == DodgeDirectionLeft && newDodgeAmount < 0)) &&
1915 abs (newDodgeAmount) > abs (mDodgeMaxAmountX))
1916- {
1917 mDodgeMaxAmountX = newDodgeAmount;
1918- }
1919 }
1920
1921 float
1922@@ -160,9 +159,10 @@
1923 mTransformProgress = 0;
1924
1925 float forwardProgress = dodgeProgress ();
1926+
1927 if (forwardProgress > mTransformStartProgress)
1928 {
1929- // Compute transform progress and normalize
1930+ // Compute transform progress and normalize
1931 mTransformProgress =
1932 (forwardProgress - mTransformStartProgress) /
1933 (1 - mTransformStartProgress);
1934@@ -182,31 +182,32 @@
1935 DodgeAnim::postPreparePaint ()
1936 {
1937 // Only dodge subjects (with dodger chains) should be processed here
1938- if (!mDodgeData || !mDodgeData->isDodgeSubject ||
1939- !mDodgeData->dodgeChainStart)
1940- return;
1941-
1942- if (!mRestackData || !mRestackData->restackInfo ())
1943- return;
1944-
1945- if (mDodgeData->skipPostPrepareScreen)
1946+ if (!mDodgeData ||
1947+ !mDodgeData->isDodgeSubject ||
1948+ !mDodgeData->dodgeChainStart ||
1949+ !mRestackData ||
1950+ !mRestackData->restackInfo () ||
1951+ mDodgeData->skipPostPrepareScreen)
1952 return;
1953
1954 // Find the bottommost subject in restack chain
1955 CompWindow *wBottommost = mWindow;
1956 RestackPersistentData *dataCur;
1957+
1958 for (CompWindow *wCur = mRestackData->mMoreToBePaintedPrev; wCur;
1959- wCur = dataCur->mMoreToBePaintedPrev)
1960+ wCur = dataCur->mMoreToBePaintedPrev)
1961 {
1962- wBottommost = wCur;
1963- dataCur = static_cast<RestackPersistentData *>
1964- (AnimWindow::get (wCur)->persistentData["restack"]);
1965- if (!dataCur)
1966- break;
1967+ wBottommost = wCur;
1968+ dataCur = static_cast<RestackPersistentData *>
1969+ (AnimWindow::get (wCur)->persistentData["restack"]);
1970+
1971+ if (!dataCur)
1972+ break;
1973 }
1974+
1975 AnimWindow *awBottommost = AnimWindow::get (wBottommost);
1976 RestackPersistentData *restackDataBottommost =
1977- static_cast<RestackPersistentData *>
1978+ static_cast<RestackPersistentData *>
1979 (awBottommost->persistentData["restack"]);
1980
1981 // Find the first dodging window that hasn't yet
1982@@ -215,11 +216,14 @@
1983 // if subject is being lowered).
1984 RestackPersistentData *restackDataDodger = NULL;
1985 DodgePersistentData *dodgeDataDodger = NULL;
1986+
1987 CompWindow *dw;
1988+
1989 for (dw = mDodgeData->dodgeChainStart; dw;
1990 dw = dodgeDataDodger->dodgeChainNext)
1991 {
1992 AnimWindow *adw = AnimWindow::get (dw);
1993+
1994 restackDataDodger = static_cast<RestackPersistentData *>
1995 (adw->persistentData["restack"]);
1996 dodgeDataDodger = static_cast<DodgePersistentData *>
1997@@ -233,12 +237,13 @@
1998 }
1999
2000 RestackInfo *bottommostRestackInfo = restackDataBottommost->restackInfo ();
2001+
2002 if (!bottommostRestackInfo)
2003 return;
2004
2005 if (bottommostRestackInfo->raised &&
2006 // if mWindow's host should change
2007- dw != restackDataBottommost->mWinThisIsPaintedBefore)
2008+ dw != restackDataBottommost->mWinThisIsPaintedBefore)
2009 {
2010 if (restackDataBottommost->mWinThisIsPaintedBefore)
2011 {
2012@@ -252,13 +257,12 @@
2013 }
2014 // if a dodger win. is still at <0.5 progress
2015 if (dw && restackDataDodger)
2016- {
2017 // Put subject right behind new host
2018 restackDataDodger->mWinToBePaintedBeforeThis = wBottommost;
2019- }
2020+
2021 // otherwise all dodger win.s have passed 0.5 progress
2022-
2023 CompWindow *wCur = wBottommost;
2024+
2025 while (wCur)
2026 {
2027 RestackPersistentData *dataCur =
2028@@ -281,14 +285,11 @@
2029 if (dw && dodgeDataDodger)
2030 {
2031 if (dodgeDataDodger->dodgeChainPrev)
2032- {
2033 wDodgeChainAbove = dodgeDataDodger->dodgeChainPrev;
2034- }
2035 else
2036- {
2037 // Use the wOldAbove of topmost subject
2038 wDodgeChainAbove = mRestackData->restackInfo ()->wOldAbove;
2039- }
2040+
2041 if (!wDodgeChainAbove)
2042 compLogMessage ("animation", CompLogLevelError,
2043 "%s: error at line %d", __FILE__, __LINE__);
2044@@ -318,6 +319,7 @@
2045 // otherwise all dodger win.s have passed 0.5 progress
2046
2047 CompWindow *wCur = wBottommost;
2048+
2049 while (wCur)
2050 {
2051 RestackPersistentData *dataCur =
2052@@ -335,7 +337,7 @@
2053 {
2054 // for dodging windows only, when subject is fixed
2055 return !(mDodgeMode == AnimationOptions::DodgeModeFixedClickedWindow &&
2056- mDodgeData->isDodgeSubject);
2057+ mDodgeData->isDodgeSubject);
2058 }
2059
2060 void
2061@@ -344,11 +346,11 @@
2062 TransformAnim::updateBB (output);
2063 }
2064
2065-DodgeAnim::DodgeAnim (CompWindow *w,
2066- WindowEvent curWindowEvent,
2067- float duration,
2068+DodgeAnim::DodgeAnim (CompWindow *w,
2069+ WindowEvent curWindowEvent,
2070+ float duration,
2071 const AnimEffect info,
2072- const CompRect &icon) :
2073+ const CompRect &icon) :
2074 Animation::Animation (w, curWindowEvent, duration, info, icon),
2075 RestackAnim::RestackAnim (w, curWindowEvent, duration, info, icon),
2076 TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
2077@@ -369,7 +371,7 @@
2078 // Remove this window from its subject's dodger chain
2079 if (mDodgeSubjectWin)
2080 {
2081- CompWindow *w = mDodgeSubjectWin;
2082+ CompWindow *w = mDodgeSubjectWin;
2083 AnimWindow *aw = AnimWindow::get (w);
2084 Animation *curAnim = aw->curAnimation ();
2085 DodgePersistentData *dodgeData = static_cast<DodgePersistentData *>
2086@@ -389,10 +391,12 @@
2087 AnimWindow *adw = AnimWindow::get (dw);
2088 dodgeDataDodger = static_cast<DodgePersistentData *>
2089 (adw->persistentData["dodge"]);
2090+
2091 if (dw == mWindow)
2092 {
2093 // Remove mWindow from the chain
2094 CompWindow *dwNext = dodgeDataDodger->dodgeChainNext;
2095+
2096 if (dwNext)
2097 {
2098 AnimWindow *adwNext = AnimWindow::get (dwNext);
2099@@ -402,7 +406,9 @@
2100 dodgeDataDodgerNext->dodgeChainPrev =
2101 dodgeDataDodger->dodgeChainPrev;
2102 }
2103+
2104 CompWindow *dwPrev = dodgeDataDodger->dodgeChainPrev;
2105+
2106 if (dwPrev)
2107 {
2108 AnimWindow *adwPrev = AnimWindow::get (dwPrev);
2109@@ -412,9 +418,11 @@
2110 dodgeDataDodgerPrev->dodgeChainNext =
2111 dodgeDataDodger->dodgeChainNext;
2112 }
2113+
2114 if (dodgeData->dodgeChainStart == mWindow)
2115 dodgeData->dodgeChainStart =
2116 dodgeDataDodger->dodgeChainNext;
2117+
2118 dodgeDataDodger->dodgeChainPrev = 0;
2119 dodgeDataDodger->dodgeChainNext = 0;
2120 }
2121@@ -431,12 +439,15 @@
2122 // Update this window's dodgers so that they no longer point
2123 // to this window as their subject
2124 DodgePersistentData *dodgeDataDodger;
2125+
2126 for (CompWindow *dw = dodgeData->dodgeChainStart; dw;
2127 dw = dodgeDataDodger->dodgeChainNext)
2128 {
2129 AnimWindow *adw = AnimWindow::get (dw);
2130+
2131 if (!adw)
2132 break;
2133+
2134 dodgeDataDodger = static_cast<DodgePersistentData *>
2135 (adw->persistentData["dodge"]);
2136
2137@@ -445,6 +456,7 @@
2138 if (curAnim && curAnim->info () == AnimEffectDodge)
2139 {
2140 DodgeAnim *animDodger = dynamic_cast<DodgeAnim *> (curAnim);
2141+
2142 if (animDodger->mDodgeSubjectWin == mWindow)
2143 animDodger->mDodgeSubjectWin = NULL;
2144 }
2145@@ -463,8 +475,8 @@
2146 }
2147
2148 int
2149-DodgeAnim::getDodgeAmount (CompRect &rect,
2150- CompWindow *dw,
2151+DodgeAnim::getDodgeAmount (CompRect &rect,
2152+ CompWindow *dw,
2153 DodgeDirection dir)
2154 {
2155 CompRect dRect (dw->borderRect ().x () +
2156@@ -477,23 +489,29 @@
2157 dw->outputRect ().height ()) / 2);
2158
2159 int amount = 0;
2160+
2161 switch (dir)
2162 {
2163 case DodgeDirectionUp:
2164 amount = (rect.y () - (dRect.y () + dRect.height ()));
2165 break;
2166+
2167 case DodgeDirectionDown:
2168 amount = (rect.y () + rect.height () - dRect.y ());
2169 break;
2170+
2171 case DodgeDirectionLeft:
2172 amount = (rect.x () - (dRect.x () + dRect.width ()));
2173 break;
2174+
2175 case DodgeDirectionRight:
2176 amount = (rect.x () + rect.width () - dRect.x ());
2177 break;
2178+
2179 default:
2180 break;
2181 }
2182+
2183 return amount;
2184 }
2185
2186@@ -501,41 +519,45 @@
2187 DodgeAnim::processCandidate (CompWindow *candidateWin,
2188 CompWindow *subjectWin,
2189 CompRegion &candidateAndSubjectIntersection,
2190- int &numSelectedCandidates)
2191+ int &numSelectedCandidates)
2192 {
2193 AnimWindow *aCandidateWin = AnimWindow::get (candidateWin);
2194- AnimScreen *as = AnimScreen::get (::screen);
2195+ AnimScreen *as = AnimScreen::get (::screen);
2196
2197 if ((!aCandidateWin->curAnimation () ||
2198 aCandidateWin->curAnimation ()->info () == AnimEffectDodge) &&
2199 candidateWin != subjectWin) // don't let the subject dodge itself
2200 {
2201 // Mark this window for dodge
2202-
2203 bool nonMatching = false;
2204+
2205 if (as->getMatchingAnimSelection (candidateWin, AnimEventFocus, 0) !=
2206 AnimEffectDodge)
2207 nonMatching = true;
2208
2209 ++numSelectedCandidates;
2210+
2211 DodgePersistentData *data = static_cast<DodgePersistentData *>
2212 (aCandidateWin->persistentData["dodge"]);
2213+
2214 data->dodgeOrder = numSelectedCandidates;
2215+
2216 if (nonMatching) // Use neg. values for non-matching windows
2217 data->dodgeOrder *= -1;
2218 }
2219 }
2220
2221 void
2222-DodgeAnim::postInitiateRestackAnim (int numSelectedCandidates,
2223- int duration,
2224+DodgeAnim::postInitiateRestackAnim (int numSelectedCandidates,
2225+ int duration,
2226 CompWindow *wStart,
2227 CompWindow *wEnd,
2228- bool raised)
2229+ bool raised)
2230 {
2231 DodgePersistentData *dataSubject = mDodgeData;
2232+
2233 if (!dataSubject)
2234- return;
2235+ return;
2236
2237 dataSubject->isDodgeSubject = true;
2238 dataSubject->dodgeChainStart = 0;
2239@@ -564,11 +586,13 @@
2240 // Initiate dodge for this window
2241
2242 bool stationaryDodger = false;
2243+
2244 if (dataDodger->dodgeOrder < 0)
2245 {
2246 dataDodger->dodgeOrder *= -1; // Make it positive again
2247 stationaryDodger = true;
2248 }
2249+
2250 if (!adw->curAnimation ())
2251 {
2252 // Create dodge animation for dodger
2253@@ -579,8 +603,7 @@
2254 extPlugin->incrementCurRestackAnimCount ();
2255 }
2256
2257- DodgeAnim *animDodger =
2258- dynamic_cast<DodgeAnim *> (adw->curAnimation ());
2259+ DodgeAnim *animDodger = dynamic_cast<DodgeAnim *> (adw->curAnimation ());
2260
2261 animDodger->mDodgeSubjectWin = mWindow;
2262
2263@@ -598,8 +621,7 @@
2264 (1 - (float)dataDodger->dodgeOrder / numSelectedCandidates);
2265 }
2266
2267- float transformTotalProgress =
2268- 1 + animDodger->mTransformStartProgress;
2269+ float transformTotalProgress = 1 + animDodger->mTransformStartProgress;
2270
2271 if (maxTransformTotalProgress < transformTotalProgress)
2272 maxTransformTotalProgress = transformTotalProgress;
2273@@ -625,17 +647,15 @@
2274 static_cast<DodgePersistentData *>
2275 (AnimWindow::get (wDodgeChainLastVisited)->
2276 persistentData["dodge"]);
2277+
2278 if (raised)
2279- {
2280 dataDodgeChainLastVisited->dodgeChainNext = dw;
2281- }
2282 else
2283 dataDodgeChainLastVisited->dodgeChainPrev = dw;
2284 }
2285 else if (raised) // mark chain start
2286- {
2287 dataSubject->dodgeChainStart = dw;
2288- }
2289+
2290 if (raised)
2291 {
2292 dataDodger->dodgeChainPrev = wDodgeChainLastVisited;
2293@@ -679,6 +699,7 @@
2294 // Go through each dodger, calculating its dodge amount.
2295 // dw: Dodger window
2296 DodgePersistentData *dodgeDataDodger;
2297+
2298 for (CompWindow *dw = mDodgeData->dodgeChainStart; dw;
2299 dw = dodgeDataDodger->dodgeChainNext)
2300 {
2301@@ -687,8 +708,8 @@
2302 dodgeDataDodger = static_cast<DodgePersistentData *>
2303 (adw->persistentData["dodge"]);
2304
2305- DodgeAnim *animDodger =
2306- dynamic_cast<DodgeAnim *> (adw->curAnimation ());
2307+ DodgeAnim *animDodger = dynamic_cast<DodgeAnim *> (adw->curAnimation ());
2308+
2309 if (!animDodger)
2310 continue;
2311
2312@@ -703,9 +724,11 @@
2313 int amountMinActual = dodgeAmount[0];
2314 int amountMinAbs = abs (amountMinActual);
2315 int iMin = 0;
2316- for (int i=1; i < 4; ++i)
2317+
2318+ for (int i = 1; i < 4; ++i)
2319 {
2320 int absAmount = abs (dodgeAmount[i]);
2321+
2322 if (amountMinAbs > absAmount)
2323 {
2324 amountMinAbs = absAmount;
2325@@ -713,11 +736,13 @@
2326 iMin = i;
2327 }
2328 }
2329+
2330 if (iMin == DodgeDirectionUp ||
2331 iMin == DodgeDirectionDown)
2332 {
2333 animDodger->mDodgeMaxAmountX = 0;
2334 animDodger->mDodgeMaxAmountY = dodgeAmount[iMin];
2335+
2336 if (mDodgeMode == AnimationOptions::DodgeModeAllMoving &&
2337 maxDistY < amountMinAbs)
2338 {
2339@@ -729,6 +754,7 @@
2340 {
2341 animDodger->mDodgeMaxAmountX = dodgeAmount[iMin];
2342 animDodger->mDodgeMaxAmountY = 0;
2343+
2344 if (mDodgeMode == AnimationOptions::DodgeModeAllMoving && maxDistX < amountMinAbs)
2345 {
2346 maxDistX = amountMinAbs;
2347@@ -786,13 +812,16 @@
2348 AnimWindow *awCur = AnimWindow::get (wCur);
2349
2350 dataCur = static_cast<RestackPersistentData *>
2351- (awCur->persistentData["restack"]);
2352+ (awCur->persistentData["restack"]);
2353+
2354 if (!dataCur)
2355- break;
2356+ break;
2357
2358 Animation *curAnim = awCur->curAnimation ();
2359+
2360 if (!curAnim || curAnim->info () != AnimEffectDodge)
2361 continue;
2362+
2363 DodgeAnim *dodgeAnim = dynamic_cast<DodgeAnim *> (curAnim);
2364
2365 dodgeAnim->mDodgeMaxAmountX = dodgeAmountX + offsetX;
2366@@ -808,6 +837,7 @@
2367 // subject(s) is dodging in that axis (X or Y).
2368 // dw: Dodger window
2369 DodgePersistentData *dodgeDataDodger;
2370+
2371 for (CompWindow *dw = mDodgeData->dodgeChainStart; dw;
2372 dw = dodgeDataDodger->dodgeChainNext)
2373 {
2374@@ -818,6 +848,7 @@
2375
2376 DodgeAnim *animDodger =
2377 dynamic_cast<DodgeAnim *> (adw->curAnimation ());
2378+
2379 if (!animDodger)
2380 continue;
2381
2382@@ -825,11 +856,9 @@
2383 if (subjectDodgesInX && animDodger->mDodgeMaxAmountX != 0)
2384 {
2385 if (animDodger->mDodgeMaxAmountX *
2386- (animDodger->mDodgeMaxAmountX + dodgeAmountX) < 0)
2387- {
2388- // If the sign is going to change, just reset instead
2389+ (animDodger->mDodgeMaxAmountX + dodgeAmountX) < 0)
2390+ // If the sign is going to change, just reset instead
2391 animDodger->mDodgeMaxAmountX = 0;
2392- }
2393 else
2394 animDodger->mDodgeMaxAmountX += dodgeAmountX;
2395 }
2396@@ -838,13 +867,13 @@
2397 if (subjectDodgesInY && animDodger->mDodgeMaxAmountY != 0)
2398 {
2399 if (animDodger->mDodgeMaxAmountY *
2400- (animDodger->mDodgeMaxAmountY + dodgeAmountY) < 0)
2401+ (animDodger->mDodgeMaxAmountY + dodgeAmountY) < 0)
2402 {
2403- // If the sign is going to change, just reset instead
2404+ // If the sign is going to change, just reset instead
2405 animDodger->mDodgeMaxAmountY = 0;
2406 }
2407 else
2408- animDodger->mDodgeMaxAmountY += dodgeAmountY;
2409+ animDodger->mDodgeMaxAmountY += dodgeAmountY;
2410 }
2411 }
2412 }
2413@@ -873,4 +902,3 @@
2414 dodgeChainNext (0)
2415 {
2416 }
2417-
2418
2419=== modified file 'plugins/animation/src/dream.cpp'
2420--- plugins/animation/src/dream.cpp 2013-04-25 11:07:54 +0000
2421+++ plugins/animation/src/dream.cpp 2013-07-24 17:39:26 +0000
2422@@ -40,11 +40,11 @@
2423
2424 // ===================== Effect: Dream =========================
2425
2426-DreamAnim::DreamAnim (CompWindow *w,
2427- WindowEvent curWindowEvent,
2428- float duration,
2429+DreamAnim::DreamAnim (CompWindow *w,
2430+ WindowEvent curWindowEvent,
2431+ float duration,
2432 const AnimEffect info,
2433- const CompRect &icon) :
2434+ const CompRect &icon) :
2435 Animation::Animation (w, curWindowEvent, duration, info, icon),
2436 TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
2437 GridZoomAnim::GridZoomAnim (w, curWindowEvent, duration, info, icon)
2438@@ -74,7 +74,7 @@
2439 void
2440 DreamAnim::initGrid ()
2441 {
2442- mGridWidth = 2;
2443+ mGridWidth = 2;
2444 mGridHeight = optValI (AnimationOptions::MagicLampWavyGridRes); // TODO new option
2445 }
2446
2447@@ -98,15 +98,16 @@
2448 int wx = winRect.x ();
2449 int wy = winRect.y ();
2450
2451- int owidth = outRect.width ();
2452+ int owidth = outRect.width ();
2453 int oheight = outRect.height ();
2454
2455 float waveAmpMax = MIN (oheight, owidth) * 0.125f;
2456- float waveWidth = 10.0f;
2457- float waveSpeed = 7.0f;
2458+ float waveWidth = 10.0f;
2459+ float waveSpeed = 7.0f;
2460
2461 GridModel::GridObject *object = mModel->objects ();
2462 unsigned int n = mModel->numObjects ();
2463+
2464 for (unsigned int i = 0; i < n; ++i, ++object)
2465 {
2466 Point3d &objPos = object->position ();
2467@@ -132,8 +133,7 @@
2468 objPos.setX (
2469 origx +
2470 forwardProgress * waveAmpMax * mModel->scale ().x () *
2471- sin (objGridPos.y () * M_PI * waveWidth +
2472- waveSpeed * forwardProgress));
2473+ sin (objGridPos.y () * M_PI * waveWidth + waveSpeed * forwardProgress));
2474 }
2475 }
2476
2477@@ -153,4 +153,3 @@
2478 mCurWindowEvent == WindowEventUnminimize) &&
2479 optValB (AnimationOptions::DreamZoomToTaskbar));
2480 }
2481-
2482
2483=== modified file 'plugins/animation/src/extensionplugin.cpp'
2484--- plugins/animation/src/extensionplugin.cpp 2013-04-25 11:07:54 +0000
2485+++ plugins/animation/src/extensionplugin.cpp 2013-07-24 17:39:26 +0000
2486@@ -38,11 +38,11 @@
2487
2488
2489 ExtensionPluginAnimation::ExtensionPluginAnimation
2490- (const CompString &name,
2491- unsigned int nEffects,
2492- AnimEffect *effects,
2493+ (const CompString &name,
2494+ unsigned int nEffects,
2495+ AnimEffect *effects,
2496 CompOption::Vector *effectOptions,
2497- unsigned int firstEffectOptionIndex) :
2498+ unsigned int firstEffectOptionIndex) :
2499 ExtensionPluginInfo (name, nEffects, effects, effectOptions,
2500 firstEffectOptionIndex),
2501 mAWinWasRestackedJustNow (false),
2502@@ -64,8 +64,8 @@
2503 void
2504 ExtensionPluginAnimation::cleanUpParentChildChainItem (AnimWindow *aw)
2505 {
2506- PersistentDataMap::iterator itData =
2507- aw->persistentData.find ("restack");
2508+ PersistentDataMap::iterator itData = aw->persistentData.find ("restack");
2509+
2510 if (itData != aw->persistentData.end ()) // if found
2511 {
2512 RestackPersistentData *restackData =
2513@@ -77,15 +77,18 @@
2514 RestackPersistentData *dataOther = static_cast<RestackPersistentData *>
2515 (AnimWindow::get (restackData->mWinThisIsPaintedBefore)->
2516 persistentData["restack"]);
2517+
2518 if (dataOther)
2519 dataOther->mWinToBePaintedBeforeThis = 0;
2520 }
2521+
2522 restackData->mWinThisIsPaintedBefore = 0;
2523 restackData->mMoreToBePaintedPrev = 0;
2524 restackData->mMoreToBePaintedNext = 0;
2525 }
2526
2527 itData = aw->persistentData.find ("dodge");
2528+
2529 if (itData != aw->persistentData.end ()) // if found
2530 {
2531 DodgePersistentData *dodgeData =
2532@@ -99,8 +102,9 @@
2533 bool
2534 ExtensionPluginAnimation::paintShouldSkipWindow (CompWindow *w)
2535 {
2536- AnimWindow *aw = AnimWindow::get (w);
2537+ AnimWindow *aw = AnimWindow::get (w);
2538 PersistentDataMap::iterator itData = aw->persistentData.find ("restack");
2539+
2540 if (itData != aw->persistentData.end ()) // if found
2541 {
2542 RestackPersistentData *data =
2543@@ -115,6 +119,7 @@
2544 dynamic_cast<RestackAnim *> (aw->curAnimation ())->paintedElsewhere ())
2545 return true;
2546 }
2547+
2548 return false;
2549 }
2550
2551@@ -123,6 +128,7 @@
2552 ExtensionPluginAnimation::relevantForRestackAnim (CompWindow *w)
2553 {
2554 unsigned int wmType = w->wmType ();
2555+
2556 if (!((wmType &
2557 // these two are to be used as "host" windows
2558 // to host the painting of windows being focused
2559@@ -144,30 +150,33 @@
2560 if (!mAWinWasRestackedJustNow)
2561 return;
2562
2563- bool focusAnimInitiated = false;
2564- AnimScreen *as = AnimScreen::get (::screen);
2565+ bool focusAnimInitiated = false;
2566+ AnimScreen *as = AnimScreen::get (::screen);
2567
2568 // Go in reverse order so that restack chains are handled properly
2569 for (CompWindowVector::reverse_iterator rit = mLastClientList.rbegin ();
2570 rit != mLastClientList.rend (); ++rit)
2571 {
2572- CompWindow *w = (*rit);
2573+ CompWindow *w = (*rit);
2574 AnimWindow *aw = AnimWindow::get (w);
2575 RestackPersistentData *data = static_cast<RestackPersistentData *>
2576 (aw->persistentData["restack"]);
2577+
2578 if (!data)
2579 continue;
2580+
2581 RestackInfo *restackInfo = data->restackInfo ();
2582+
2583 if (!restackInfo)
2584 continue;
2585
2586 data->mIsSecondary = false;
2587
2588- if (as->otherPluginsActive () ||
2589+ if (as->otherPluginsActive () ||
2590 // Don't initiate focus anim for current dodgers
2591- aw->curAnimation () ||
2592+ aw->curAnimation () ||
2593 // Don't initiate focus anim for windows being passed thru
2594- data->mWinPassingThrough ||
2595+ data->mWinPassingThrough ||
2596 // Don't animate with stale restack info
2597 !restackInfoStillGood (restackInfo))
2598 {
2599@@ -177,11 +186,10 @@
2600
2601 // Find the first window at a higher stacking order than w
2602 CompWindow *nw;
2603+
2604 for (nw = w->next; nw; nw = nw->next)
2605- {
2606 if (relevantForRestackAnim (nw))
2607 break;
2608- }
2609
2610 // If w is being lowered, there has to be a window
2611 // at a higher stacking position than w (like a panel)
2612@@ -208,7 +216,7 @@
2613 if (dataNext && dataNext->restackInfo () &&
2614 wontCreateCircularChain (w, nw))
2615 {
2616- // Link the two
2617+ // Link the two
2618 dataNext->mMoreToBePaintedPrev = w;
2619 data->mMoreToBePaintedNext = nw;
2620
2621@@ -233,10 +241,12 @@
2622 AnimWindow *aw = AnimWindow::get (w);
2623 RestackPersistentData *data = static_cast<RestackPersistentData *>
2624 (aw->persistentData["restack"]);
2625+
2626 if (!data)
2627 continue;
2628
2629 RestackInfo *restackInfo = data->restackInfo ();
2630+
2631 if (restackInfo)
2632 {
2633 if (as->initiateFocusAnim (aw))
2634@@ -249,22 +259,24 @@
2635 if (!focusAnimInitiated)
2636 resetStackingInfo ();
2637
2638- if (!focusAnimInitiated ||
2639- as->otherPluginsActive () ||
2640+ if (!focusAnimInitiated ||
2641+ as->otherPluginsActive () ||
2642 !as->isAnimEffectPossible (AnimEffectDodge)) // Only dodge stuff below
2643 return;
2644
2645 // Calculate dodge amounts
2646 foreach (CompWindow *w, mLastClientList)
2647 {
2648- AnimWindow *aw = AnimWindow::get (w);
2649- Animation *curAnim = aw->curAnimation ();
2650+ AnimWindow *aw = AnimWindow::get (w);
2651+ Animation *curAnim = aw->curAnimation ();
2652+
2653 if (!curAnim || curAnim->info () != AnimEffectDodge)
2654 continue;
2655
2656 // Only process subjects with a dodge chain
2657 DodgePersistentData *dodgeData = static_cast<DodgePersistentData *>
2658 (aw->persistentData["dodge"]);
2659+
2660 if (!dodgeData || !dodgeData->dodgeChainStart ||
2661 !dodgeData->isDodgeSubject)
2662 continue;
2663@@ -276,30 +288,36 @@
2664 for (CompWindowVector::reverse_iterator rit = mLastClientList.rbegin ();
2665 rit != mLastClientList.rend (); ++rit)
2666 {
2667- CompWindow *w = (*rit);
2668- AnimWindow *aw = AnimWindow::get (w);
2669+ CompWindow *w = (*rit);
2670+ AnimWindow *aw = AnimWindow::get (w);
2671 PersistentDataMap::iterator itData = aw->persistentData.find ("dodge");
2672+
2673 if (itData == aw->persistentData.end ()) // if not found
2674 continue;
2675
2676 DodgePersistentData *data = static_cast<DodgePersistentData *>
2677 (itData->second);
2678+
2679 if (!data->isDodgeSubject)
2680 continue;
2681
2682 bool dodgersAreOnlySubjects = true;
2683 CompWindow *dw;
2684 DodgePersistentData *dataDodger;
2685+
2686 for (dw = data->dodgeChainStart; dw;
2687 dw = dataDodger->dodgeChainNext)
2688 {
2689 dataDodger = static_cast<DodgePersistentData *>
2690 (AnimWindow::get (dw)->persistentData["dodge"]);
2691+
2692 if (!dataDodger)
2693 break;
2694+
2695 if (!dataDodger->isDodgeSubject)
2696 dodgersAreOnlySubjects = false;
2697 }
2698+
2699 if (dodgersAreOnlySubjects)
2700 data->skipPostPrepareScreen = true;
2701 }
2702@@ -312,24 +330,23 @@
2703
2704 // Only handle restack notifies when the window is (or was) on the client
2705 // list (i.e. not for menus, combos, etc.).
2706- if (find (clients.begin (), clients.end (), aw->mWindow) ==
2707- clients.end () &&
2708- find (mLastClientList.begin (), mLastClientList.end (), aw->mWindow) ==
2709- mLastClientList.end ())
2710+ if (find (clients.begin (), clients.end (), aw->mWindow) == clients.end () &&
2711+ find (mLastClientList.begin (), mLastClientList.end (), aw->mWindow) ==
2712+ mLastClientList.end ())
2713 return;
2714
2715 bool winOpenedClosed = false;
2716 unsigned int n = clients.size ();
2717
2718 if (n != mLastClientList.size ())
2719- {
2720 winOpenedClosed = true;
2721- }
2722+
2723 // if restacking occurred and not window open/close
2724 if (!winOpenedClosed)
2725 {
2726 RestackPersistentData *data = static_cast<RestackPersistentData *>
2727 (aw->persistentData["restack"]);
2728+
2729 data->mConfigureNotified = true;
2730
2731 // Find which window is restacked
2732@@ -394,9 +411,9 @@
2733 bool preferRaised = false;
2734 bool onlyTwo = false;
2735
2736- if (wChangeEnd &&
2737+ if (wChangeEnd &&
2738 clients[(unsigned)changeEnd] ==
2739- mLastClientList[(unsigned)changeStart] &&
2740+ mLastClientList[(unsigned)changeStart] &&
2741 clients[(unsigned)changeStart] ==
2742 mLastClientList[(unsigned)changeEnd])
2743 {
2744@@ -406,6 +423,7 @@
2745 static_cast<RestackPersistentData *>
2746 (AnimWindow::get (wChangeEnd)->
2747 persistentData["restack"]);
2748+
2749 if (data->mConfigureNotified)
2750 preferRaised = true;
2751
2752@@ -417,6 +435,7 @@
2753 RestackPersistentData *data =
2754 static_cast<RestackPersistentData *>
2755 (AnimWindow::get (w2)->persistentData["restack"]);
2756+
2757 data->mConfigureNotified = false;
2758 }
2759
2760@@ -445,11 +464,10 @@
2761 wEnd = wChangeEnd;
2762 wOldAbove = mLastClientList[(unsigned)(changeEnd + 1)];
2763 }
2764+
2765 for (; wOldAbove; wOldAbove = wOldAbove->next)
2766- {
2767 if (!wOldAbove->destroyed ())
2768 break;
2769- }
2770 }
2771
2772 if (wRestacked && wStart && wEnd && wOldAbove)
2773@@ -500,7 +518,7 @@
2774
2775 void
2776 ExtensionPluginAnimation::postUpdateEventEffects (AnimEvent e,
2777- bool forRandom)
2778+ bool forRandom)
2779 {
2780 AnimScreen *as = AnimScreen::get (::screen);
2781
2782@@ -521,9 +539,11 @@
2783 if (aw->persistentData.find ("restack") !=
2784 aw->persistentData.end ())
2785 continue;
2786+
2787 aw->persistentData["restack"] = new RestackPersistentData ();
2788 }
2789 }
2790+
2791 if (as->isAnimEffectPossible (AnimEffectDodge))
2792 {
2793 foreach (CompWindow *w, CompositeScreen::get (::screen)->getWindowPaintList ())
2794@@ -533,6 +553,7 @@
2795 if (aw->persistentData.find ("dodge") !=
2796 aw->persistentData.end ())
2797 continue;
2798+
2799 aw->persistentData["dodge"] = new DodgePersistentData ();
2800 }
2801 }
2802@@ -550,19 +571,15 @@
2803 if (as->isRestackAnimPossible () &&
2804 // doesn't exist yet
2805 aw->persistentData.find ("restack") == aw->persistentData.end ())
2806- {
2807 aw->persistentData["restack"] = new RestackPersistentData ();
2808- }
2809+
2810 if (as->isAnimEffectPossible (AnimEffectDodge) &&
2811 // doesn't exist yet
2812 aw->persistentData.find ("dodge") == aw->persistentData.end ())
2813- {
2814 aw->persistentData["dodge"] = new DodgePersistentData ();
2815- }
2816+
2817 if (aw->persistentData.find ("multi") == aw->persistentData.end ())
2818- {
2819 aw->persistentData["multi"] = new MultiPersistentData ();
2820- }
2821 }
2822
2823 void
2824@@ -595,9 +612,9 @@
2825 bool
2826 ExtensionPluginAnimation::restackInfoStillGood (RestackInfo *restackInfo)
2827 {
2828- bool wStartGood = false;
2829- bool wEndGood = false;
2830- bool wOldAboveGood = false;
2831+ bool wStartGood = false;
2832+ bool wEndGood = false;
2833+ bool wOldAboveGood = false;
2834 bool wRestackedGood = false;
2835
2836 foreach (CompWindow *w, CompositeScreen::get (::screen)->getWindowPaintList ())
2837@@ -609,13 +626,17 @@
2838
2839 if (restackInfo->wStart == w)
2840 wStartGood = true;
2841+
2842 if (restackInfo->wEnd == w)
2843 wEndGood = true;
2844+
2845 if (restackInfo->wRestacked == w)
2846 wRestackedGood = true;
2847+
2848 if (restackInfo->wOldAbove == w)
2849 wOldAboveGood = true;
2850 }
2851+
2852 return (wStartGood && wEndGood && wOldAboveGood && wRestackedGood);
2853 }
2854
2855@@ -626,13 +647,15 @@
2856 foreach (CompWindow *w, CompositeScreen::get (::screen)->getWindowPaintList ())
2857 {
2858 AnimWindow *aw = AnimWindow::get (w);
2859- PersistentDataMap::iterator itData =
2860- aw->persistentData.find ("restack");
2861+ PersistentDataMap::iterator itData = aw->persistentData.find ("restack");
2862+
2863 if (itData != aw->persistentData.end ()) // if found
2864 {
2865 RestackPersistentData *data =
2866 static_cast<RestackPersistentData *> (itData->second);
2867+
2868 data->mConfigureNotified = false;
2869+
2870 if (data->restackInfo ())
2871 data->resetRestackInfo ();
2872 }
2873@@ -654,8 +677,8 @@
2874 ::screen->clientList ().end (), aw->mWindow) !=
2875 ::screen->clientList ().end ())
2876 {
2877- resetStackingInfo ();
2878- updateLastClientList ();
2879+ resetStackingInfo ();
2880+ updateLastClientList ();
2881 }
2882 }
2883
2884@@ -704,7 +727,9 @@
2885
2886 RestackPersistentData *dataBottommost = static_cast<RestackPersistentData *>
2887 (AnimWindow::get (wBottommost)->persistentData["restack"]);
2888+
2889 CompWindow *wPrev = dataBottommost->mMoreToBePaintedPrev;
2890+
2891 while (wPrev)
2892 {
2893 wBottommost = wPrev;
2894@@ -712,6 +737,7 @@
2895 (AnimWindow::get (wPrev)->persistentData["restack"]);
2896 wPrev = dataPrev->mMoreToBePaintedPrev;
2897 }
2898+
2899 return wBottommost;
2900 }
2901
2902@@ -720,14 +746,16 @@
2903 CompWindow *
2904 ExtensionPluginAnimation::getBottommostInRestackChain (CompWindow *wStartPoint)
2905 {
2906- CompWindow *wBottommost = wStartPoint;
2907+ CompWindow *wBottommost = wStartPoint;
2908 RestackPersistentData *dataCur;
2909+
2910 for (CompWindow *wCur = wStartPoint; wCur;
2911 wCur = dataCur->mMoreToBePaintedPrev)
2912 {
2913 wBottommost = wCur;
2914 dataCur = static_cast<RestackPersistentData *>
2915 (AnimWindow::get (wCur)->persistentData["restack"]);
2916+
2917 if (!dataCur)
2918 break;
2919 }
2920@@ -758,11 +786,13 @@
2921 resetMarks ();
2922
2923 CompWindow *w =
2924- getBottommostInExtendedFocusChain (*CompositeScreen::get (::screen)->getWindowPaintList ().begin ());
2925+ getBottommostInExtendedFocusChain (*CompositeScreen::get (::screen)->getWindowPaintList ().begin ());
2926+
2927 if (w)
2928 {
2929 RestackPersistentData *data = static_cast<RestackPersistentData *>
2930 (AnimWindow::get (w)->persistentData["restack"]);
2931+
2932 ++data->mVisitCount;
2933 }
2934 return w;
2935@@ -781,6 +811,7 @@
2936 data->mWalkerOverNewCopy = true;
2937 return true;
2938 }
2939+
2940 return false;
2941 }
2942
2943@@ -796,13 +827,9 @@
2944 {
2945 // Within a chain? (not the 1st or 2nd window)
2946 if (data->mMoreToBePaintedNext)
2947- {
2948 wRet = data->mMoreToBePaintedNext;
2949- }
2950 else if (data->mWinThisIsPaintedBefore) // 2nd one in chain?
2951- {
2952 wRet = data->mWinThisIsPaintedBefore;
2953- }
2954 }
2955 else
2956 data->mWalkerOverNewCopy = false;
2957@@ -823,6 +850,7 @@
2958
2959 ++dataRet->mVisitCount;
2960 }
2961+
2962 return wRet;
2963 }
2964
2965@@ -830,9 +858,9 @@
2966 ExtensionPluginAnimation::getWindowPaintList ()
2967 {
2968 mWindowList.clear ();
2969+
2970 for (CompWindow *w = walkFirst (); w; w = walkNext (w))
2971 mWindowList.push_back (w);
2972
2973 return mWindowList;
2974 }
2975-
2976
2977=== modified file 'plugins/animation/src/fade.cpp'
2978--- plugins/animation/src/fade.cpp 2013-02-27 11:33:10 +0000
2979+++ plugins/animation/src/fade.cpp 2013-07-24 17:39:26 +0000
2980@@ -38,11 +38,11 @@
2981
2982 // ===================== Effect: Fade =========================
2983
2984-FadeAnim::FadeAnim (CompWindow *w,
2985- WindowEvent curWindowEvent,
2986- float duration,
2987+FadeAnim::FadeAnim (CompWindow *w,
2988+ WindowEvent curWindowEvent,
2989+ float duration,
2990 const AnimEffect info,
2991- const CompRect &icon) :
2992+ const CompRect &icon) :
2993 Animation::Animation (w, curWindowEvent, duration, info, icon)
2994 {
2995 }
2996@@ -58,4 +58,3 @@
2997 {
2998 mAWindow->expandBBWithWindow ();
2999 }
3000-
3001
3002=== modified file 'plugins/animation/src/focusfade.cpp'
3003--- plugins/animation/src/focusfade.cpp 2013-02-27 11:33:10 +0000
3004+++ plugins/animation/src/focusfade.cpp 2013-07-24 17:39:26 +0000
3005@@ -55,14 +55,14 @@
3006 FocusFadeAnim::computeOpacity (GLushort opacityInt)
3007 {
3008 float progress = 1 - progressLinear ();
3009- float opacity = opacityInt / (float)OPAQUE;
3010+ float opacity = opacityInt / (float)OPAQUE;
3011 float multiplier;
3012
3013 bool newCopy = overNewCopy ();
3014
3015 // flip opacity behavior for the other side of the cross-fade
3016 if (newCopy)
3017- progress = 1 - progress;
3018+ progress = 1 - progress;
3019
3020 if (mWindow->alpha () || (newCopy && opacity >= 0.91f))
3021 multiplier = progressDecelerate (progress);
3022@@ -81,10 +81,10 @@
3023 else
3024 multiplier = progress;
3025
3026- multiplier = 1 - multiplier;
3027+ multiplier = 1 - multiplier;
3028 float finalOpacity = opacity * multiplier;
3029- finalOpacity = MIN (finalOpacity, 1);
3030- finalOpacity = MAX (finalOpacity, 0);
3031+ finalOpacity = MIN (finalOpacity, 1);
3032+ finalOpacity = MAX (finalOpacity, 0);
3033
3034 return (GLushort)(finalOpacity * OPAQUE);
3035 }
3036@@ -99,7 +99,7 @@
3037 FocusFadeAnim::processCandidate (CompWindow *candidateWin,
3038 CompWindow *subjectWin,
3039 CompRegion &candidateAndSubjectIntersection,
3040- int &numSelectedCandidates)
3041+ int &numSelectedCandidates)
3042 {
3043 AnimWindow *aCandidateWin = AnimWindow::get (candidateWin);
3044 RestackPersistentData *data = static_cast<RestackPersistentData *>
3045@@ -117,10 +117,12 @@
3046 {
3047 AnimWindow *aw = AnimWindow::get (w);
3048 PersistentDataMap::iterator itData = aw->persistentData.find ("restack");
3049+
3050 if (itData != aw->persistentData.end ()) // if found
3051 {
3052 RestackPersistentData *data =
3053 static_cast<RestackPersistentData *> (itData->second);
3054+
3055 if (data->mWinPassingThrough == mWindow)
3056 data->mWinPassingThrough = 0;
3057 }
3058@@ -128,4 +130,3 @@
3059
3060 RestackAnim::cleanUp (closing, destructing);
3061 }
3062-
3063
3064=== modified file 'plugins/animation/src/glide.cpp'
3065--- plugins/animation/src/glide.cpp 2013-04-25 11:07:54 +0000
3066+++ plugins/animation/src/glide.cpp 2013-07-24 17:39:26 +0000
3067@@ -38,11 +38,11 @@
3068
3069 // ===================== Effect: Glide =========================
3070
3071-GlideAnim::GlideAnim (CompWindow *w,
3072- WindowEvent curWindowEvent,
3073- float duration,
3074+GlideAnim::GlideAnim (CompWindow *w,
3075+ WindowEvent curWindowEvent,
3076+ float duration,
3077 const AnimEffect info,
3078- const CompRect &icon) :
3079+ const CompRect &icon) :
3080 Animation::Animation (w, curWindowEvent, duration, info, icon),
3081 TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
3082 ZoomAnim::ZoomAnim (w, curWindowEvent, duration, info, icon),
3083@@ -50,11 +50,11 @@
3084 {
3085 }
3086
3087-Glide2Anim::Glide2Anim (CompWindow *w,
3088- WindowEvent curWindowEvent,
3089- float duration,
3090+Glide2Anim::Glide2Anim (CompWindow *w,
3091+ WindowEvent curWindowEvent,
3092+ float duration,
3093 const AnimEffect info,
3094- const CompRect &icon) :
3095+ const CompRect &icon) :
3096 Animation::Animation (w, curWindowEvent, duration, info, icon),
3097 TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
3098 GlideAnim::GlideAnim (w, curWindowEvent, duration, info, icon)
3099@@ -67,7 +67,7 @@
3100 float *thickness)
3101 {
3102 *finalDistFac = optValF (AnimationOptions::Glide1AwayPosition);
3103- *finalRotAng = optValF (AnimationOptions::Glide1AwayAngle);
3104+ *finalRotAng = optValF (AnimationOptions::Glide1AwayAngle);
3105 }
3106
3107 void
3108@@ -76,7 +76,7 @@
3109 float *thickness)
3110 {
3111 *finalDistFac = optValF (AnimationOptions::Glide2AwayPosition);
3112- *finalRotAng = optValF (AnimationOptions::Glide2AwayAngle);
3113+ *finalRotAng = optValF (AnimationOptions::Glide2AwayAngle);
3114 }
3115
3116 float
3117@@ -128,7 +128,7 @@
3118 0, 0);
3119 GLVector translation (0, 0, finalz * forwardProgress, 0);
3120
3121- float rotAngle = finalRotAng * forwardProgress;
3122+ float rotAngle = finalRotAng * forwardProgress;
3123 glideModRotAngle = fmodf (rotAngle + 720, 360.0f);
3124
3125 // put back to window position
3126
3127=== modified file 'plugins/animation/src/grid.cpp'
3128--- plugins/animation/src/grid.cpp 2013-04-25 11:07:54 +0000
3129+++ plugins/animation/src/grid.cpp 2013-07-24 17:39:26 +0000
3130@@ -54,18 +54,18 @@
3131 mGridPosition = gridPosition;
3132 }
3133
3134-GridAnim::GridModel::GridModel (CompWindow *w,
3135+GridAnim::GridModel::GridModel (CompWindow *w,
3136 WindowEvent curWindowEvent,
3137- int height,
3138- int gridWidth,
3139- int gridHeight,
3140- int decorTopHeight,
3141- int decorBottomHeight) :
3142+ int height,
3143+ int gridWidth,
3144+ int gridHeight,
3145+ int decorTopHeight,
3146+ int decorBottomHeight) :
3147 mScale (1.0f, 1.0f),
3148 mScaleOrigin (0, 0)
3149 {
3150 mNumObjects = (unsigned)(gridWidth * gridHeight);
3151- mObjects = new GridObject[mNumObjects];
3152+ mObjects = new GridObject[mNumObjects];
3153
3154 initObjects (curWindowEvent,
3155 height,
3156@@ -80,15 +80,17 @@
3157
3158 void
3159 GridAnim::GridModel::initObjects (WindowEvent curWindowEvent,
3160- int height,
3161- int gridWidth, int gridHeight,
3162- int decorTopHeight, int decorBottomHeight)
3163+ int height,
3164+ int gridWidth,
3165+ int gridHeight,
3166+ int decorTopHeight,
3167+ int decorBottomHeight)
3168 {
3169 int gridX, gridY;
3170- int nGridCellsX, nGridCellsY;
3171+ int nGridCellsY;
3172
3173 // number of grid cells in x direction
3174- nGridCellsX = gridWidth - 1;
3175+ int nGridCellsX = gridWidth - 1;
3176
3177 if (curWindowEvent == WindowEventShade ||
3178 curWindowEvent == WindowEventUnshade)
3179@@ -97,8 +99,7 @@
3180 // One allocated for top, one for bottom.
3181 nGridCellsY = gridHeight - 3;
3182
3183- float winContentsHeight =
3184- height - decorTopHeight - decorBottomHeight;
3185+ float winContentsHeight = height - decorTopHeight - decorBottomHeight;
3186
3187 //Top
3188 for (gridX = 0; gridX < gridWidth; ++gridX)
3189@@ -108,13 +109,12 @@
3190 mObjects[gridX].setGridPosition (gridPos);
3191 }
3192
3193+ float inWinY, gridPosY;
3194 // Window contents
3195 for (gridY = 1; gridY < gridHeight - 1; ++gridY)
3196 {
3197- float inWinY =
3198- (gridY - 1) * winContentsHeight / nGridCellsY +
3199- decorTopHeight;
3200- float gridPosY = inWinY / height;
3201+ inWinY = (gridY - 1) * winContentsHeight / nGridCellsY + decorTopHeight;
3202+ gridPosY = inWinY / height;
3203
3204 for (gridX = 0; gridX < gridWidth; ++gridX)
3205 {
3206@@ -132,7 +132,7 @@
3207 }
3208 else
3209 {
3210- int objIndex = 0;
3211+ int objIndex = 0;
3212
3213 // number of grid cells in y direction
3214 nGridCellsY = gridHeight - 1;
3215@@ -145,6 +145,7 @@
3216 Point gridPos ((float)gridX / nGridCellsX,
3217 (float)gridY / nGridCellsY);
3218 mObjects[objIndex].setGridPosition (gridPos);
3219+
3220 ++objIndex;
3221 }
3222 }
3223@@ -156,6 +157,7 @@
3224 float ty)
3225 {
3226 GridObject *object = mObjects;
3227+
3228 for (unsigned int i = 0; i < mNumObjects; ++i, ++object)
3229 {
3230 object->mPosition.add (Point3d (tx, ty, 0));
3231@@ -166,6 +168,7 @@
3232 GridAnim::updateBB (CompOutput &output)
3233 {
3234 GridModel::GridObject *object = mModel->mObjects;
3235+
3236 for (unsigned int i = 0; i < mModel->mNumObjects; ++i, ++object)
3237 {
3238 mAWindow->expandBBWithPoint (object->position ().x () + 0.5,
3239@@ -180,13 +183,15 @@
3240 mGridHeight = 2;
3241 }
3242
3243-GridAnim::GridAnim (CompWindow *w,
3244- WindowEvent curWindowEvent,
3245- float duration,
3246+GridAnim::GridAnim (CompWindow *w,
3247+ WindowEvent curWindowEvent,
3248+ float duration,
3249 const AnimEffect info,
3250- const CompRect &icon) :
3251+ const CompRect &icon) :
3252 Animation::Animation (w, curWindowEvent, duration, info, icon),
3253 mModel (NULL),
3254+ mGridWidth (0),
3255+ mGridHeight (0),
3256 mUseQTexCoord (false)
3257 {
3258 }
3259@@ -259,13 +264,9 @@
3260 mCurWindowEvent == WindowEventUnshade)
3261 {
3262 if (y1 < winContentsY) // if at top part
3263- {
3264 gridH = mDecorTopHeight;
3265- }
3266 else if (y2 > winContentsY + winContentsHeight) // if at bottom
3267- {
3268 gridH = mDecorBottomHeight;
3269- }
3270 else // in window contents (only in Y coords)
3271 {
3272 float winContentsHeight =
3273@@ -282,12 +283,12 @@
3274 v = vertexBuffer->getVertices () + (oldCount * vSize);
3275 vMax = vertexBuffer->getVertices () + (newCount * vSize);
3276
3277+ float x, y, topiyFloat;
3278 // For each vertex
3279 for (; v < vMax; v += vSize)
3280 {
3281- float x = v[0];
3282- float y = v[1];
3283- float topiyFloat;
3284+ x = v[0];
3285+ y = v[1];
3286
3287 if (y > y2)
3288 y = y2;
3289@@ -301,31 +302,26 @@
3290 topiyFloat = MIN (topiyFloat, 0.999); // avoid 1.0
3291 }
3292 else if (y2 > winContentsY + winContentsHeight) // if at bottom
3293- {
3294 topiyFloat = (mGridHeight - 2) +
3295 (mDecorBottomHeight ? (y - winContentsY -
3296 winContentsHeight) /
3297 mDecorBottomHeight : 0);
3298- }
3299 else // in window contents (only in Y coords)
3300- {
3301 topiyFloat = (mGridHeight - 3) *
3302 (y - winContentsY) / winContentsHeight + 1;
3303- }
3304 }
3305 else
3306- {
3307 topiyFloat = (mGridHeight - 1) * (y - oy) / oheight;
3308- }
3309+
3310 // topiy should be at most (mGridHeight - 2)
3311 int topiy = (int)(topiyFloat + 1e-4);
3312
3313 if (topiy == mGridHeight - 1)
3314 --topiy;
3315
3316- int bottomiy = topiy + 1;
3317- float iny = topiyFloat - topiy;
3318- float inyRest = 1 - iny;
3319+ int bottomiy = topiy + 1;
3320+ float iny = topiyFloat - topiy;
3321+ float inyRest = 1 - iny;
3322
3323 // End of calculations for y
3324
3325@@ -335,8 +331,7 @@
3326 x = x2;
3327
3328 // find containing grid cell (leftix rightix) x (topiy bottomiy)
3329- float leftixFloat =
3330- (mGridWidth - 1) * (x - ox) / owidth;
3331+ float leftixFloat = (mGridWidth - 1) * (x - ox) / owidth;
3332 int leftix = (int)(leftixFloat + 1e-4);
3333
3334 if (leftix == mGridWidth - 1)
3335@@ -399,11 +394,11 @@
3336 // Deprecated
3337 }
3338
3339-GridTransformAnim::GridTransformAnim (CompWindow *w,
3340- WindowEvent curWindowEvent,
3341- float duration,
3342+GridTransformAnim::GridTransformAnim (CompWindow *w,
3343+ WindowEvent curWindowEvent,
3344+ float duration,
3345 const AnimEffect info,
3346- const CompRect &icon) :
3347+ const CompRect &icon) :
3348 Animation::Animation (w, curWindowEvent, duration, info, icon),
3349 TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
3350 GridAnim::GridAnim (w, curWindowEvent, duration, info, icon),
3351@@ -443,6 +438,7 @@
3352 {
3353 GridModel::GridObject *object = mModel->objects ();
3354 unsigned int n = mModel->numObjects ();
3355+
3356 for (unsigned int i = 0; i < n; ++i, ++object)
3357 {
3358 GLVector coords (object->mPosition.x (),
3359@@ -471,4 +467,3 @@
3360 wTransform *= skewTransform;
3361 }
3362 }
3363-
3364
3365=== modified file 'plugins/animation/src/horizontalfold.cpp'
3366--- plugins/animation/src/horizontalfold.cpp 2013-04-25 11:07:54 +0000
3367+++ plugins/animation/src/horizontalfold.cpp 2013-07-24 17:39:26 +0000
3368@@ -38,11 +38,11 @@
3369
3370 // ===================== Effect: Horizontal Folds =========================
3371
3372-HorizontalFoldsAnim::HorizontalFoldsAnim (CompWindow *w,
3373- WindowEvent curWindowEvent,
3374- float duration,
3375+HorizontalFoldsAnim::HorizontalFoldsAnim (CompWindow *w,
3376+ WindowEvent curWindowEvent,
3377+ float duration,
3378 const AnimEffect info,
3379- const CompRect &icon) :
3380+ const CompRect &icon) :
3381 Animation::Animation (w, curWindowEvent, duration, info, icon),
3382 TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
3383 FoldAnim::FoldAnim (w, curWindowEvent, duration, info, icon)
3384@@ -53,6 +53,7 @@
3385 HorizontalFoldsAnim::initGrid ()
3386 {
3387 mGridWidth = 2;
3388+
3389 if (mCurWindowEvent == WindowEventShade ||
3390 mCurWindowEvent == WindowEventUnshade)
3391 mGridHeight = 3 + 2 *
3392@@ -64,10 +65,10 @@
3393
3394 float
3395 HorizontalFoldsAnim::getObjectZ (GridAnim::GridModel *mModel,
3396- float forwardProgress,
3397- float sinForProg,
3398- float relDistToFoldCenter,
3399- float foldMaxAmp)
3400+ float forwardProgress,
3401+ float sinForProg,
3402+ float relDistToFoldCenter,
3403+ float foldMaxAmp)
3404 {
3405 return -(sinForProg *
3406 foldMaxAmp *
3407@@ -101,17 +102,15 @@
3408 int oheight = outRect.height ();
3409
3410 float winHeight = 0;
3411+
3412 if (mCurWindowEvent == WindowEventShade ||
3413 mCurWindowEvent == WindowEventUnshade)
3414- {
3415 winHeight = winRect.height ();
3416- }
3417 else
3418- {
3419 winHeight = inRect.height ();
3420- }
3421- int nHalfFolds =
3422- 2.0 * optValI (AnimationOptions::HorizontalFoldsNumFolds);
3423+
3424+ int nHalfFolds = 2.0 * optValI (AnimationOptions::HorizontalFoldsNumFolds);
3425+
3426 float foldMaxAmp =
3427 0.3 * pow ((winHeight / nHalfFolds) / ::screen->height (), 0.3) *
3428 optValF (AnimationOptions::HorizontalFoldsAmpMult);
3429@@ -122,6 +121,7 @@
3430
3431 GridModel::GridObject *object = mModel->objects ();
3432 unsigned int n = mModel->numObjects ();
3433+
3434 for (unsigned int i = 0; i < n; ++i, ++object)
3435 {
3436 Point3d &objPos = object->position ();
3437@@ -134,11 +134,10 @@
3438 float origy = (wy +
3439 (oheight * objGridY -
3440 outExtents.top) * mModel->scale ().y ());
3441+
3442 if (mCurWindowEvent == WindowEventShade ||
3443 mCurWindowEvent == WindowEventUnshade)
3444- {
3445- // Execute shade mode
3446-
3447+ { // Execute shade mode
3448 if (objGridY == 0)
3449 {
3450 objPos.setY (oy);
3451@@ -164,10 +163,8 @@
3452 relDistToFoldCenter, foldMaxAmp));
3453 }
3454 }
3455- else
3456+ else // Execute normal mode
3457 {
3458- // Execute normal mode
3459-
3460 float relDistToFoldCenter = (rowNo % 2 == 0 ? 0.5 : 0);
3461
3462 objPos.setY (
3463@@ -201,4 +198,3 @@
3464 mCurWindowEvent == WindowEventUnminimize) &&
3465 optValB (AnimationOptions::HorizontalFoldsZoomToTaskbar));
3466 }
3467-
3468
3469=== modified file 'plugins/animation/src/magiclamp.cpp'
3470--- plugins/animation/src/magiclamp.cpp 2013-04-25 11:07:54 +0000
3471+++ plugins/animation/src/magiclamp.cpp 2013-07-24 17:39:26 +0000
3472@@ -52,11 +52,11 @@
3473 mGridHeight = optValI (AnimationOptions::MagicLampWavyGridRes);
3474 }
3475
3476-MagicLampAnim::MagicLampAnim (CompWindow *w,
3477- WindowEvent curWindowEvent,
3478- float duration,
3479+MagicLampAnim::MagicLampAnim (CompWindow *w,
3480+ WindowEvent curWindowEvent,
3481+ float duration,
3482 const AnimEffect info,
3483- const CompRect &icon) :
3484+ const CompRect &icon) :
3485 Animation::Animation (w, curWindowEvent, duration, info, icon),
3486 GridAnim::GridAnim (w, curWindowEvent, duration, info, icon),
3487 mTopLeftCornerObject (0),
3488@@ -72,21 +72,18 @@
3489 mUseQTexCoord = true;
3490 }
3491
3492-MagicLampWavyAnim::MagicLampWavyAnim (CompWindow *w,
3493- WindowEvent curWindowEvent,
3494- float duration,
3495+MagicLampWavyAnim::MagicLampWavyAnim (CompWindow *w,
3496+ WindowEvent curWindowEvent,
3497+ float duration,
3498 const AnimEffect info,
3499- const CompRect &icon) :
3500+ const CompRect &icon) :
3501 Animation::Animation (w, curWindowEvent, duration, info, icon),
3502 MagicLampAnim::MagicLampAnim (w, curWindowEvent, duration, info, icon)
3503 {
3504- unsigned int maxWaves;
3505- float waveAmpMin, waveAmpMax;
3506- float distance;
3507-
3508- maxWaves = (unsigned) optValI (AnimationOptions::MagicLampWavyMaxWaves);
3509- waveAmpMin = optValF (AnimationOptions::MagicLampWavyAmpMin);
3510- waveAmpMax = optValF (AnimationOptions::MagicLampWavyAmpMax);
3511+ unsigned int maxWaves = (unsigned) optValI (AnimationOptions::MagicLampWavyMaxWaves);
3512+ float waveAmpMin = optValF (AnimationOptions::MagicLampWavyAmpMin);
3513+ float waveAmpMax = optValF (AnimationOptions::MagicLampWavyAmpMax);
3514+ float distance;
3515
3516 if (waveAmpMax < waveAmpMin)
3517 waveAmpMax = waveAmpMin;
3518@@ -96,19 +93,19 @@
3519 CompRect outRect (mAWindow->savedRectsValid () ?
3520 mAWindow->savedOutRect () :
3521 w->outputRect ());
3522+
3523 if (mTargetTop)
3524 distance = outRect.y () + outRect.height () - mIcon.y ();
3525 else
3526 distance = mIcon.y () - outRect.y ();
3527
3528- mNumWaves =
3529- 1 + (float)maxWaves *distance / ::screen->height ();
3530+ mNumWaves = 1 + (float)maxWaves * distance / ::screen->height ();
3531
3532 mWaves = new WaveParam[mNumWaves];
3533
3534 // Compute wave parameters
3535
3536- int ampDirection = (RAND_FLOAT () < 0.5 ? 1 : -1);
3537+ int ampDirection = (RAND_FLOAT () < 0.5 ? 1 : -1);
3538 float minHalfWidth = 0.22f;
3539 float maxHalfWidth = 0.38f;
3540
3541@@ -148,12 +145,11 @@
3542 /// the whole window (like in MagicLampAnim with menus).
3543 MagicLampAnim::~MagicLampAnim ()
3544 {
3545- if (mCurWindowEvent == WindowEventOpen ||
3546- mCurWindowEvent == WindowEventUnminimize ||
3547- mCurWindowEvent == WindowEventUnshade)
3548- {
3549+ if (mCurWindowEvent == WindowEventOpen ||
3550+ mCurWindowEvent == WindowEventUnminimize ||
3551+ mCurWindowEvent == WindowEventUnshade)
3552 mAWindow->expandBBWithWindow ();
3553- }
3554+
3555 }
3556
3557 bool
3558@@ -176,8 +172,10 @@
3559 {
3560 float cosx = ((x - mWaves[i].pos) /
3561 mWaves[i].halfWidth);
3562+
3563 if (cosx < -1 || cosx > 1)
3564 continue;
3565+
3566 targetX += (mWaves[i].amp * mModel->scale ().x () *
3567 (cos (cosx * M_PI) + 1) / 2);
3568 }
3569@@ -196,6 +194,7 @@
3570 mIcon.setX (x);
3571 mIcon.setY (y);
3572 }
3573+
3574 float forwardProgress = progressLinear ();
3575
3576 float iconCloseEndY;
3577@@ -232,6 +231,7 @@
3578 iconCloseEndY = mIcon.y () + mIcon.height ();
3579 winFarEndY = outRect.y () + winh;
3580 winVisibleCloseEndY = outRect.y ();
3581+
3582 if (winVisibleCloseEndY < iconCloseEndY)
3583 winVisibleCloseEndY = iconCloseEndY;
3584 }
3585@@ -266,29 +266,24 @@
3586 }
3587
3588 if (forwardProgress < preShapePhaseEnd)
3589- {
3590 stretchProgress = forwardProgress / stretchPhaseEnd;
3591- }
3592 else
3593 {
3594 if (forwardProgress < stretchPhaseEnd)
3595- {
3596 stretchProgress = forwardProgress / stretchPhaseEnd;
3597- }
3598 else
3599- {
3600 postStretchProgress =
3601 (forwardProgress - stretchPhaseEnd) / (1 - stretchPhaseEnd);
3602- }
3603 }
3604
3605 // The other objects are squeezed into a horizontal line behind the icon
3606- int topmostMovingObjectIdx = -1;
3607+ int topmostMovingObjectIdx = -1;
3608 int bottommostMovingObjectIdx = -1;
3609
3610- unsigned int n = mModel->numObjects ();
3611- float fx = 0.0f;
3612+ unsigned int n = mModel->numObjects ();
3613+ float fx = 0.0f;
3614 GridModel::GridObject *object = mModel->objects ();
3615+
3616 for (unsigned int i = 0; i < n; ++i, ++object)
3617 {
3618 Point3d &objPos = object->position ();
3619@@ -304,6 +299,7 @@
3620 float iconY = (mIcon.y () + mIcon.height () * objGridY);
3621
3622 float stretchedPos;
3623+
3624 if (mTargetTop)
3625 stretchedPos = objGridY * origY + (1 - objGridY) * iconY;
3626 else
3627@@ -311,23 +307,17 @@
3628
3629 // Compute current y position
3630 if (forwardProgress < preShapePhaseEnd)
3631- {
3632 objPos.setY ((1 - stretchProgress) * origY +
3633 stretchProgress * stretchedPos);
3634- }
3635 else
3636 {
3637 if (forwardProgress < stretchPhaseEnd)
3638- {
3639 objPos.setY ((1 - stretchProgress) * origY +
3640 stretchProgress * stretchedPos);
3641- }
3642 else
3643- {
3644 objPos.setY ((1 - postStretchProgress) * stretchedPos +
3645 postStretchProgress *
3646 (stretchedPos + (iconCloseEndY - winFarEndY)));
3647- }
3648 }
3649
3650 if (mTargetTop)
3651@@ -378,7 +368,7 @@
3652 // Compute current x position
3653 if (forwardProgress < preShapePhaseEnd)
3654 objPos.setX ((1 - preShapeProgress) * origX +
3655- preShapeProgress * targetX);
3656+ preShapeProgress * targetX);
3657 else
3658 objPos.setX (targetX);
3659
3660@@ -388,8 +378,8 @@
3661
3662 if (stepRegionUsed ())
3663 {
3664- // Pick objects that will act as the corners of rectangles subtracted
3665- // from this step's damaged region
3666+ // Pick objects that will act as the corners of rectangles subtracted
3667+ // from this step's damaged region
3668
3669 const float topCornerRowRatio =
3670 (mTargetTop ? 0.55 : 0.35);// 0.46 0.42; // rectangle corner row ratio
3671@@ -398,6 +388,7 @@
3672
3673 if (topmostMovingObjectIdx < 0)
3674 topmostMovingObjectIdx = 0;
3675+
3676 if (bottommostMovingObjectIdx < 0)
3677 bottommostMovingObjectIdx = (int)n - 2;
3678
3679@@ -417,6 +408,7 @@
3680
3681 GridModel::GridObject *objects = mModel->objects ();
3682 unsigned int n = mModel->numObjects ();
3683+
3684 for (unsigned int i = 0; i < n; ++i)
3685 {
3686 Point3d &objPos = objects[i].position ();
3687@@ -440,10 +432,10 @@
3688 if (objects[0].position ().x () >
3689 objects[n-2].position ().x ())
3690 {
3691- // Top-left corner is empty
3692+ // Top-left corner is empty
3693
3694- // Position of grid object to pick as the corner of the subtracted rect.
3695- Point3d &objPos = mTopLeftCornerObject->position ();
3696+ // Position of grid object to pick as the corner of the subtracted rect.
3697+ Point3d &objPos = mTopLeftCornerObject->position ();
3698 region -= CompRect (BB->x1,
3699 BB->y1,
3700 objPos.x () - BB->x1,
3701@@ -451,9 +443,9 @@
3702 }
3703 else // Bottom-left corner is empty
3704 {
3705- // Position of grid object to pick as the corner of the subtracted rect.
3706- Point3d &objPos = mBottomLeftCornerObject->position ();
3707- region -= CompRect (BB->x1,
3708+ // Position of grid object to pick as the corner of the subtracted rect.
3709+ Point3d &objPos = mBottomLeftCornerObject->position ();
3710+ region -= CompRect (BB->x1,
3711 objPos.y (),
3712 objPos.x () - BB->x1,
3713 BB->y2);
3714@@ -461,22 +453,22 @@
3715
3716 // Right side
3717 if (objects[1].position ().x () <
3718- objects[n-1].position ().x ())
3719+ objects[n-1].position ().x ())
3720 {
3721 // Top-right corner is empty
3722
3723- // Position of grid object to pick as the corner of the subtracted rect.
3724- Point3d &objPos = (mTopLeftCornerObject + 1)->position ();
3725- region -= CompRect (objPos.x (),
3726+ // Position of grid object to pick as the corner of the subtracted rect.
3727+ Point3d &objPos = (mTopLeftCornerObject + 1)->position ();
3728+ region -= CompRect (objPos.x (),
3729 BB->y1,
3730 BB->x2,
3731 objPos.y () - BB->y1);
3732 }
3733 else // Bottom-right corner is empty
3734 {
3735- // Position of grid object to pick as the corner of the subtracted rect.
3736- Point3d &objPos = (mBottomLeftCornerObject + 1)->position ();
3737- region -= CompRect (objPos.x (),
3738+ // Position of grid object to pick as the corner of the subtracted rect.
3739+ Point3d &objPos = (mBottomLeftCornerObject + 1)->position ();
3740+ region -= CompRect (objPos.x (),
3741 objPos.y (),
3742 BB->x2,
3743 BB->y2);
3744@@ -493,7 +485,7 @@
3745 MagicLampAnim::adjustPointerIconSize ()
3746 {
3747 mIcon.setWidth (MAX (4, optValI
3748- (AnimationOptions::MagicLampOpenStartWidth)));
3749+ (AnimationOptions::MagicLampOpenStartWidth)));
3750
3751 // Adjust position so that the icon is centered at the original position.
3752 mIcon.setX (mIcon.x () - mIcon.width () / 2);
3753@@ -503,9 +495,8 @@
3754 MagicLampWavyAnim::adjustPointerIconSize ()
3755 {
3756 mIcon.setWidth (MAX (4, optValI
3757- (AnimationOptions::MagicLampWavyOpenStartWidth)));
3758+ (AnimationOptions::MagicLampWavyOpenStartWidth)));
3759
3760 // Adjust position so that the icon is centered at the original position.
3761 mIcon.setX (mIcon.x () - mIcon.width () / 2);
3762 }
3763-
3764
3765=== modified file 'plugins/animation/src/options.cpp'
3766--- plugins/animation/src/options.cpp 2013-04-25 11:07:54 +0000
3767+++ plugins/animation/src/options.cpp 2013-07-24 17:39:26 +0000
3768@@ -81,7 +81,7 @@
3769
3770 bool
3771 IdValuePair::matchesPluginOption (ExtensionPluginInfo *testPluginInfo,
3772- int testOptionId) const
3773+ int testOptionId) const
3774 {
3775 return (pluginInfo == testPluginInfo &&
3776 optionId == testOptionId);
3777@@ -89,8 +89,8 @@
3778
3779 CompOption::Value &
3780 AnimWindow::pluginOptVal (ExtensionPluginInfo *pluginInfo,
3781- unsigned int optionId,
3782- Animation *anim)
3783+ unsigned int optionId,
3784+ Animation *anim)
3785 {
3786 PrivateAnimWindow *aw = priv;
3787 PrivateAnimScreen *as = aw->paScreen ();
3788@@ -114,24 +114,26 @@
3789
3790 OptionSet *
3791 PrivateAnimScreen::getOptionSetForSelectedRow (PrivateAnimWindow *aw,
3792- Animation *anim)
3793+ Animation *anim)
3794 {
3795- const AnimEvent event = win2AnimEventMap[anim->curWindowEvent ()];
3796- OptionSets &eventOptionSets = mEventOptionSets[event];
3797- OptionSet *setSelectedForRow = &eventOptionSets.sets[(unsigned int) aw->curAnimSelectionRow ()];
3798+ const AnimEvent event = win2AnimEventMap[anim->curWindowEvent ()];
3799+ OptionSets &eventOptionSets = mEventOptionSets[event];
3800+ OptionSet *setSelectedForRow = &eventOptionSets.sets[(unsigned int)
3801+ aw->curAnimSelectionRow ()];
3802
3803 return setSelectedForRow;
3804 }
3805
3806 void
3807-PrivateAnimScreen::updateOptionSet (OptionSet *os,
3808+PrivateAnimScreen::updateOptionSet (OptionSet *os,
3809 const char *optNamesValuesOrig)
3810 {
3811- unsigned int len = strlen (optNamesValuesOrig);
3812- char *optNamesValues = (char *)calloc (len + 1, 1);
3813+ unsigned int len = strlen (optNamesValuesOrig);
3814+ char *optNamesValues = (char *)calloc (len + 1, 1);
3815
3816 // Find the first substring with no spaces in it
3817 sscanf (optNamesValuesOrig, " %s ", optNamesValues);
3818+
3819 if (!strlen (optNamesValues))
3820 {
3821 free (optNamesValues);
3822@@ -140,15 +142,14 @@
3823 // Backup original, since strtok is destructive
3824 strcpy (optNamesValues, optNamesValuesOrig);
3825
3826- char *name;
3827- char *nameTrimmed = (char *)calloc (len + 1, 1);
3828- char *valueStr = 0;
3829- const char *betweenPairs = ",";
3830- const char *betweenOptVal = "=";
3831+ char *nameTrimmed = (char *)calloc (len + 1, 1);
3832+ char *valueStr = 0;
3833+ const char *betweenPairs = ",";
3834+ const char *betweenOptVal = "=";
3835
3836 // Count number of pairs
3837- char *pairToken = (char *)optNamesValuesOrig; // TODO do with CompString
3838- unsigned int nPairs = 1;
3839+ char *pairToken = (char *)optNamesValuesOrig; // TODO do with CompString
3840+ unsigned int nPairs = 1;
3841
3842 while ((pairToken = strchr (pairToken, betweenPairs[0])))
3843 {
3844@@ -160,13 +161,15 @@
3845 os->pairs.reserve (nPairs);
3846
3847 // Tokenize pairs
3848- name = strtok (optNamesValues, betweenOptVal);
3849+ char *name = strtok (optNamesValues, betweenOptVal);
3850
3851 int errorNo = -1;
3852 unsigned int i;
3853+
3854 for (i = 0; name && i < nPairs; ++i)
3855 {
3856 errorNo = 0;
3857+
3858 if (strchr (name, betweenPairs[0])) // handle "a, b=4" case
3859 {
3860 errorNo = 1;
3861@@ -174,12 +177,15 @@
3862 }
3863
3864 sscanf (name, " %s ", nameTrimmed);
3865+
3866 if (!strlen (nameTrimmed))
3867 {
3868 errorNo = 2;
3869 break;
3870 }
3871+
3872 valueStr = strtok (0, betweenPairs);
3873+
3874 if (!valueStr)
3875 {
3876 errorNo = 3;
3877@@ -189,13 +195,16 @@
3878 // TODO: Fix: Convert to "pluginname:option_name" format
3879 // Warning: Assumes that option names in different extension plugins
3880 // will be different.
3881- bool matched = false;
3882- const ExtensionPluginInfo *chosenExtensionPlugin = NULL;
3883- CompOption *o = 0;
3884- int optId = -1;
3885+ bool matched = false;
3886+ const ExtensionPluginInfo *chosenExtensionPlugin = NULL;
3887+ CompOption *o = 0;
3888+ int optId = -1;
3889+ unsigned int nOptions;
3890+
3891 foreach (ExtensionPluginInfo *extensionPlugin, mExtensionPlugins)
3892 {
3893- unsigned int nOptions = extensionPlugin->effectOptions->size ();
3894+ nOptions = extensionPlugin->effectOptions->size ();
3895+
3896 for (optId = (int)extensionPlugin->firstEffectOptionIndex;
3897 optId < (int)nOptions; ++optId)
3898 {
3899@@ -208,14 +217,17 @@
3900 break;
3901 }
3902 }
3903+
3904 if (matched)
3905 break;
3906 }
3907+
3908 if (!matched)
3909 {
3910 errorNo = 4;
3911 break;
3912 }
3913+
3914 CompOption::Value v;
3915
3916 os->pairs.push_back (IdValuePair ());
3917@@ -224,73 +236,87 @@
3918 pair->pluginInfo = chosenExtensionPlugin;
3919 pair->optionId = optId;
3920 int valueRead = -1;
3921+
3922 switch (o->type ())
3923 {
3924- case CompOption::TypeBool:
3925- int vb;
3926- valueRead = sscanf (valueStr, " %d ", &vb);
3927- if (valueRead)
3928- pair->value.set ((bool)vb);
3929- break;
3930- case CompOption::TypeInt:
3931- {
3932- int vi;
3933- valueRead = sscanf (valueStr, " %d ", &vi);
3934- if (valueRead > 0)
3935- {
3936- if (o->rest ().inRange (vi))
3937- {
3938- v.set (vi);
3939- pair->value = v;
3940- }
3941- else
3942- errorNo = 7;
3943- }
3944- break;
3945- }
3946- case CompOption::TypeFloat:
3947- {
3948- float vf;
3949- valueRead = sscanf (valueStr, " %f ", &vf);
3950- if (valueRead > 0)
3951- {
3952- if (o->rest ().inRange (vf))
3953- {
3954- v.set (vf);
3955- pair->value = v;
3956- }
3957- else
3958- errorNo = 7;
3959- }
3960- break;
3961- }
3962- case CompOption::TypeString:
3963- {
3964- v.set (CompString (valueStr));
3965- valueRead = 1;
3966- break;
3967- }
3968- case CompOption::TypeColor:
3969- {
3970- unsigned short vc[4];
3971- valueRead = sscanf (valueStr, " #%2hx%2hx%2hx%2hx ",
3972- &vc[0], &vc[1], &vc[2], &vc[3]);
3973- if (valueRead == 4)
3974- {
3975- CompOption::Value *pairVal = &pair->value;
3976- for (int j = 0; j < 4; ++j)
3977- vc[j] = vc[j] << 8 | vc[j];
3978- pairVal->set (vc);
3979- }
3980- else
3981- errorNo = 6;
3982- break;
3983- }
3984- default:
3985- break;
3986- }
3987+ case CompOption::TypeBool:
3988+ int vb;
3989+ valueRead = sscanf (valueStr, " %d ", &vb);
3990+
3991+ if (valueRead)
3992+ pair->value.set ((bool)vb);
3993+
3994+ break;
3995+
3996+ case CompOption::TypeInt:
3997+ {
3998+ int vi;
3999+ valueRead = sscanf (valueStr, " %d ", &vi);
4000+
4001+ if (valueRead > 0)
4002+ {
4003+ if (o->rest ().inRange (vi))
4004+ {
4005+ v.set (vi);
4006+ pair->value = v;
4007+ }
4008+ else
4009+ errorNo = 7;
4010+ }
4011+
4012+ break;
4013+ }
4014+ case CompOption::TypeFloat:
4015+ {
4016+ float vf;
4017+ valueRead = sscanf (valueStr, " %f ", &vf);
4018+
4019+ if (valueRead > 0)
4020+ {
4021+ if (o->rest ().inRange (vf))
4022+ {
4023+ v.set (vf);
4024+ pair->value = v;
4025+ }
4026+ else
4027+ errorNo = 7;
4028+ }
4029+
4030+ break;
4031+ }
4032+ case CompOption::TypeString:
4033+ {
4034+ v.set (CompString (valueStr));
4035+ valueRead = 1;
4036+ break;
4037+ }
4038+
4039+ case CompOption::TypeColor:
4040+ {
4041+ unsigned short vc[4];
4042+ valueRead = sscanf (valueStr, " #%2hx%2hx%2hx%2hx ",
4043+ &vc[0], &vc[1], &vc[2], &vc[3]);
4044+
4045+ if (valueRead == 4)
4046+ {
4047+ CompOption::Value *pairVal = &pair->value;
4048+ for (int j = 0; j < 4; ++j)
4049+ vc[j] = vc[j] << 8 | vc[j];
4050+ pairVal->set (vc);
4051+ }
4052+ else
4053+ errorNo = 6;
4054+
4055+ break;
4056+ }
4057+
4058+ default:
4059+ break;
4060+ }
4061+
4062 if (valueRead == 0)
4063 errorNo = 6;
4064+
4065 if (errorNo > 0)
4066 break;
4067 // If valueRead is -1 here, then it must be a
4068@@ -305,38 +331,44 @@
4069 {
4070 switch (errorNo)
4071 {
4072- case -1:
4073- case 2:
4074- compLogMessage ("animation", CompLogLevelError,
4075- "Option name missing in \"%s\"",
4076- optNamesValuesOrig);
4077- break;
4078- case 1:
4079- case 3:
4080- compLogMessage ("animation", CompLogLevelError,
4081- "Option value missing in \"%s\"",
4082- optNamesValuesOrig);
4083- break;
4084- case 4:
4085- //compLogMessage ("animation", CompLogLevelError,
4086- // "Unknown option \"%s\" in \"%s\"",
4087- // nameTrimmed, optNamesValuesOrig);
4088- break;
4089- case 6:
4090- compLogMessage ("animation", CompLogLevelError,
4091- "Invalid value \"%s\" in \"%s\"",
4092- valueStr, optNamesValuesOrig);
4093- break;
4094- case 7:
4095- compLogMessage ("animation", CompLogLevelError,
4096- "Value \"%s\" out of range in \"%s\"",
4097- valueStr, optNamesValuesOrig);
4098- break;
4099- default:
4100- break;
4101+ case -1:
4102+ case 2:
4103+ compLogMessage ("animation", CompLogLevelError,
4104+ "Option name missing in \"%s\"",
4105+ optNamesValuesOrig);
4106+ break;
4107+
4108+ case 1:
4109+ case 3:
4110+ compLogMessage ("animation", CompLogLevelError,
4111+ "Option value missing in \"%s\"",
4112+ optNamesValuesOrig);
4113+ break;
4114+
4115+ case 4:
4116+ //compLogMessage ("animation", CompLogLevelError,
4117+ // "Unknown option \"%s\" in \"%s\"",
4118+ // nameTrimmed, optNamesValuesOrig);
4119+ break;
4120+
4121+ case 6:
4122+ compLogMessage ("animation", CompLogLevelError,
4123+ "Invalid value \"%s\" in \"%s\"",
4124+ valueStr, optNamesValuesOrig);
4125+ break;
4126+
4127+ case 7:
4128+ compLogMessage ("animation", CompLogLevelError,
4129+ "Value \"%s\" out of range in \"%s\"",
4130+ valueStr, optNamesValuesOrig);
4131+ break;
4132+
4133+ default:
4134+ break;
4135 }
4136 os->pairs.clear ();
4137 }
4138+
4139 free (optNamesValues);
4140 free (nameTrimmed);
4141 }
4142@@ -358,4 +390,3 @@
4143 updateOptionSet (&oss->sets[i], (*listVal)[i].s ().c_str ());
4144 }
4145 }
4146-
4147
4148=== modified file 'plugins/animation/src/private.h'
4149--- plugins/animation/src/private.h 2012-09-07 22:37:20 +0000
4150+++ plugins/animation/src/private.h 2013-07-24 17:39:26 +0000
4151@@ -21,27 +21,33 @@
4152 class RestackInfo
4153 {
4154 public:
4155+
4156 RestackInfo (CompWindow *wRestacked,
4157 CompWindow *wStart,
4158 CompWindow *wEnd,
4159 CompWindow *wOldAbove,
4160- bool raised);
4161-
4162- CompWindow *wRestacked, *wStart, *wEnd, *wOldAbove;
4163- bool raised;
4164+ bool raised);
4165+
4166+ CompWindow *wRestacked;
4167+ CompWindow *wStart;
4168+ CompWindow *wEnd;
4169+ CompWindow *wOldAbove;
4170+
4171+ bool raised;
4172 };
4173
4174 class IdValuePair
4175 {
4176 public:
4177+
4178 IdValuePair () : pluginInfo (0), optionId (-1), value () {}
4179
4180 bool matchesPluginOption (ExtensionPluginInfo *pluginInfo,
4181- int optionId) const;
4182+ int optionId) const;
4183
4184 const ExtensionPluginInfo *pluginInfo;
4185- int optionId;
4186- CompOption::Value value;
4187+ int optionId;
4188+ CompOption::Value value;
4189 };
4190
4191 typedef std::vector<IdValuePair> IdValuePairVector;
4192@@ -49,6 +55,7 @@
4193 class OptionSet
4194 {
4195 public:
4196+
4197 OptionSet () {}
4198
4199 IdValuePairVector pairs;
4200@@ -59,6 +66,7 @@
4201 class OptionSets
4202 {
4203 public:
4204+
4205 OptionSets () {}
4206
4207 OptionSetVector sets;
4208@@ -67,6 +75,7 @@
4209 class EffectSet
4210 {
4211 public:
4212+
4213 EffectSet () {}
4214
4215 AnimEffectVector effects;
4216@@ -120,15 +129,15 @@
4217 // in PrivateAnimScreenOptions
4218 #define NUM_NONEFFECT_OPTIONS AnimationOptions::CurvedFoldAmpMult
4219
4220-
4221 class ExtensionPluginAnimation : public ExtensionPluginInfo
4222 {
4223 public:
4224- ExtensionPluginAnimation (const CompString &name,
4225- unsigned int nEffects,
4226- AnimEffect *effects,
4227+
4228+ ExtensionPluginAnimation (const CompString &name,
4229+ unsigned int nEffects,
4230+ AnimEffect *effects,
4231 CompOption::Vector *effectOptions,
4232- unsigned int firstEffectOptionIndex);
4233+ unsigned int firstEffectOptionIndex);
4234 ~ExtensionPluginAnimation ();
4235
4236 // Overriden methods from ExtensionPluginInfo
4237@@ -144,7 +153,7 @@
4238 void initPersistentData (AnimWindow *aw);
4239 void destroyPersistentData (AnimWindow *aw);
4240 void postUpdateEventEffects (AnimEvent e,
4241- bool forRandom);
4242+ bool forRandom);
4243 void cleanUpAnimation (bool closing,
4244 bool destructing);
4245 void postStartupCountdown ();
4246@@ -163,7 +172,8 @@
4247 CompWindow * walkNext (CompWindow *w);
4248 void incrementCurRestackAnimCount ();
4249 void decrementCurRestackAnimCount ();
4250- bool wontCreateCircularChain (CompWindow *wCur, CompWindow *wNext);
4251+ bool wontCreateCircularChain (CompWindow *wCur,
4252+ CompWindow *wNext);
4253
4254 static void cleanUpParentChildChainItem (AnimWindow *aw);
4255 static bool relevantForRestackAnim (CompWindow *w);
4256@@ -177,13 +187,13 @@
4257 bool mAWinWasRestackedJustNow;
4258
4259 private:
4260- CompWindowVector mLastClientList; ///< Last known stacking order
4261- CompWindowVector mPrevClientList; ///< The stacking order before mLastClientList
4262- int mRestackAnimCount; ///< Count of how many windows are currently involved in
4263- ///< animations that require walker (dodge & focus fade).
4264+ CompWindowVector mLastClientList; ///< Last known stacking order
4265+ CompWindowVector mPrevClientList; ///< The stacking order before mLastClientList
4266+ int mRestackAnimCount; ///< Count of how many windows are currently involved in
4267+ ///< animations that require walker (dodge & focus fade).
4268 std::vector<AnimWindow *> mRestackedWindows;
4269
4270- CompWindowList mWindowList;
4271+ CompWindowList mWindowList;
4272 };
4273
4274 class PrivateAnimScreen :
4275@@ -196,48 +206,50 @@
4276 friend class AnimWindow;
4277
4278 public:
4279- CompositeScreen *cScreen;
4280- GLScreen *gScreen;
4281- AnimScreen *aScreen;
4282+
4283+ CompositeScreen *cScreen;
4284+ GLScreen *gScreen;
4285+ AnimScreen *aScreen;
4286
4287 private:
4288- struct timeval mLastRedrawTime;
4289- bool mLastRedrawTimeFresh;
4290-
4291- bool mPluginActive[WatchedScreenPluginNum];
4292- int mSwitcherPostWait;
4293- int mStartCountdown;
4294+
4295+ struct timeval mLastRedrawTime;
4296+ bool mLastRedrawTimeFresh;
4297+
4298+ bool mPluginActive[WatchedScreenPluginNum];
4299+ int mSwitcherPostWait;
4300+ int mStartCountdown;
4301 ///< To mark windows as "created" if they were opened before compiz
4302 ///< was started and to prevent already opened windows from doing
4303 ///< open animation.
4304
4305- Window mLastActiveWindow; ///< Last known active window
4306-
4307- bool mAnimInProgress; ///< Is an animation currently being played?
4308- bool mStartingNewPaintRound; ///< Is a new round of glPaints starting?
4309- bool mPrePaintWindowsBackToFrontEnabled;
4310-
4311- EffectSet mRandomEffects[AnimEventNum];
4312-
4313- OptionSets mEventOptionSets[AnimEventNum];
4314+ Window mLastActiveWindow; ///< Last known active window
4315+
4316+ bool mAnimInProgress; ///< Is an animation currently being played?
4317+ bool mStartingNewPaintRound; ///< Is a new round of glPaints starting?
4318+ bool mPrePaintWindowsBackToFrontEnabled;
4319+
4320+ EffectSet mRandomEffects[AnimEventNum];
4321+
4322+ OptionSets mEventOptionSets[AnimEventNum];
4323
4324 // Effect extension plugins
4325 ExtensionPluginVector mExtensionPlugins;
4326
4327 // Possible effects for each event
4328- AnimEffectVector mEventEffectsAllowed[AnimEventNum];
4329+ AnimEffectVector mEventEffectsAllowed[AnimEventNum];
4330
4331 // List of chosen effects for each event
4332- EffectSet mEventEffects[AnimEventNum];
4333-
4334- CompOutput *mOutput;
4335-
4336- Window mActiveWindow;
4337- CompMatch mNeverAnimateMatch;
4338-
4339- const CompWindowList *mLockedPaintList;
4340- unsigned int mLockedPaintListCnt;
4341- unsigned int mGetWindowPaintListEnableCnt;
4342+ EffectSet mEventEffects[AnimEventNum];
4343+
4344+ CompOutput *mOutput;
4345+
4346+ Window mActiveWindow;
4347+ CompMatch mNeverAnimateMatch;
4348+
4349+ const CompWindowList *mLockedPaintList;
4350+ unsigned int mLockedPaintListCnt;
4351+ unsigned int mGetWindowPaintListEnableCnt;
4352
4353 void updateEventEffects (AnimEvent e,
4354 bool forRandom,
4355@@ -245,25 +257,32 @@
4356 void updateAllEventEffects ();
4357
4358 void updateOptionSets (AnimEvent e);
4359- void updateOptionSet (OptionSet *os, const char *optNamesValuesOrig);
4360+ void updateOptionSet (OptionSet *os,
4361+ const char *optNamesValuesOrig);
4362
4363 void activateEvent (bool activating);
4364 bool isWinVisible (CompWindow *w);
4365 AnimEvent getCorrespondingAnimEvent (AnimationOptions::Options optionId);
4366- void eventMatchesChanged (CompOption *opt, AnimationOptions::Options num);
4367- void eventOptionsChanged (CompOption *opt, AnimationOptions::Options num);
4368- void eventEffectsChanged (CompOption *opt, AnimationOptions::Options num);
4369- void eventRandomEffectsChanged (CompOption *opt, AnimationOptions::Options num);
4370+ void eventMatchesChanged (CompOption *opt,
4371+ AnimationOptions::Options num);
4372+ void eventOptionsChanged (CompOption *opt,
4373+ AnimationOptions::Options num);
4374+ void eventEffectsChanged (CompOption *opt,
4375+ AnimationOptions::Options num);
4376+ void eventRandomEffectsChanged (CompOption *opt,
4377+ AnimationOptions::Options num);
4378
4379- CompRect getIcon (CompWindow *w, bool alwaysUseMouse);
4380+ CompRect getIcon (CompWindow *w,
4381+ bool alwaysUseMouse);
4382 void updateAnimStillInProgress ();
4383
4384 bool isAnimEffectInList (AnimEffect theEffect,
4385- EffectSet &effectList);
4386+ EffectSet &effectList);
4387 bool isAnimEffectPossibleForEvent (AnimEffect theEffect,
4388- AnimEvent event);
4389+ AnimEvent event);
4390
4391 public:
4392+
4393 PrivateAnimScreen (CompScreen *s, AnimScreen *);
4394 ~PrivateAnimScreen ();
4395
4396@@ -293,16 +312,17 @@
4397 bool isAnimEffectPossible (AnimEffect theEffect);
4398 inline CompOutput &output () { return *mOutput; }
4399 AnimEffect getActualEffect (AnimEffect effect,
4400- AnimEvent animEvent);
4401- bool shouldIgnoreWindowForAnim (CompWindow *w, bool checkPixmap);
4402+ AnimEvent animEvent);
4403+ bool shouldIgnoreWindowForAnim (CompWindow *w,
4404+ bool checkPixmap);
4405 OptionSet *getOptionSetForSelectedRow (PrivateAnimWindow *aw,
4406- Animation *anim);
4407+ Animation *anim);
4408 void addExtension (ExtensionPluginInfo *extensionPluginInfo,
4409- bool shouldInitPersistentData);
4410+ bool shouldInitPersistentData);
4411 void removeExtension (ExtensionPluginInfo *extensionPluginInfo);
4412 AnimEffect getMatchingAnimSelection (CompWindow *w,
4413- AnimEvent e,
4414- int *duration);
4415+ AnimEvent e,
4416+ int *duration);
4417 bool otherPluginsActive ();
4418
4419 void enablePrePaintWindowsBackToFront (bool enabled);
4420@@ -315,13 +335,14 @@
4421
4422 // GLScreenInterface methods
4423 bool glPaintOutput (const GLScreenPaintAttrib &,
4424- const GLMatrix &,
4425- const CompRegion &,
4426- CompOutput *,
4427- unsigned int);
4428+ const GLMatrix &,
4429+ const CompRegion &,
4430+ CompOutput *,
4431+ unsigned int );
4432
4433 // ScreenInterface methods
4434- void handleCompizEvent (const char * plugin, const char *event,
4435+ void handleCompizEvent (const char *plugin,
4436+ const char *event,
4437 CompOption::Vector &options);
4438 };
4439
4440@@ -333,6 +354,7 @@
4441 friend class AnimWindow;
4442
4443 public:
4444+
4445 PrivateAnimWindow (CompWindow *, AnimWindow *aw);
4446 ~PrivateAnimWindow ();
4447
4448@@ -351,41 +373,43 @@
4449 GLWindow *gWindow;
4450
4451 private:
4452+
4453 CompWindow *mWindow;
4454 AnimWindow *mAWindow;
4455
4456 PrivateAnimScreen *mPAScreen;
4457
4458- unsigned int mState;
4459- unsigned int mNewState;
4460-
4461- Animation *mCurAnimation;
4462-
4463- bool mUnshadePending;
4464- bool mEventNotOpenClose;
4465- bool mNowShaded;
4466- bool mGrabbed;
4467-
4468- int mUnmapCnt;
4469- int mDestroyCnt;
4470-
4471- bool mIgnoreDamage;
4472- bool mFinishingAnim;
4473-
4474- int mCurAnimSelectionRow;
4475- int mPrevAnimSelectionRow; ///< For the case when one event interrupts another
4476-
4477- Box mBB; ///< Bounding box of area to be damaged
4478-
4479- CompRegion mStepRegion; ///< Region to damage this step
4480- CompRegion mLastStepRegion; ///< Region damaged last step
4481-
4482- bool mPluginActive[WatchedWindowPluginNum];
4483+ unsigned int mState;
4484+ unsigned int mNewState;
4485+
4486+ Animation *mCurAnimation;
4487+
4488+ bool mUnshadePending;
4489+ bool mEventNotOpenClose;
4490+ bool mNowShaded;
4491+ bool mGrabbed;
4492+
4493+ int mUnmapCnt;
4494+ int mDestroyCnt;
4495+
4496+ bool mIgnoreDamage;
4497+ bool mFinishingAnim;
4498+
4499+ int mCurAnimSelectionRow;
4500+ int mPrevAnimSelectionRow; ///< For the case when one event interrupts another
4501+
4502+ Box mBB; ///< Bounding box of area to be damaged
4503+
4504+ CompRegion mStepRegion; ///< Region to damage this step
4505+ CompRegion mLastStepRegion; ///< Region damaged last step
4506+
4507+ bool mPluginActive[WatchedWindowPluginNum];
4508
4509 // Utility methods
4510 unsigned int getState ();
4511 void updateSelectionRow (unsigned int i);
4512- void postAnimationCleanUpPrev (bool closing, bool clearMatchingRow);
4513+ void postAnimationCleanUpPrev (bool closing,
4514+ bool clearMatchingRow);
4515 void postAnimationCleanUpCustom (bool closing,
4516 bool destructing,
4517 bool clearMatchingRow);
4518@@ -395,20 +419,34 @@
4519 void notifyAnimation (bool activation);
4520
4521 // WindowInterface methods
4522- void resizeNotify (int dx, int dy, int dwidth, int dheight);
4523- void moveNotify (int dx, int dy, bool immediate);
4524+ void resizeNotify (int dx,
4525+ int dy,
4526+ int dwidth,
4527+ int dheight);
4528+ void moveNotify (int dx,
4529+ int dy,
4530+ bool immediate);
4531 void windowNotify (CompWindowNotify n);
4532- void grabNotify (int x, int y, unsigned int state, unsigned int mask);
4533+ void grabNotify (int x,
4534+ int y,
4535+ unsigned int state,
4536+ unsigned int mask);
4537 void ungrabNotify ();
4538
4539 // GLWindowInterface methods
4540- bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
4541- const CompRegion &, unsigned int);
4542+ bool glPaint (const GLWindowPaintAttrib &,
4543+ const GLMatrix &,
4544+ const CompRegion &,
4545+ unsigned int );
4546 void glAddGeometry (const GLTexture::MatrixList &,
4547- const CompRegion &, const CompRegion &,
4548- unsigned int = MAXSHORT, unsigned int = MAXSHORT);
4549- void glDrawTexture (GLTexture *texture, const GLMatrix &,
4550- const GLWindowPaintAttrib &, unsigned int);
4551+ const CompRegion &,
4552+ const CompRegion &,
4553+ unsigned int = MAXSHORT,
4554+ unsigned int = MAXSHORT);
4555+ void glDrawTexture (GLTexture *texture,
4556+ const GLMatrix &,
4557+ const GLWindowPaintAttrib &,
4558+ unsigned int );
4559 //void glDrawGeometry ();
4560 };
4561
4562@@ -416,12 +454,14 @@
4563 public GridAnim
4564 {
4565 public:
4566- RollUpAnim (CompWindow *w,
4567- WindowEvent curWindowEvent,
4568- float duration,
4569+
4570+ RollUpAnim (CompWindow *w,
4571+ WindowEvent curWindowEvent,
4572+ float duration,
4573 const AnimEffect info,
4574- const CompRect &icon);
4575+ const CompRect &icon);
4576 protected:
4577+
4578 static const float kDurationFactor;
4579
4580 void initGrid ();
4581@@ -432,15 +472,17 @@
4582 public GridAnim
4583 {
4584 public:
4585- MagicLampAnim (CompWindow *w,
4586- WindowEvent curWindowEvent,
4587- float duration,
4588- const AnimEffect info,
4589- const CompRect &icon);
4590+
4591+ MagicLampAnim (CompWindow *w,
4592+ WindowEvent curWindowEvent,
4593+ float duration,
4594+ const AnimEffect info,
4595+ const CompRect &icon);
4596 virtual ~MagicLampAnim ();
4597
4598 protected:
4599- bool mTargetTop;
4600+
4601+ bool mTargetTop;
4602 GridModel::GridObject *mTopLeftCornerObject;
4603 GridModel::GridObject *mBottomLeftCornerObject;
4604
4605@@ -451,30 +493,33 @@
4606 void adjustPointerIconSize ();
4607
4608 virtual bool hasMovingEnd ();
4609- virtual void filterTargetX (float &targetX, float x) { }
4610+ virtual void filterTargetX (float &targetX,
4611+ float x) { }
4612 };
4613
4614 class MagicLampWavyAnim :
4615 public MagicLampAnim
4616 {
4617 public:
4618- MagicLampWavyAnim (CompWindow *w,
4619- WindowEvent curWindowEvent,
4620- float duration,
4621- const AnimEffect info,
4622- const CompRect &icon);
4623+
4624+ MagicLampWavyAnim (CompWindow *w,
4625+ WindowEvent curWindowEvent,
4626+ float duration,
4627+ const AnimEffect info,
4628+ const CompRect &icon);
4629 ~MagicLampWavyAnim ();
4630
4631 protected:
4632+
4633 struct WaveParam
4634 {
4635- float halfWidth;
4636- float amp;
4637- float pos;
4638+ float halfWidth;
4639+ float amp;
4640+ float pos;
4641 };
4642
4643 unsigned int mNumWaves;
4644- WaveParam *mWaves;
4645+ WaveParam *mWaves;
4646
4647 void initGrid ();
4648 void updateBB (CompOutput &output);
4649@@ -482,19 +527,21 @@
4650 void adjustPointerIconSize ();
4651
4652 bool hasMovingEnd ();
4653- void filterTargetX (float &targetX, float x);
4654+ void filterTargetX (float &targetX,
4655+ float x);
4656 };
4657
4658 class SidekickAnim :
4659 public ZoomAnim
4660 {
4661 public:
4662- SidekickAnim (CompWindow *w,
4663- WindowEvent curWindowEvent,
4664- float duration,
4665+ SidekickAnim (CompWindow *w,
4666+ WindowEvent curWindowEvent,
4667+ float duration,
4668 const AnimEffect info,
4669- const CompRect &icon);
4670+ const CompRect &icon);
4671 protected:
4672+
4673 float mNumRotations;
4674
4675 float getSpringiness ();
4676@@ -509,12 +556,14 @@
4677 public GridTransformAnim
4678 {
4679 public:
4680- WaveAnim (CompWindow *w,
4681- WindowEvent curWindowEvent,
4682- float duration,
4683+
4684+ WaveAnim (CompWindow *w,
4685+ WindowEvent curWindowEvent,
4686+ float duration,
4687 const AnimEffect info,
4688- const CompRect &icon);
4689+ const CompRect &icon);
4690 protected:
4691+
4692 void adjustDuration ();
4693 void initGrid ();
4694 inline bool using3D () { return true; }
4695@@ -528,13 +577,15 @@
4696 public ZoomAnim
4697 {
4698 public:
4699- GlideAnim (CompWindow *w,
4700- WindowEvent curWindowEvent,
4701- float duration,
4702+
4703+ GlideAnim (CompWindow *w,
4704+ WindowEvent curWindowEvent,
4705+ float duration,
4706 const AnimEffect info,
4707- const CompRect &icon);
4708+ const CompRect &icon);
4709
4710 protected:
4711+
4712 void prePaintWindow ();
4713 inline bool postPaintWindowUsed () { return true; }
4714 void postPaintWindow ();
4715@@ -556,12 +607,14 @@
4716 public GlideAnim
4717 {
4718 public:
4719- Glide2Anim (CompWindow *w,
4720- WindowEvent curWindowEvent,
4721- float duration,
4722+
4723+ Glide2Anim (CompWindow *w,
4724+ WindowEvent curWindowEvent,
4725+ float duration,
4726 const AnimEffect info,
4727- const CompRect &icon);
4728+ const CompRect &icon);
4729 protected:
4730+
4731 bool zoomToIcon ();
4732 void getParams (float *finalDistFac,
4733 float *finalRotAng,
4734@@ -574,16 +627,23 @@
4735 virtual public Animation
4736 {
4737 public:
4738- RestackAnim (CompWindow *w,
4739- WindowEvent curWindowEvent,
4740- float duration,
4741+
4742+ RestackAnim (CompWindow *w,
4743+ WindowEvent curWindowEvent,
4744+ float duration,
4745 const AnimEffect info,
4746- const CompRect &icon);
4747+ const CompRect &icon);
4748+
4749 void cleanUp (bool closing,
4750 bool destructing);
4751+
4752 bool initiateRestackAnim (int duration);
4753- inline bool moveUpdate (int dx, int dy) { return false; }
4754- static bool onSameRestackChain (CompWindow *wSubject, CompWindow *wOther);
4755+
4756+ inline bool moveUpdate (int dx,
4757+ int dy) { return false; }
4758+
4759+ static bool onSameRestackChain (CompWindow *wSubject,
4760+ CompWindow *wOther);
4761
4762 /// Find union of restack chain (group)
4763 static CompRegion unionRestackChain (CompWindow *w);
4764@@ -595,12 +655,13 @@
4765 virtual void processCandidate (CompWindow *candidateWin,
4766 CompWindow *subjectWin,
4767 CompRegion &candidateAndSubjectIntersection,
4768- int &numSelectedCandidates) {}
4769- virtual void postInitiateRestackAnim (int numSelectedCandidates,
4770- int duration,
4771+ int &numSelectedCandidates) {}
4772+
4773+ virtual void postInitiateRestackAnim (int numSelectedCandidates,
4774+ int duration,
4775 CompWindow *wStart,
4776 CompWindow *wEnd,
4777- bool raised) {}
4778+ bool raised) {}
4779
4780 // Other methods
4781 bool overNewCopy (); ///< Is glPaint on the copy at the new position?
4782@@ -617,30 +678,33 @@
4783 friend class DodgeAnim;
4784
4785 public:
4786+
4787 RestackPersistentData ();
4788 ~RestackPersistentData ();
4789
4790 protected:
4791+
4792 inline RestackInfo *restackInfo () { return mRestackInfo; }
4793 void resetRestackInfo (bool alsoResetChain = false);
4794 void setRestackInfo (CompWindow *wRestacked,
4795 CompWindow *wStart,
4796 CompWindow *wEnd,
4797 CompWindow *wOldAbove,
4798- bool raised);
4799- void getHostedOnWin (CompWindow *wGuest, CompWindow *wHost);
4800+ bool raised);
4801+ void getHostedOnWin (CompWindow *wGuest,
4802+ CompWindow *wHost);
4803
4804- RestackInfo *mRestackInfo; ///< restack info if window was restacked this paint round
4805- CompWindow *mWinToBePaintedBeforeThis; ///< Window which should be painted before this
4806- CompWindow *mWinThisIsPaintedBefore; ///< the inverse relation of mWinToBePaintedBeforeThis
4807- CompWindow *mMoreToBePaintedPrev;
4808- CompWindow *mMoreToBePaintedNext; ///< doubly linked list for windows underneath that
4809- ///< raise together with this one
4810- bool mConfigureNotified; ///< was mConfigureNotified before restack check
4811- CompWindow *mWinPassingThrough; ///< win. passing through this one during focus effect
4812- bool mWalkerOverNewCopy; ///< whether walker is on the copy at the new pos.
4813- int mVisitCount; ///< how many times walker/glPaint has visited this window
4814- bool mIsSecondary; ///< whether this is one of the secondary (non-topmost) in its restack chain
4815+ RestackInfo *mRestackInfo; ///< restack info if window was restacked this paint round
4816+ CompWindow *mWinToBePaintedBeforeThis; ///< Window which should be painted before this
4817+ CompWindow *mWinThisIsPaintedBefore; ///< the inverse relation of mWinToBePaintedBeforeThis
4818+ CompWindow *mMoreToBePaintedPrev;
4819+ CompWindow *mMoreToBePaintedNext; ///< doubly linked list for windows underneath that
4820+ ///< raise together with this one
4821+ bool mConfigureNotified; ///< was mConfigureNotified before restack check
4822+ CompWindow *mWinPassingThrough; ///< win. passing through this one during focus effect
4823+ bool mWalkerOverNewCopy; ///< whether walker is on the copy at the new pos.
4824+ int mVisitCount; ///< how many times walker/glPaint has visited this window
4825+ bool mIsSecondary; ///< whether this is one of the secondary (non-topmost) in its restack chain
4826 };
4827
4828 class FocusFadeAnim :
4829@@ -648,20 +712,22 @@
4830 public FadeAnim
4831 {
4832 public:
4833- FocusFadeAnim (CompWindow *w,
4834- WindowEvent curWindowEvent,
4835- float duration,
4836+
4837+ FocusFadeAnim (CompWindow *w,
4838+ WindowEvent curWindowEvent,
4839+ float duration,
4840 const AnimEffect info,
4841- const CompRect &icon);
4842+ const CompRect &icon);
4843 void updateAttrib (GLWindowPaintAttrib &attrib);
4844 void cleanUp (bool closing,
4845 bool destructing);
4846
4847 protected:
4848+
4849 void processCandidate (CompWindow *candidateWin,
4850 CompWindow *subjectWin,
4851 CompRegion &candidateAndSubjectIntersection,
4852- int &numSelectedCandidates);
4853+ int &numSelectedCandidates);
4854 GLushort computeOpacity (GLushort opacityInt);
4855 };
4856
4857@@ -682,15 +748,16 @@
4858 public TransformAnim
4859 {
4860 public:
4861- DodgeAnim (CompWindow *w,
4862- WindowEvent curWindowEvent,
4863- float duration,
4864+
4865+ DodgeAnim (CompWindow *w,
4866+ WindowEvent curWindowEvent,
4867+ float duration,
4868 const AnimEffect info,
4869- const CompRect &icon);
4870+ const CompRect &icon);
4871 void cleanUp (bool closing,
4872 bool destructing);
4873- static int getDodgeAmount (CompRect &rect,
4874- CompWindow *dw,
4875+ static int getDodgeAmount (CompRect &rect,
4876+ CompWindow *dw,
4877 DodgeDirection dir);
4878 void step ();
4879 void updateTransform (GLMatrix &wTransform);
4880@@ -698,18 +765,20 @@
4881 void updateBB (CompOutput &output);
4882 void postPreparePaint ();
4883 void calculateDodgeAmounts ();
4884- bool moveUpdate (int dx, int dy);
4885+ bool moveUpdate (int dx,
4886+ int dy);
4887
4888 protected:
4889+
4890 void processCandidate (CompWindow *candidateWin,
4891 CompWindow *subjectWin,
4892 CompRegion &candidateAndSubjectIntersection,
4893- int &numSelectedCandidates);
4894- void postInitiateRestackAnim (int numSelectedCandidates,
4895- int duration,
4896+ int &numSelectedCandidates);
4897+ void postInitiateRestackAnim (int numSelectedCandidates,
4898+ int duration,
4899 CompWindow *wStart,
4900 CompWindow *wEnd,
4901- bool raised);
4902+ bool raised);
4903 bool paintedElsewhere ();
4904 void applyDodgeTransform ();
4905 float dodgeProgress ();
4906@@ -733,14 +802,16 @@
4907 friend class DodgeAnim;
4908
4909 public:
4910+
4911 DodgePersistentData ();
4912
4913 private:
4914- int dodgeOrder; ///< dodge order (used temporarily)
4915+
4916+ int dodgeOrder; ///< dodge order (used temporarily)
4917
4918 // TODO mov the below members into DodgeAnim
4919- bool isDodgeSubject; ///< true if this window is the cause of dodging
4920- bool skipPostPrepareScreen;
4921+ bool isDodgeSubject; ///< true if this window is the cause of dodging
4922+ bool skipPostPrepareScreen;
4923 CompWindow *dodgeChainStart;///< for the subject window
4924 CompWindow *dodgeChainPrev; ///< for dodging windows
4925 CompWindow *dodgeChainNext; ///< for dodging windows
4926@@ -750,12 +821,14 @@
4927 public GridZoomAnim
4928 {
4929 public:
4930- DreamAnim (CompWindow *w,
4931- WindowEvent curWindowEvent,
4932- float duration,
4933+
4934+ DreamAnim (CompWindow *w,
4935+ WindowEvent curWindowEvent,
4936+ float duration,
4937 const AnimEffect info,
4938- const CompRect &icon);
4939+ const CompRect &icon);
4940 protected:
4941+
4942 void init ();
4943 void initGrid ();
4944 void step ();
4945@@ -771,12 +844,14 @@
4946 public GridZoomAnim
4947 {
4948 public:
4949- FoldAnim (CompWindow *w,
4950- WindowEvent curWindowEvent,
4951- float duration,
4952+
4953+ FoldAnim (CompWindow *w,
4954+ WindowEvent curWindowEvent,
4955+ float duration,
4956 const AnimEffect info,
4957- const CompRect &icon);
4958+ const CompRect &icon);
4959 protected:
4960+
4961 inline bool using3D () { return true; }
4962 float getFadeProgress ();
4963 void updateWindowAttrib (GLWindowPaintAttrib &attrib);
4964@@ -787,21 +862,23 @@
4965 public FoldAnim
4966 {
4967 public:
4968- CurvedFoldAnim (CompWindow *w,
4969- WindowEvent curWindowEvent,
4970- float duration,
4971+
4972+ CurvedFoldAnim (CompWindow *w,
4973+ WindowEvent curWindowEvent,
4974+ float duration,
4975 const AnimEffect info,
4976- const CompRect &icon);
4977+ const CompRect &icon);
4978 protected:
4979+
4980 void initGrid ();
4981 void step ();
4982 void updateBB (CompOutput &output);
4983 bool zoomToIcon ();
4984 float getObjectZ (GridAnim::GridModel *mModel,
4985- float forwardProgress,
4986- float sinForProg,
4987- float relDistToCenter,
4988- float curveMaxAmp);
4989+ float forwardProgress,
4990+ float sinForProg,
4991+ float relDistToCenter,
4992+ float curveMaxAmp);
4993 bool requiresTransformedWindow () const { return true; }
4994 };
4995
4996@@ -809,19 +886,21 @@
4997 public FoldAnim
4998 {
4999 public:
5000- HorizontalFoldsAnim (CompWindow *w,
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: