~uriboni/compiz/unminimize-configurable-independently

« back to all changes in this revision

Viewing changes to plugins/wobbly/src/wobbly.cpp

Fixed various problems described in bug 1030473.
Optimized performance and style following suggestions reported by cppcheck:

1. Reduced the scope of various variables.

2. Used prefix ++ operators for non-primitive types, because those can be more efficient than post-increment. Post-increment usually keeps a copy of the previous value, adds extra code and is slower.. Fixes: https://bugs.launchpad.net/bugs/1030473. Approved by Daniel van Vugt, Sam Spilsbury.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
void
35
35
WobblyWindow::findNextWestEdge (Object *object)
36
36
{
37
 
    int v, v1, v2;
38
 
    int s, start;
39
 
    int e, end;
 
37
    int v1, v2;
 
38
    int start;
 
39
    int end;
40
40
    int x;
41
41
    int output;
42
42
    int workAreaEdge;
56
56
 
57
57
    if (x >= workAreaEdge)
58
58
    {
 
59
        int v, s, e;
59
60
        v1 = workAreaEdge;
60
61
 
61
62
        foreach (CompWindow *p, ::screen->windows ())
142
143
void
143
144
WobblyWindow::findNextEastEdge (Object *object)
144
145
{
145
 
    int v, v1, v2;
146
 
    int s, start;
147
 
    int e, end;
 
146
    int v1, v2;
 
147
    int start;
 
148
    int end;
148
149
    int x;
149
150
    int output;
150
151
    int workAreaEdge;
164
165
 
165
166
    if (x <= workAreaEdge)
166
167
    {
 
168
        int v, s, e;
167
169
        v1 = workAreaEdge;
168
170
 
169
171
        foreach (CompWindow *p, ::screen->windows ())
249
251
void
250
252
WobblyWindow::findNextNorthEdge (Object *object)
251
253
{
252
 
    int v, v1, v2;
253
 
    int s, start;
254
 
    int e, end;
 
254
    int v1, v2;
 
255
    int start;
 
256
    int end;
255
257
    int y;
256
258
    int output;
257
259
    int workAreaEdge;
271
273
 
272
274
    if (y >= workAreaEdge)
273
275
    {
 
276
        int v, s, e;
274
277
        v1 = workAreaEdge;
275
278
 
276
279
        foreach (CompWindow *p, ::screen->windows ())
356
359
void
357
360
WobblyWindow::findNextSouthEdge (Object *object)
358
361
{
359
 
    int v, v1, v2;
360
 
    int s, start;
361
 
    int e, end;
 
362
    int v1, v2;
 
363
    int start;
 
364
    int end;
362
365
    int y;
363
366
    int output;
364
367
    int workAreaEdge;
378
381
 
379
382
    if (y <= workAreaEdge)
380
383
    {
 
384
        int v, s, e;
381
385
        v1 = workAreaEdge;
382
386
 
383
387
        foreach (CompWindow *p, ::screen->windows ())
2141
2145
        if (ensureModel ())
2142
2146
        {
2143
2147
            Spring *s;
2144
 
            int    i;
2145
2148
 
2146
2149
            if (wScreen->optionGetMaximizeEffect ())
2147
2150
            {
2207
2210
 
2208
2211
            if (wScreen->optionGetGrabWindowMatch ().evaluate (window))
2209
2212
            {
 
2213
                int i;
2210
2214
                for (i = 0; i < model->numSprings; i++)
2211
2215
                {
2212
2216
                    s = &model->springs[i];