Skip to content

Commit b2834d3

Browse files
committed
Clarification.
1 parent 3b05627 commit b2834d3

File tree

1 file changed

+28
-34
lines changed

1 file changed

+28
-34
lines changed

src/animation/animation.c

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -630,15 +630,16 @@ static void
630630
modelUpdateBB (CompOutput *output,
631631
CompWindow * w)
632632
{
633+
float x, y;
634+
int i;
635+
633636
ANIM_WINDOW (w);
634637
ANIM_SCREEN (w->screen);
635638

636639
Model *model = aw->model;
637640
if (!model)
638641
return;
639642

640-
float x, y;
641-
int i;
642643
if (animZoomToIcon(as, aw))
643644
for (i = 0; i < model->numObjects; i++)
644645
{
@@ -1193,25 +1194,25 @@ modelInitObjects(Model * model, int x, int y, int width, int height)
11931194
}
11941195
else
11951196
{
1197+
int objIndex = 0;
1198+
11961199
// number of grid cells in y direction
11971200
nGridCellsY = model->gridHeight - 1;
11981201

1199-
int i = 0;
1200-
12011202
for (gridY = 0; gridY < model->gridHeight; gridY++)
12021203
{
12031204
float objectY =
12041205
y + ((gridY * height / nGridCellsY) -
12051206
y0) * model->scale.y + y0;
12061207
for (gridX = 0; gridX < model->gridWidth; gridX++)
12071208
{
1208-
objectInit(&model->objects[i],
1209+
objectInit(&model->objects[objIndex],
12091210
x + ((gridX * width / nGridCellsX) - x0) *
12101211
model->scale.x + x0,
12111212
objectY,
12121213
(float)gridX / nGridCellsX,
12131214
(float)gridY / nGridCellsY);
1214-
i++;
1215+
objIndex++;
12151216
}
12161217
}
12171218
}
@@ -1627,6 +1628,7 @@ initiateFocusAnimation(CompWindow *w)
16271628
CompScreen *s = w->screen;
16281629
ANIM_SCREEN(s);
16291630
ANIM_WINDOW(w);
1631+
int duration = 200;
16301632

16311633
if (aw->curWindowEvent != WindowEventNone || otherPluginsActive(as))
16321634
return;
@@ -1637,7 +1639,6 @@ initiateFocusAnimation(CompWindow *w)
16371639
if (switcherPostWait)
16381640
return;
16391641

1640-
int duration = 200;
16411642
AnimEffect chosenEffect =
16421643
getMatchingAnimSelection (w, WindowEventFocus, &duration);
16431644

@@ -1743,6 +1744,7 @@ initiateFocusAnimation(CompWindow *w)
17431744

17441745
if (chosenEffect == AnimEffectDodge)
17451746
{
1747+
float maxTransformTotalProgress = 0;
17461748
float dodgeMaxStartProgress =
17471749
numDodgingWins *
17481750
animGetF(as, aw, ANIM_SCREEN_OPTION_DODGE_GAP_RATIO) *
@@ -1754,7 +1756,6 @@ initiateFocusAnimation(CompWindow *w)
17541756

17551757
aw->isDodgeSubject = TRUE;
17561758
aw->dodgeChainStart = NULL;
1757-
float maxTransformTotalProgress = 0;
17581759

17591760
for (dw = wStart; dw && dw != wEnd->next; dw = dw->next)
17601761
{
@@ -2428,7 +2429,6 @@ animAddWindowGeometry(CompWindow * w,
24282429
}
24292430
// Assign quad vertices to indices
24302431
int jx, jy;
2431-
24322432
for (jy = 0; jy < nVertY - 1; jy++)
24332433
{
24342434
for (jx = 0; jx < nVertX - 1; jx++)
@@ -2460,15 +2460,15 @@ animAddWindowGeometry(CompWindow * w,
24602460
// For each vertex
24612461
for (jy = 0, y = y1; jy < nVertY; jy++)
24622462
{
2463+
float topiyFloat;
2464+
Bool applyOffsets = TRUE;
2465+
24632466
if (y > y2)
24642467
y = y2;
24652468

24662469
// Do calculations for y here to avoid repeating
24672470
// them unnecessarily in the x loop
24682471

2469-
float topiyFloat;
2470-
Bool applyOffsets = TRUE;
2471-
24722472
if (aw->curWindowEvent == WindowEventShade
24732473
|| aw->curWindowEvent == WindowEventUnshade)
24742474
{
@@ -3224,11 +3224,11 @@ animGetWindowName (CompWindow *w)
32243224
return retval;
32253225
}
32263226

3227-
// Don't animate windows that don't have a pixmap or certain properties,
3227+
// Returns true for windows that don't have a pixmap or certain properties,
32283228
// like the fullscreen darkening layer of gksudo
32293229
// or the darkening layer of x-session-manager
32303230
static inline Bool
3231-
ignoreForAnimation (CompWindow *w, Bool checkPixmap)
3231+
shouldIgnoreForAnim (CompWindow *w, Bool checkPixmap)
32323232
{
32333233
ANIM_WINDOW(w);
32343234

@@ -3275,11 +3275,11 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
32753275
if (w)
32763276
{
32773277
ANIM_WINDOW(w);
3278+
int duration;
32783279

3279-
if (ignoreForAnimation (w, TRUE))
3280+
if (shouldIgnoreForAnim (w, TRUE))
32803281
break;
32813282

3282-
int duration;
32833283
if (AnimEffectNone ==
32843284
getMatchingAnimSelection (w, WindowEventClose, &duration))
32853285
break;
@@ -3298,7 +3298,6 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
32983298
if (w->pendingUnmaps && onCurrentDesktop(w)) // Normal -> Iconic
32993299
{
33003300
ANIM_WINDOW(w);
3301-
33023301
int duration = 200;
33033302
AnimEffect chosenEffect =
33043303
getMatchingAnimSelection (w, WindowEventShade, &duration);
@@ -3451,14 +3450,14 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
34513450
else // X -> Withdrawn
34523451
{
34533452
ANIM_WINDOW(w);
3453+
int duration = 200;
34543454

34553455
// Always reset stacking related info when a window is closed.
34563456
resetStackingInfo (w->screen);
34573457

3458-
if (ignoreForAnimation (w, TRUE))
3458+
if (shouldIgnoreForAnim (w, TRUE))
34593459
break;
34603460

3461-
int duration = 200;
34623461
AnimEffect chosenEffect =
34633462
getMatchingAnimSelection (w, WindowEventClose, &duration);
34643463

@@ -3470,7 +3469,6 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
34703469
if (chosenEffect)
34713470
{
34723471
int tmpSteps = 0;
3473-
34743472
Bool startingNew = TRUE;
34753473

34763474
if (aw->animRemainingTime > 0 &&
@@ -3602,7 +3600,6 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
36023600
break;
36033601

36043602
ANIM_SCREEN(s);
3605-
int i;
36063603
int n = s->nClientList;
36073604
Bool winOpenedClosed = FALSE;
36083605

@@ -3636,6 +3633,7 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
36363633
int changeStart = -1;
36373634
int changeEnd = -1;
36383635

3636+
int i;
36393637
for (i = 0; i < n; i++)
36403638
{
36413639
CompWindow *wi =
@@ -3799,7 +3797,6 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
37993797
if (initial) // Unminimize or Open
38003798
{
38013799
ANIM_WINDOW(w);
3802-
38033800
int duration = 200;
38043801
AnimEffect chosenEffect;
38053802

@@ -3812,14 +3809,15 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
38123809
chosenEffect &&
38133810
!as->pluginActive[3]) // fadedesktop
38143811
{
3812+
Bool startingNew = TRUE;
3813+
Bool playEffect = TRUE;
3814+
38153815
// UNMINIMIZE event!
38163816

38173817
// Always reset stacking related info when a window is
38183818
// unminimized.
38193819
resetStackingInfo (w->screen);
38203820

3821-
Bool startingNew = TRUE;
3822-
38233821
if (aw->curWindowEvent != WindowEventNone)
38243822
{
38253823
if (aw->curWindowEvent != WindowEventMinimize)
@@ -3844,8 +3842,6 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
38443842
}
38453843
}
38463844

3847-
Bool playEffect = TRUE;
3848-
38493845
if (startingNew)
38503846
{
38513847
AnimEffect effectToBePlayed;
@@ -3904,6 +3900,7 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
39043900
if (chosenEffect)
39053901
{
39063902
Bool startingNew = TRUE;
3903+
Bool playEffect = TRUE;
39073904

39083905
if (aw->curWindowEvent != WindowEventNone)
39093906
{
@@ -3929,8 +3926,6 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
39293926
}
39303927
}
39313928

3932-
Bool playEffect = TRUE;
3933-
39343929
if (startingNew)
39353930
{
39363931
AnimEffect effectToBePlayed;
@@ -3966,17 +3961,17 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
39663961
}
39673962
else if (!w->invisible)
39683963
{
3964+
AnimEffect chosenEffect;
3965+
int duration = 200;
3966+
39693967
// Always reset stacking related info when a window is opened.
39703968
resetStackingInfo (w->screen);
39713969

39723970
aw->created = TRUE;
39733971

3974-
int duration = 200;
3975-
AnimEffect chosenEffect;
3976-
39773972
// OPEN event!
39783973

3979-
if (!ignoreForAnimation (w, FALSE) &&
3974+
if (!shouldIgnoreForAnim (w, FALSE) &&
39803975
AnimEffectNone !=
39813976
(chosenEffect =
39823977
getMatchingAnimSelection (w, WindowEventOpen, &duration)) &&
@@ -3986,6 +3981,7 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
39863981
getMousePointerXY(w->screen, &aw->icon.x, &aw->icon.y))
39873982
{
39883983
Bool startingNew = TRUE;
3984+
Bool playEffect = TRUE;
39893985

39903986
if (aw->curWindowEvent != WindowEventNone)
39913987
{
@@ -4011,8 +4007,6 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
40114007
}
40124008
}
40134009

4014-
Bool playEffect = TRUE;
4015-
40164010
if (startingNew)
40174011
{
40184012
AnimEffect effectToBePlayed;

0 commit comments

Comments
 (0)