Merge lp:~mc-return/compiz/compiz.merge-performance-improvements-prevent-unnecessary-operations-if-we-return into lp:compiz/0.9.9

Proposed by MC Return on 2012-11-18
Status: Superseded
Proposed branch: lp:~mc-return/compiz/compiz.merge-performance-improvements-prevent-unnecessary-operations-if-we-return
Merge into: lp:compiz/0.9.9
Diff against target: 1767 lines (+177/-295)
35 files modified
compizconfig/integration/gnome/src/ccs_gnome_integration.c (+1/-2)
compizconfig/libcompizconfig/src/compiz.cpp (+18/-26)
kde/window-decorator-kde4/window.cpp (+2/-5)
plugins/animation/src/grid.cpp (+6/-9)
plugins/composite/src/screen.cpp (+2/-2)
plugins/composite/src/window.cpp (+4/-6)
plugins/cube/src/cube.cpp (+5/-11)
plugins/cubeaddon/src/cubeaddon.cpp (+3/-3)
plugins/decor/src/decor.cpp (+7/-16)
plugins/expo/src/expo.cpp (+1/-2)
plugins/firepaint/src/firepaint.cpp (+1/-3)
plugins/group/src/selection.cpp (+1/-2)
plugins/imgpng/src/imgpng.cpp (+3/-5)
plugins/imgsvg/src/imgsvg.cpp (+2/-3)
plugins/move/src/move.cpp (+2/-5)
plugins/obs/src/obs.cpp (+3/-8)
plugins/opengl/src/matrix.cpp (+3/-7)
plugins/opengl/src/vector.cpp (+10/-24)
plugins/regex/src/regex.cpp (+1/-3)
plugins/scale/src/scale.cpp (+11/-16)
plugins/scaleaddon/src/scaleaddon.cpp (+1/-2)
plugins/shift/src/shift.cpp (+4/-8)
plugins/showmouse/src/showmouse.cpp (+1/-3)
plugins/switcher/src/switcher.cpp (+2/-2)
plugins/trailfocus/src/trailfocus.cpp (+1/-2)
plugins/wall/src/wall.cpp (+6/-9)
plugins/wobbly/src/wobbly.cpp (+4/-7)
plugins/workspacenames/src/workspacenames.cpp (+2/-2)
src/action.cpp (+1/-2)
src/event.cpp (+3/-8)
src/modifierhandler.cpp (+1/-3)
src/option.cpp (+1/-3)
src/screen.cpp (+14/-32)
src/session.cpp (+3/-3)
src/window.cpp (+47/-51)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-performance-improvements-prevent-unnecessary-operations-if-we-return
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2012-12-05
Daniel van Vugt 2012-11-18 Approve on 2012-12-05
MC Return Resubmit on 2012-12-04
Review via email: mp+134805@code.launchpad.net

This proposal has been superseded by a proposal from 2012-12-05.

Commit Message

Minor Performance Optimizations:

* Return ASAP./Prevent executing any unnecessary operations if we return.
* Used De Morgan's laws to merge and simplify if statements.

Other Changes:

* C++ Style: Declared iterator variables inside the for loops they are used in.
* No logic changes have been made.

Description of the Change

I do not claim to have made all optimizations of this kind in this MP here, but for the sake of a reasonable .diff size and easier review I prefer to do the rest of those @ a later stage.
Essentially all the changes here just move bail-out checks to the top, or creation and assignment of variables not needed for the return checks further down the timeline.

Also some if statements have been merged and simplified by using De Morgan's laws.
If you find any logic changes in this MP you have found a mistake, please ping me in this case... :)

To post a comment you must log in.
Daniel van Vugt (vanvugt) wrote :

Changes like these won't actually provide any measurable improvement. At least not in the way they're being used here. They will however increase the risk of conflicts later.

I recommend against merging this. But other people might disagree.

review: Disapprove
Sam Spilsbury (smspillaz) wrote :

Risk of conflicts later isn't too big a deal IMO, conflicts can be resolved, we shouldn't prevent changes which improve the code on the basis of those.

Just a few general comments:

I note that changing this:

    Foo foo;

    ...

    foo = Foo (5);

    /* use foo */

to

    ...

    Foo foo (5);

    /* use foo */

Is only really effective in C++ because it means that you don't run the default constructor and then the assignment operator. For non plain-old-data types, the compiler cannot optimize out the running of the default constructor at the place the variable is declared because the constructor may change the state of the program.

As for C, it basically means that you can push a new chunk of memory onto the stack and initialize it at the same time, however variable declarations at the top of the block are necessary for C89 compliance (but not C99 compliance) so it will error out if you compile with -pedantic. I don't care which specification we stick to (we are not C89 compliant anyways, and IMO there's no harm in going with C99 as I don't anticipate that we will need to support Windows any time soon), but we should probably make a call and make a note of it somewhere (we really need a coding style document in the source tree)

192 - if (!w)
193 - return;
194 -
195 - if (state == ScaleScreen::Idle || state == ScaleScreen::In)
196 + if (!w || state == ScaleScreen::Idle || state == ScaleScreen::In)
197 return;

It is my opinion that multiple if statements or using temporary booleans are better than compound if statements. We have stuff like this in the unity codebase:

if (!IsWindowMaximized () ||
    !IsWindowInShowDesktopMode () ||
    (!IsWindowHidden () && IsWindowFocused ()) ||
    !AltTabViewable () ||
    !SomeOtherThing ())
{
}

And its just a complete mess. Stuff like this:

bool anyVariablesNull = (!w || !foo || !bar);
bool incorrectState = (state == ScaleState::In || state == ScaleState::Out);

if (anyVariablesNull ||
    incorrectState)
    return;

Is usually a lot better. The compiler can optimize that to be one big condition and return early.

Anyways, I think the best way to fix performance is to use runtime analysis tools to determine hot-spots in the code (like callgrind) in addition to static analysis. Take what static analysis says with a grain of salt - I think the general rule is that for changes like these - if you have a variable declaration that runs a non-trivial constructor, then it is definitely a useful optimization to ensure that constructor is only run once.

Also I'd suggest getting code under test to ensure that the behaviour isn't accidentally changed while refactoring. There's been a bit of that lately from everyone and its causing very subtle but annoying bugs to come up.

MC Return (mc-return) wrote :

Sam, Daniel - I know of course that the changes presented in this MP only bring minor to not-measurable speed changes. The main thing I tried to achieve here was moving variable declarations and assignments of local variables behind if statements, that would maybe trigger a return and make declaration and assignment of those variables unneeded in the case we return.

All that I did was instead of having:

int a, b, c;
CCSSettingButtonValue value;
float d, e, f;
int width = serverGeometry.widthIncBorders ();
int height = serverGeometry.heightIncBorders ();

if (something-else)
  return

a = 7;
b = 10;
c = 11;
value = ccsSettingGetValue (s)->value.asButton;

if (width && height)

We now have:

if (something-else)
  return

CCSSettingButtonValue value = ccsSettingGetValue (s)->value.asButton;

float d, e, f;
int a = 7;
int b = 10;
int c = 11;
int width = serverGeometry.widthIncBorders ();
int height = serverGeometry.heightIncBorders ();

if (width && height)

So this change:

1. Makes the code more readable, because you instantly know that a, b and c are ints, width and height's declarations and assignment of values are nearer the if statement, where those are actually used.

2. As all of those variables are not needed for the check if we return, we do not need to declare nor to declare and assign values to them, so even if the speed improvement is minor it will be there in the case we return.

The other minor improvements with the merges of if statements I've done here also do not make the code harder to read as maximum 3 ifs have been merged to one -
This is the most complicated one:

 if (nDesktop < 1 || nDesktop >= 0xffffffff || nDesktop == this->nDesktop)

I do agree, Sam, that deciphering complicated if statements can get complicated, but not those in this MP ;)
But of course I can also revert those changes if you cannot live with them ;)

So please have a look at the diff again to see that all of the changes are very minor and are all using only those 2 methods of optimization...

review: Resubmit
Daniel van Vugt (vanvugt) wrote :

1. This should be simplified:
    int i;

    for (i = 0; i < nValues; i++)
to:
    for (int i = 0; i < nValues; i++)

2. Weird spacing on 496, 504:
495 + int dx = 0;
496 + int width = serverGeometry.widthIncBorders ();

review: Needs Fixing
MC Return (mc-return) wrote :

> 1. This should be simplified:
> int i;
>
> for (i = 0; i < nValues; i++)
> to:
> for (int i = 0; i < nValues; i++)
>
> 2. Weird spacing on 496, 504:
> 495 + int dx = 0;
> 496 + int width = serverGeometry.widthIncBorders ();

I did not do that, because int i is used several times after declaration in several for loops, so I would have to declare it multiple times then - that is why I kept it as it was...

review: Resubmit
MC Return (mc-return) wrote :

> 2. Weird spacing on 496, 504:
> 495 + int dx = 0;
> 496 + int width = serverGeometry.widthIncBorders ();

Fixed that. Did not notice that one. Thanks.

MC Return (mc-return) wrote :

Daniel, 1. and 2. are fixed.
Additional simplifications, type 1., are to be found here:
https://code.launchpad.net/~mc-return/compiz/compiz.merge-declare-int-i-inside-for/+merge/137395

MC Return (mc-return) wrote :

Ping.

MC Return (mc-return) wrote :

Grmpf, sorry - commits r3519-r3533 should have gone here https://code.launchpad.net/~mc-return/compiz/compiz.merge-declare-int-i-inside-for/+merge/137395, but when I pushed bzr chose the old branch the other one was based on...

Nevertheless everything should work anyway, but I am sorry for making the diff larger than necessary...

Sam Spilsbury (smspillaz) wrote :

Its possible to get rid of them if you want:

bzr push --overwrite

or just push to a new branch and resubmit this with that as the source.

On Tue, Dec 4, 2012 at 9:57 PM, MC Return <email address hidden> wrote:
> Grmpf, sorry - commits r3519-r3533 should have gone here https://code.launchpad.net/~mc-return/compiz/compiz.merge-declare-int-i-inside-for/+merge/137395, but when I pushed bzr chose the old branch the other one was based on...
>
> Nevertheless everything should work anyway, but I am sorry for making the diff larger than necessary...
>
> --
> https://code.launchpad.net/~mc-return/compiz/compiz.merge-performance-improvements-prevent-unnecessary-operations-if-we-return/+merge/134805
> Your team Compiz Maintainers is subscribed to branch lp:compiz.

--
Sam Spilsbury

MC Return (mc-return) wrote :

> Its possible to get rid of them if you want:
>
> bzr push --overwrite
>
> or just push to a new branch and resubmit this with that as the source.
>

To be honest, I really hope it is not necessary. Up to r3509 everything
was already checked, up to r3518 I did the fixes Daniel suggested to do.

From r3519 to r3567 I just simplified all of the for iterator declarations
and moved those into their respective for loops. Note that I just did that
for .cpp files to not break C89 compliance (although it is allowed in C99).

The compiler would shout out if one of those variables would be needed outside
their respective for loops and would point out potential human errors made here
immediately.

Also note, that I did not make changes to plugins currently excluded from compilation.

review: Resubmit
MC Return (mc-return) wrote :

Ok, now it's ready (I hope) ;)

Daniel van Vugt (vanvugt) wrote :

Again, changes like this do not actually help with performance.

Please try to focus on fixing bugs in future, if you can.

review: Approve
Daniel van Vugt (vanvugt) wrote :

Also, in order for a proposal to get noticed after it has been set to Needs Fixing or Resubmit etc, you should click on "Resubmit proposal" to ensure it is more visible in the queue. Otherwise it looks like it still needs fixing from the summary page and won't get any attention.

3569. By MC Return on 2012-12-05

Merged lp:compiz and fixed conflict in shift.cpp

MC Return (mc-return) wrote :

> Also, in order for a proposal to get noticed after it has been set to Needs
> Fixing or Resubmit etc, you should click on "Resubmit proposal" to ensure it
> is more visible in the queue. Otherwise it looks like it still needs fixing
> from the summary page and won't get any attention.

Ok. Here is the first chance to try. :)
(Had to fix a text conflict in shift.cpp)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'compizconfig/integration/gnome/src/ccs_gnome_integration.c'
2--- compizconfig/integration/gnome/src/ccs_gnome_integration.c 2012-12-02 22:52:09 +0000
3+++ compizconfig/integration/gnome/src/ccs_gnome_integration.c 2012-12-05 09:41:22 +0000
4@@ -378,7 +378,6 @@
5 unsigned int buttonModMask)
6 {
7 CCSSetting *s;
8- CCSSettingButtonValue value;
9
10 s = findDisplaySettingForPlugin (context, plugin, setting);
11 if (!s)
12@@ -387,7 +386,7 @@
13 if (ccsSettingGetType (s) != TypeButton)
14 return;
15
16- value = ccsSettingGetValue (s)->value.asButton;
17+ CCSSettingButtonValue value = ccsSettingGetValue (s)->value.asButton;
18
19 if ((value.button != button) || (value.buttonModMask != buttonModMask))
20 {
21
22=== modified file 'compizconfig/libcompizconfig/src/compiz.cpp'
23--- compizconfig/libcompizconfig/src/compiz.cpp 2012-12-02 22:58:16 +0000
24+++ compizconfig/libcompizconfig/src/compiz.cpp 2012-12-05 09:41:22 +0000
25@@ -349,8 +349,7 @@
26
27 if (num)
28 {
29- int j;
30- for (j = 0; j < num; j++)
31+ for (int j = 0; j < num; j++)
32 {
33 CCSSettingValue *val;
34 val = (CCSSettingValue *) calloc (1, sizeof (CCSSettingValue));
35@@ -786,7 +785,6 @@
36 addStringExtensionFromPB (CCSPlugin * plugin,
37 const ExtensionMetadata & extensionPB)
38 {
39- int j;
40 CCSStrExtension *extension;
41
42 extension = (CCSStrExtension *) calloc (1, sizeof (CCSStrExtension));
43@@ -808,7 +806,7 @@
44 return;
45 }
46
47- for (j = 0; j < numRestrictions; j++)
48+ for (int j = 0; j < numRestrictions; j++)
49 {
50 const OptionMetadata::StringRestriction & restrictionPB =
51 extensionPB.str_restriction (j);
52@@ -829,10 +827,10 @@
53 initStringExtensionsFromPB (CCSPlugin * plugin,
54 const PluginMetadata & pluginPB)
55 {
56- int numExtensions, i;
57+ int numExtensions;
58
59 numExtensions = pluginPB.extension_size ();
60- for (i = 0; i < numExtensions; i++)
61+ for (int i = 0; i < numExtensions; i++)
62 addStringExtensionFromPB (plugin, pluginPB.extension (i));
63 }
64
65@@ -1111,7 +1109,6 @@
66 xmlXPathContextPtr xpathCtx;
67 xmlNode **rv = NULL;
68 int size;
69- int i;
70
71 *num = 0;
72
73@@ -1146,7 +1143,7 @@
74 }
75 *num = size;
76
77- for (i = 0; i < size; i++)
78+ for (int i = 0; i < size; i++)
79 rv[i] = xpathObj->nodesetval->nodeTab[i];
80
81 xmlXPathFreeObject (xpathObj);
82@@ -1554,8 +1551,7 @@
83 nodes = getNodesFromXPath (node->doc, node, "value", &num);
84 if (num)
85 {
86- int j;
87- for (j = 0; j < num; j++)
88+ for (int j = 0; j < num; j++)
89 {
90 void *valuePBv = NULL;
91 #ifdef USE_PROTOBUF
92@@ -1651,8 +1647,7 @@
93 if (num)
94 {
95 char *name;
96- int j;
97- for (j = 0; j < num; j++)
98+ for (int j = 0; j < num; j++)
99 {
100 value = getStringFromXPath (node->doc, nodes[j],
101 "value/child::text()");
102@@ -1792,9 +1787,8 @@
103 nodes = getNodesFromXPath (node->doc, node, "restriction", &num);
104 if (num)
105 {
106- int j;
107 char *name, *value;
108- for (j = 0; j < num; j++)
109+ for (int j = 0; j < num; j++)
110 {
111 #ifdef USE_PROTOBUF
112 OptionMetadata::StringRestriction * strRestrictionPB = NULL;
113@@ -2295,8 +2289,7 @@
114 &num);
115 if (num)
116 {
117- int i;
118- for (i = 0; i < num; i++)
119+ for (int i = 0; i < num; i++)
120 {
121 void *optionPBv = NULL;
122 #ifdef USE_PROTOBUF
123@@ -2333,8 +2326,7 @@
124
125 if (num)
126 {
127- int i;
128- for (i = 0; i < num; i++)
129+ for (int i = 0; i < num; i++)
130 {
131 char *value = stringFromNodeDef (nodes[i], "child::text()", NULL);
132
133@@ -2365,7 +2357,7 @@
134 void * extensionPBv)
135 {
136 xmlNode **nodes;
137- int num, j;
138+ int num;
139 CCSStrExtension *extension;
140 char *name;
141 char *value;
142@@ -2402,7 +2394,7 @@
143 return;
144 }
145
146- for (j = 0; j < num; j++)
147+ for (int j = 0; j < num; j++)
148 {
149 value = getStringFromXPath (node->doc, nodes[j], "value/child::text()");
150 if (value)
151@@ -2440,10 +2432,10 @@
152 void * pluginPBv)
153 {
154 xmlNode **nodes;
155- int num, i;
156+ int num;
157 nodes = getNodesFromXPath (node->doc, node, "/compiz/*/extension", &num);
158
159- for (i = 0; i < num; i++)
160+ for (int i = 0; i < num; i++)
161 {
162 void *extensionPBv = NULL;
163 #ifdef USE_PROTOBUF
164@@ -2952,7 +2944,7 @@
165 loadPluginsFromXMLFiles (CCSContext * context, char *path)
166 {
167 struct dirent **nameList;
168- int nFile, i;
169+ int nFile;
170
171 if (!path)
172 return;
173@@ -2968,7 +2960,7 @@
174 if (nFile <= 0)
175 return;
176
177- for (i = 0; i < nFile; i++)
178+ for (int i = 0; i < nFile; i++)
179 {
180 loadPluginFromXMLFile (context, nameList[i]->d_name, path);
181 free (nameList[i]);
182@@ -3028,7 +3020,7 @@
183 loadPluginsFromName (CCSContext * context, char *path)
184 {
185 struct dirent **nameList;
186- int nFile, i;
187+ int nFile;
188
189 if (!path)
190 return;
191@@ -3037,7 +3029,7 @@
192 if (nFile <= 0)
193 return;
194
195- for (i = 0; i < nFile; i++)
196+ for (int i = 0; i < nFile; i++)
197 {
198 char name[1024];
199 sscanf (nameList[i]->d_name, "lib%s", name);
200
201=== modified file 'kde/window-decorator-kde4/window.cpp'
202--- kde/window-decorator-kde4/window.cpp 2012-11-29 02:37:19 +0000
203+++ kde/window-decorator-kde4/window.cpp 2012-12-05 09:41:22 +0000
204@@ -1570,9 +1570,7 @@
205
206 if (status)
207 {
208- int i;
209-
210- for (i = 0; i < n; i++)
211+ for (int i = 0; i < n; i++)
212 {
213 if (p[i] == Atoms::wmTakeFocus)
214 mSupportTakeFocus = true;
215@@ -1627,7 +1625,6 @@
216 {
217 NETRootInfo *rootInfo = Decorator::rootInfo ();
218 QString name;
219- int i;
220 int winDesktop = desktop ();
221 QAction *action;
222 const int BASE = 10;
223@@ -1642,7 +1639,7 @@
224 action->setChecked (winDesktop == NET::OnAllDesktops);
225 mDesktopMenu->addSeparator ();
226
227- for (i = 1; i <= numberOfDesktops; i++)
228+ for (int i = 1; i <= numberOfDesktops; i++)
229 {
230 QString basic_name ("%1 %2");
231 if (i < BASE)
232
233=== modified file 'plugins/animation/src/grid.cpp'
234--- plugins/animation/src/grid.cpp 2012-09-05 23:54:21 +0000
235+++ plugins/animation/src/grid.cpp 2012-12-05 09:41:22 +0000
236@@ -219,15 +219,12 @@
237 unsigned int maxGridWidth,
238 unsigned int maxGridHeight)
239 {
240-
241+ if (region.isEmpty ()) // nothing to do
242+ return;
243+
244 GLfloat *v, *vMax;
245- float winContentsY, winContentsHeight;
246- int vSize;
247 bool notUsing3dCoords = !using3D ();
248
249- if (region.isEmpty ()) // nothing to do
250- return;
251-
252 CompRect outRect (mAWindow->savedRectsValid () ?
253 mAWindow->savedOutRect () :
254 mWindow->outputRect ());
255@@ -242,12 +239,12 @@
256 int oheight = outRect.height ();
257
258 // to be used if event is shade/unshade
259- winContentsY = oy + outExtents.top;
260- winContentsHeight = oheight - outExtents.top - outExtents.bottom;
261+ float winContentsY = oy + outExtents.top;
262+ float winContentsHeight = oheight - outExtents.top - outExtents.bottom;
263
264 GLWindow *gWindow = GLWindow::get (mWindow);
265 GLVertexBuffer *vertexBuffer = gWindow->vertexBuffer ();
266- vSize = vertexBuffer->getVertexStride ();
267+ int vSize = vertexBuffer->getVertexStride ();
268
269 // Indentation kept to provide a clean diff with the old code, for now...
270 {
271
272=== modified file 'plugins/composite/src/screen.cpp'
273--- plugins/composite/src/screen.cpp 2012-11-04 15:53:28 +0000
274+++ plugins/composite/src/screen.cpp 2012-12-05 09:41:22 +0000
275@@ -211,8 +211,6 @@
276 PluginClassHandler<CompositeScreen, CompScreen, COMPIZ_COMPOSITE_ABI> (s),
277 priv (new PrivateCompositeScreen (this))
278 {
279- int compositeMajor, compositeMinor;
280-
281 if (!XQueryExtension (s->dpy (), COMPOSITE_NAME,
282 &priv->compositeOpcode,
283 &priv->compositeEvent,
284@@ -224,6 +222,8 @@
285 return;
286 }
287
288+ int compositeMajor, compositeMinor;
289+
290 XCompositeQueryVersion (s->dpy (), &compositeMajor, &compositeMinor);
291 if (compositeMajor == 0 && compositeMinor < 2)
292 {
293
294=== modified file 'plugins/composite/src/window.cpp'
295--- plugins/composite/src/window.cpp 2012-10-16 05:11:10 +0000
296+++ plugins/composite/src/window.cpp 2012-12-05 09:41:22 +0000
297@@ -454,11 +454,11 @@
298 int width,
299 int height)
300 {
301+ if (!w->priv->redirected)
302+ return;
303+
304 bool initial = false;
305
306- if (!w->priv->redirected)
307- return;
308-
309 if (!w->priv->damaged)
310 {
311 w->priv->damaged = initial = true;
312@@ -481,12 +481,10 @@
313 void
314 CompositeWindow::updateOpacity ()
315 {
316- unsigned short opacity;
317-
318 if (priv->window->type () & CompWindowTypeDesktopMask)
319 return;
320
321- opacity = screen->getWindowProp32 (priv->window->id (),
322+ unsigned short opacity = screen->getWindowProp32 (priv->window->id (),
323 Atoms::winOpacity, OPAQUE);
324
325 if (opacity != priv->opacity)
326
327=== modified file 'plugins/cube/src/cube.cpp'
328--- plugins/cube/src/cube.cpp 2012-10-16 09:28:45 +0000
329+++ plugins/cube/src/cube.cpp 2012-12-05 09:41:22 +0000
330@@ -444,7 +444,6 @@
331 {
332 const GLfloat angle = 2 * M_PI / (GLfloat) ((n == 0) ? 1 : n);
333 const int size = abs (n);
334- int i;
335
336 *ppSint = (GLfloat *) calloc (sizeof (GLfloat), size + 1);
337 *ppCost = (GLfloat *) calloc (sizeof (GLfloat), size + 1);
338@@ -460,7 +459,7 @@
339 (*ppSint)[0] = 0.0;
340 (*ppCost)[0] = 1.0;
341
342- for (i = 1; i < size; i++)
343+ for (int i = 1; i < size; i++)
344 {
345 (*ppSint)[i] = sin (angle * i);
346 (*ppCost)[i] = cos (angle * i);
347@@ -489,8 +488,6 @@
348 GLfloat x;
349 GLfloat y;
350 GLfloat z;
351- int i;
352- int j;
353 int iStacksStart;
354 int iStacksEnd;
355 int iSlicesStart;
356@@ -548,14 +545,14 @@
357
358 glBegin (GL_QUADS);
359
360- for (i = iStacksStart; i < iStacksEnd; i++)
361+ for (int i = iStacksStart; i < iStacksEnd; i++)
362 {
363 afTexCoordX[0] = 1.0f;
364 afTexCoordX[1] = 1.0f - fStepX;
365 afTexCoordX[2] = 1.0f - fStepX;
366 afTexCoordX[3] = 1.0f;
367
368- for (j = iSlicesStart; j < iSlicesEnd; j++)
369+ for (int j = iSlicesStart; j < iSlicesEnd; j++)
370 {
371 /* bottom-right */
372 z = cost2[i];
373@@ -896,13 +893,11 @@
374 PaintOrder paintOrder,
375 int dx)
376 {
377- int output;
378-
379 if (!cubeScreen->cubeShouldPaintViewport (sAttrib, transform, outputPtr,
380 paintOrder))
381 return;
382
383- output = ((unsigned int) outputPtr->id () != (unsigned int) ~0)
384+ int output = ((unsigned int) outputPtr->id () != (unsigned int) ~0)
385 ? outputPtr->id () : 0;
386
387 mPaintOrder = paintOrder;
388@@ -968,7 +963,6 @@
389 {
390 GLScreenPaintAttrib sa = sAttrib;
391
392- int i;
393 int xMoveAdd;
394 int origXMoveAdd = 0; /* dx for the viewport we start
395 painting with (back-most). */
396@@ -1003,7 +997,7 @@
397 iFirstSign = 1;
398 }
399
400- for (i = 0; i <= hsize / 2; i++)
401+ for (int i = 0; i <= hsize / 2; i++)
402 {
403 /* move to the correct viewport (back to front). */
404 xMoveAdd = origXMoveAdd; /* move to farthest viewport. */
405
406=== modified file 'plugins/cubeaddon/src/cubeaddon.cpp'
407--- plugins/cubeaddon/src/cubeaddon.cpp 2012-09-07 22:37:20 +0000
408+++ plugins/cubeaddon/src/cubeaddon.cpp 2012-12-05 09:41:22 +0000
409@@ -52,6 +52,9 @@
410 void
411 CubeaddonScreen::CubeCap::load (bool scale, bool aspect, bool clamp)
412 {
413+ if (mFiles.empty ())
414+ return;
415+
416 CompSize tSize;
417 float xScale, yScale;
418
419@@ -61,9 +64,6 @@
420
421 mLoaded = false;
422
423- if (mFiles.empty ())
424- return;
425-
426 mCurrent = mCurrent % mFiles.size ();
427
428
429
430=== modified file 'plugins/decor/src/decor.cpp'
431--- plugins/decor/src/decor.cpp 2012-11-05 20:50:59 +0000
432+++ plugins/decor/src/decor.cpp 2012-12-05 09:41:22 +0000
433@@ -998,7 +998,6 @@
434 void
435 DecorWindow::setDecorationMatrices ()
436 {
437- int i;
438 float x0, y0;
439 decor_matrix_t a;
440 GLTexture::Matrix b;
441@@ -1006,7 +1005,7 @@
442 if (!wd)
443 return;
444
445- for (i = 0; i < wd->nQuad; i++)
446+ for (int i = 0; i < wd->nQuad; i++)
447 {
448 /* Set the quad matrix to the texture matrix */
449 wd->quad[i].matrix = wd->decor->texture->textures[0]->matrix ();
450@@ -1082,12 +1081,11 @@
451 {
452 int x1, y1, x2, y2;
453 float sx, sy;
454- int i;
455
456 if (!wd)
457 return;
458
459- for (i = 0; i < wd->nQuad; i++)
460+ for (int i = 0; i < wd->nQuad; i++)
461 {
462 int x, y;
463 unsigned int width = window->size ().width ();
464@@ -1180,7 +1178,6 @@
465 unsigned int decorType)
466 {
467 const unsigned int nTypeStates = 5;
468- unsigned int i;
469 struct typestate {
470 unsigned int compFlag;
471 unsigned int decorFlag;
472@@ -1193,7 +1190,7 @@
473 { CompWindowTypeUtilMask, DECOR_WINDOW_TYPE_UTILITY}
474 };
475
476- for (i = 0; i < nTypeStates; i++)
477+ for (unsigned int i = 0; i < nTypeStates; i++)
478 {
479 if ((decorType & typeStates[i].decorFlag) && (w->type () & typeStates[i].compFlag))
480 return true;
481@@ -1218,7 +1215,6 @@
482 unsigned int decorState)
483 {
484 const unsigned int nStateStates = 3;
485- unsigned int i;
486 struct statestate {
487 unsigned int compFlag;
488 unsigned int decorFlag;
489@@ -1233,7 +1229,7 @@
490 if (screen->activeWindow () == w->id ())
491 decorState &= ~(DECOR_WINDOW_STATE_FOCUS);
492
493- for (i = 0; i < nStateStates; i++)
494+ for (unsigned int i = 0; i < nStateStates; i++)
495 {
496 if ((decorState & stateStates[i].decorFlag) && (w->state () & stateStates[i].compFlag))
497 decorState &= ~(stateStates[i].decorFlag);
498@@ -1254,7 +1250,6 @@
499 unsigned int decorActions)
500 {
501 const unsigned int nActionStates =16;
502- unsigned int i;
503 struct actionstate {
504 unsigned int compFlag;
505 unsigned int decorFlag;
506@@ -1278,7 +1273,7 @@
507 { DECOR_WINDOW_ACTION_BELOW, CompWindowActionBelowMask },
508 };
509
510- for (i = 0; i < nActionStates; i++)
511+ for (unsigned int i = 0; i < nActionStates; i++)
512 {
513 if ((decorActions & actionStates[i].decorFlag) && (w->type () & actionStates[i].compFlag))
514 decorActions &= ~(actionStates[i].decorFlag);
515@@ -2484,10 +2479,8 @@
516 }
517 else
518 {
519- int i;
520-
521 /* A default decoration changed */
522- for (i = 0; i < DECOR_NUM; i++)
523+ for (int i = 0; i < DECOR_NUM; i++)
524 {
525 if (event->xproperty.atom == decorAtom[i])
526 {
527@@ -2785,9 +2778,7 @@
528 {
529 if (wd)
530 {
531- int i;
532-
533- for (i = 0; i < wd->nQuad; i++)
534+ for (int i = 0; i < wd->nQuad; i++)
535 {
536 wd->quad[i].box.x1 += dx;
537 wd->quad[i].box.y1 += dy;
538
539=== modified file 'plugins/expo/src/expo.cpp'
540--- plugins/expo/src/expo.cpp 2012-11-26 07:13:04 +0000
541+++ plugins/expo/src/expo.cpp 2012-12-05 09:41:22 +0000
542@@ -678,7 +678,6 @@
543 GLMatrix sTransform (transform);
544 float p1[3], p2[3], v[3], alpha;
545 GLint viewport[4];
546- int i;
547
548 gScreen->glApplyTransform (attrib, output, &sTransform);
549 sTransform.toScreenSpace (output, -attrib.zTranslate);
550@@ -692,7 +691,7 @@
551 sTransform, *gScreen->projectionMatrix (), viewport,
552 &p2[0], &p2[1], &p2[2]);
553
554- for (i = 0; i < 3; i++)
555+ for (int i = 0; i < 3; i++)
556 v[i] = p1[i] - p2[i];
557
558 alpha = -p1[2] / v[2];
559
560=== modified file 'plugins/firepaint/src/firepaint.cpp'
561--- plugins/firepaint/src/firepaint.cpp 2012-11-05 00:04:32 +0000
562+++ plugins/firepaint/src/firepaint.cpp 2012-12-05 09:41:22 +0000
563@@ -96,9 +96,7 @@
564 coords_cache.size = 0;
565 dcolors_cache.size = 0;
566
567- int i;
568-
569- for (i = 0; i < f_numParticles; i++)
570+ for (int i = 0; i < f_numParticles; i++)
571 {
572 Particle p;
573 p.life = 0.0f;
574
575=== modified file 'plugins/group/src/selection.cpp'
576--- plugins/group/src/selection.cpp 2012-07-30 09:53:16 +0000
577+++ plugins/group/src/selection.cpp 2012-12-05 09:41:22 +0000
578@@ -38,7 +38,6 @@
579 GroupWindow::windowInRegion (CompRegion src,
580 float precision)
581 {
582- int i;
583 int area = 0;
584 CompRegion buf;
585
586@@ -46,7 +45,7 @@
587 buf = window->region ().intersected (src);
588
589 /* buf area */
590- for (i = 0; i < buf.numRects (); i++)
591+ for (int i = 0; i < buf.numRects (); i++)
592 {
593 CompRect box = buf.rects ().at (i);
594 area += (box.width ()) * (box.height ()); /* width * height */
595
596=== modified file 'plugins/imgpng/src/imgpng.cpp'
597--- plugins/imgpng/src/imgpng.cpp 2012-09-07 22:37:20 +0000
598+++ plugins/imgpng/src/imgpng.cpp 2012-12-05 09:41:22 +0000
599@@ -56,9 +56,7 @@
600 png_row_infop row_info,
601 png_bytep data)
602 {
603- unsigned int i;
604-
605- for (i = 0; i < row_info->rowbytes; i += 4)
606+ for (unsigned int i = 0; i < row_info->rowbytes; i += 4)
607 {
608 unsigned char *base = &data[i];
609 unsigned char blue = base[0];
610@@ -84,7 +82,7 @@
611 {
612 png_uint_32 pngWidth, pngHeight;
613 int depth, colorType, interlace;
614- unsigned int pixelSize, i;
615+ unsigned int pixelSize;
616 png_byte **rowPointers;
617 char *d;
618
619@@ -144,7 +142,7 @@
620 return false;
621 }
622
623- for (i = 0; i < pngHeight; i++)
624+ for (unsigned int i = 0; i < pngHeight; i++)
625 rowPointers[i] = (png_byte *) (d + i * pngWidth * pixelSize);
626
627 png_read_image (png, rowPointers);
628
629=== modified file 'plugins/imgsvg/src/imgsvg.cpp'
630--- plugins/imgsvg/src/imgsvg.cpp 2012-12-04 12:11:28 +0000
631+++ plugins/imgsvg/src/imgsvg.cpp 2012-12-05 09:41:22 +0000
632@@ -236,7 +236,6 @@
633 if (context && reg.numRects ())
634 {
635 GLTexture::MatrixList matrix (1);
636- unsigned int i, j;
637 int x1, y1, x2, y2;
638 CompRect rect = context->box.boundingRect ();
639
640@@ -247,7 +246,7 @@
641
642 rect.setGeometry (x1, y1, x2 - x1, y2 - y1);
643
644- for (i = 0; i < context->texture[0].textures.size (); i++)
645+ for (unsigned int i = 0; i < context->texture[0].textures.size (); i++)
646 {
647 matrix[0] = context->texture[0].matrices[i];
648
649@@ -313,7 +312,7 @@
650 }
651 }
652
653- for (j = 0; j < context->texture[1].textures.size (); j++)
654+ for (unsigned int j = 0; j < context->texture[1].textures.size (); j++)
655 {
656 GLTexture::Filter saveFilter;
657 CompRegion r (rect);
658
659=== modified file 'plugins/move/src/move.cpp'
660--- plugins/move/src/move.cpp 2012-12-04 12:13:21 +0000
661+++ plugins/move/src/move.cpp 2012-12-05 09:41:22 +0000
662@@ -222,7 +222,6 @@
663 REGION r;
664 CompRect workArea;
665 BoxRec extents;
666- unsigned int i;
667
668 region = XCreateRegion ();
669 if (!region)
670@@ -243,7 +242,7 @@
671
672 XUnionRegion (&r, region, region);
673
674- for (i = 0; i < s->outputDevs ().size (); i++)
675+ for (unsigned int i = 0; i < s->outputDevs ().size (); i++)
676 {
677 XUnionRegion (s->outputDevs ()[i].region (), region, region);
678
679@@ -524,9 +523,7 @@
680 {
681 if (grab)
682 {
683- unsigned int i;
684-
685- for (i = 0; i < NUM_KEYS; i++)
686+ for (unsigned int i = 0; i < NUM_KEYS; i++)
687 {
688 if (event->xkey.keycode == key[i])
689 {
690
691=== modified file 'plugins/obs/src/obs.cpp'
692--- plugins/obs/src/obs.cpp 2012-11-26 07:13:04 +0000
693+++ plugins/obs/src/obs.cpp 2012-12-05 09:41:22 +0000
694@@ -197,9 +197,7 @@
695 void
696 ObsScreen::matchPropertyChanged (CompWindow *w)
697 {
698- unsigned int i;
699-
700- for (i = 0; i < MODIFIER_COUNT; i++)
701+ for (unsigned int i = 0; i < MODIFIER_COUNT; i++)
702 ObsWindow::get (w)->updatePaintModifier (i);
703
704 screen->matchPropertyChanged (w);
705@@ -249,9 +247,7 @@
706 bool
707 ObsWindow::updateTimeout ()
708 {
709- int i;
710-
711- for (i = 0; i < MODIFIER_COUNT; i++)
712+ for (int i = 0; i < MODIFIER_COUNT; i++)
713 updatePaintModifier (i);
714
715 return false;
716@@ -262,7 +258,6 @@
717 CompOption::Value &value)
718 {
719 CompOption *o;
720- unsigned int i;
721
722 if (!ObsOptions::setOption (name, value))
723 return false;
724@@ -271,7 +266,7 @@
725 if (!o)
726 return false;
727
728- for (i = 0; i < MODIFIER_COUNT; i++)
729+ for (unsigned int i = 0; i < MODIFIER_COUNT; i++)
730 {
731 if (o == matchOptions[i] || o == valueOptions[i])
732 {
733
734=== modified file 'plugins/opengl/src/matrix.cpp'
735--- plugins/opengl/src/matrix.cpp 2012-08-02 11:57:41 +0000
736+++ plugins/opengl/src/matrix.cpp 2012-12-05 09:41:22 +0000
737@@ -88,9 +88,7 @@
738 const float *a,
739 const float *b)
740 {
741- int i;
742-
743- for (i = 0; i < 4; i++)
744+ for (int i = 0; i < 4; i++)
745 {
746 const float ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3);
747
748@@ -148,9 +146,8 @@
749 {
750 GLVector result;
751 const float *a = lhs.m;
752- int i;
753
754- for (i = 0; i < 4; i++)
755+ for (int i = 0; i < 4; i++)
756 {
757 result[i] = A(i,0) * rhs[0] + A(i,1) * rhs[1] +
758 A(i,2) * rhs[2] + A(i,3) * rhs[3];
759@@ -170,7 +167,6 @@
760 bool GLMatrix::invert ()
761 {
762 float inv[16], det;
763- int i;
764
765 inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15]
766 + m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10];
767@@ -211,7 +207,7 @@
768
769 det = 1.0f / det;
770
771- for (i = 0; i < 16; i++)
772+ for (int i = 0; i < 16; i++)
773 m[i] = inv[i] * det;
774
775 return true;
776
777=== modified file 'plugins/opengl/src/vector.cpp'
778--- plugins/opengl/src/vector.cpp 2012-07-31 09:59:27 +0000
779+++ plugins/opengl/src/vector.cpp 2012-12-05 09:41:22 +0000
780@@ -95,9 +95,7 @@
781 GLVector&
782 GLVector::operator+= (const GLVector& rhs)
783 {
784- int i;
785-
786- for (i = 0; i < 4; i++)
787+ for (int i = 0; i < 4; i++)
788 v[i] += rhs[i];
789
790 return *this;
791@@ -108,9 +106,8 @@
792 const GLVector& rhs)
793 {
794 GLVector result;
795- int i;
796
797- for (i = 0; i < 4; i++)
798+ for (int i = 0; i < 4; i++)
799 result[i] = lhs[i] + rhs[i];
800
801 return result;
802@@ -119,9 +116,7 @@
803 GLVector&
804 GLVector::operator-= (const GLVector& rhs)
805 {
806- int i;
807-
808- for (i = 0; i < 4; i++)
809+ for (int i = 0; i < 4; i++)
810 v[i] -= rhs[i];
811
812 return *this;
813@@ -132,9 +127,8 @@
814 const GLVector& rhs)
815 {
816 GLVector result;
817- int i;
818
819- for (i = 0; i < 4; i++)
820+ for (int i = 0; i < 4; i++)
821 result[i] = lhs[i] - rhs[i];
822
823 return result;
824@@ -144,9 +138,8 @@
825 operator- (const GLVector& vector)
826 {
827 GLVector result;
828- int i;
829
830- for (i = 0; i < 4; i++)
831+ for (int i = 0; i < 4; i++)
832 result[i] = -vector[i];
833
834 return result;
835@@ -155,9 +148,7 @@
836 GLVector&
837 GLVector::operator*= (const float k)
838 {
839- int i;
840-
841- for (i = 0; i < 4; i++)
842+ for (int i = 0; i < 4; i++)
843 v[i] *= k;
844
845 return *this;
846@@ -168,9 +159,8 @@
847 const GLVector& rhs)
848 {
849 float result = 0;
850- int i;
851
852- for (i = 0; i < 4; i++)
853+ for (int i = 0; i < 4; i++)
854 result += lhs[i] * rhs[i];
855
856 return result;
857@@ -181,9 +171,8 @@
858 const GLVector& vector)
859 {
860 GLVector result;
861- int i;
862
863- for (i = 0; i < 4; i++)
864+ for (int i = 0; i < 4; i++)
865 result[i] = k * vector[i];
866
867 return result;
868@@ -199,9 +188,7 @@
869 GLVector&
870 GLVector::operator/= (const float k)
871 {
872- int i;
873-
874- for (i = 0; i < 4; i++)
875+ for (int i = 0; i < 4; i++)
876 v[i] /= k;
877
878 return *this;
879@@ -212,9 +199,8 @@
880 const float k)
881 {
882 GLVector result;
883- int i;
884
885- for (i = 0; i < 4; i++)
886+ for (int i = 0; i < 4; i++)
887 result[i] = vector[i] / k;
888
889 return result;
890
891=== modified file 'plugins/regex/src/regex.cpp'
892--- plugins/regex/src/regex.cpp 2012-01-18 16:26:45 +0000
893+++ plugins/regex/src/regex.cpp 2012-12-05 09:41:22 +0000
894@@ -147,9 +147,7 @@
895 int
896 RegexExp::matches (const CompString& str)
897 {
898- unsigned int i;
899-
900- for (i = 0; i < sizeof (prefix) / sizeof (prefix[0]); i++)
901+ for (unsigned int i = 0; i < sizeof (prefix) / sizeof (prefix[0]); i++)
902 if (str.compare (0, prefix[i].length, prefix[i].name) == 0)
903 return (int) i;
904
905
906=== modified file 'plugins/scale/src/scale.cpp'
907--- plugins/scale/src/scale.cpp 2012-10-12 09:05:18 +0000
908+++ plugins/scale/src/scale.cpp 2012-12-05 09:41:22 +0000
909@@ -425,29 +425,27 @@
910 PrivateScaleScreen::layoutSlotsForArea (const CompRect& workArea,
911 int nWindows)
912 {
913- int i, j;
914+ if (!nWindows)
915+ return;
916+
917 int x, y, width, height;
918- int lines, n, nSlots;
919- int spacing;
920-
921- if (!nWindows)
922- return;
923-
924- lines = sqrt (nWindows + 1);
925- spacing = optionGetSpacing ();
926- nSlots = 0;
927+ int n;
928+
929+ int lines = sqrt (nWindows + 1);
930+ int spacing = optionGetSpacing ();
931+ int nSlots = 0;
932
933 y = workArea.y () + spacing;
934 height = (workArea.height () - (lines + 1) * spacing) / lines;
935
936- for (i = 0; i < lines; i++)
937+ for (int i = 0; i < lines; i++)
938 {
939 n = MIN (nWindows - nSlots, ceilf ((float) nWindows / lines));
940
941 x = workArea.x () + spacing;
942 width = (workArea.width () - (n + 1) * spacing) / n;
943
944- for (j = 0; j < n; j++)
945+ for (int j = 0; j < n; j++)
946 {
947 slots[this->nSlots].setGeometry (x, y, width, height);
948
949@@ -1493,10 +1491,7 @@
950 void
951 PrivateScaleScreen::windowRemove (CompWindow *w)
952 {
953- if (!w)
954- return;
955-
956- if (state == ScaleScreen::Idle || state == ScaleScreen::In)
957+ if (!w || state == ScaleScreen::Idle || state == ScaleScreen::In)
958 return;
959
960 foreach (ScaleWindow *lw, windows)
961
962=== modified file 'plugins/scaleaddon/src/scaleaddon.cpp'
963--- plugins/scaleaddon/src/scaleaddon.cpp 2012-10-26 09:15:02 +0000
964+++ plugins/scaleaddon/src/scaleaddon.cpp 2012-12-05 09:41:22 +0000
965@@ -570,7 +570,6 @@
966 int x,
967 int y)
968 {
969- int i;
970 int x1, y1, x2, y2;
971 int overlapX, overlapY;
972 int xMin, xMax, yMin, yMax;
973@@ -584,7 +583,7 @@
974 x2 = x1 + WIN_W (ss->windows[win]) * as->scale;
975 y2 = y1 + WIN_H (ss->windows[win]) * as->scale;
976
977- for (i = 0; i < ss->nWindows; i++)
978+ for (int i = 0; i < ss->nWindows; i++)
979 {
980 if (i == win)
981 continue;
982
983=== modified file 'plugins/shift/src/shift.cpp'
984--- plugins/shift/src/shift.cpp 2012-12-02 23:21:03 +0000
985+++ plugins/shift/src/shift.cpp 2012-12-05 09:41:22 +0000
986@@ -538,7 +538,6 @@
987 int ww, wh;
988 float xScale, yScale;
989 float distance;
990- int i;
991
992 CompRect oe;
993
994@@ -588,7 +587,7 @@
995 space *= 2;
996 //space += (space / sin (PI / 4)) - space;
997
998- for (i = 0; i < 2; i++)
999+ for (int i = 0; i < 2; i++)
1000 {
1001 if (mInvert ^ (i == 0))
1002 {
1003@@ -676,7 +675,6 @@
1004 int ww, wh;
1005 float xScale, yScale;
1006 float distance;
1007- int i;
1008 float angle;
1009 int slotNum;
1010
1011@@ -722,7 +720,7 @@
1012
1013 angle = optionGetFlipRotation () * PI / 180.0;
1014
1015- for (i = 0; i < 2; i++)
1016+ for (int i = 0; i < 2; i++)
1017 {
1018 if (mInvert ^ (i == 0))
1019 distance = mMvTarget - index;
1020@@ -1349,7 +1347,6 @@
1021 {
1022 int steps;
1023 float amount, chunk;
1024- int i;
1025
1026 amount = msSinceLastPaint * 0.05f * optionGetShiftSpeed ();
1027 steps = amount / (0.5f * optionGetTimestep ());
1028@@ -1382,7 +1379,7 @@
1029 SHIFT_WINDOW (w);
1030
1031 mMoreAdjust |= sw->adjustShiftAttribs (chunk);
1032- for (i = 0; i < 2; i++)
1033+ for (int i = 0; i < 2; i++)
1034 {
1035 ShiftSlot *slot = &sw->mSlots[i];
1036 slot->tx = slot->x - w->x () -
1037@@ -1457,8 +1454,7 @@
1038 if (!mCancelled && mMvTarget != 0)
1039 {
1040 CompWindow *pw = NULL;
1041- int i;
1042- for (i = 0; i < mNSlots; i++)
1043+ for (int i = 0; i < mNSlots; i++)
1044 {
1045 w = mDrawSlots[i].w;
1046
1047
1048=== modified file 'plugins/showmouse/src/showmouse.cpp'
1049--- plugins/showmouse/src/showmouse.cpp 2012-11-05 00:19:28 +0000
1050+++ plugins/showmouse/src/showmouse.cpp 2012-12-05 09:41:22 +0000
1051@@ -99,9 +99,7 @@
1052 coords_cache.size = 0;
1053 dcolors_cache.size = 0;
1054
1055- int i;
1056-
1057- for (i = 0; i < f_numParticles; i++)
1058+ for (int i = 0; i < f_numParticles; i++)
1059 {
1060 Particle p;
1061 p.life = 0.0f;
1062
1063=== modified file 'plugins/switcher/src/switcher.cpp'
1064--- plugins/switcher/src/switcher.cpp 2012-09-07 23:56:21 +0000
1065+++ plugins/switcher/src/switcher.cpp 2012-12-05 09:41:22 +0000
1066@@ -966,7 +966,7 @@
1067
1068 if (window->id () == sScreen->popupWindow)
1069 {
1070- int x, y, x1, x2, cx, i;
1071+ int x, y, x1, x2, cx;
1072 unsigned short color[4];
1073
1074 CompWindow::Geometry &g = window->geometry ();
1075@@ -1013,7 +1013,7 @@
1076 wTransform.translate (cx, y, 0.0f);
1077
1078 glEnable (GL_BLEND);
1079- for (i = 0; i < 4; i++)
1080+ for (int i = 0; i < 4; i++)
1081 {
1082 color[i] = (unsigned int)sScreen->fgColor[i] *
1083 gWindow->lastPaintAttrib ().opacity /
1084
1085=== modified file 'plugins/trailfocus/src/trailfocus.cpp'
1086--- plugins/trailfocus/src/trailfocus.cpp 2012-07-29 22:51:52 +0000
1087+++ plugins/trailfocus/src/trailfocus.cpp 2012-12-05 09:41:22 +0000
1088@@ -150,7 +150,6 @@
1089 CompWindow *best = NULL;
1090 TfWindowList::iterator iter;
1091 int distance, bestDist = 1000000;
1092- unsigned int i;
1093
1094 for (iter = windows.begin (); iter != windows.end (); ++iter)
1095 if (*iter == tw)
1096@@ -178,7 +177,7 @@
1097 continue;
1098
1099 /* we do not want any windows already present in the list */
1100- for (i = 0; i < windows.size (); i++)
1101+ for (unsigned int i = 0; i < windows.size (); i++)
1102 {
1103 if (windows[i]->window == cur)
1104 {
1105
1106=== modified file 'plugins/wall/src/wall.cpp'
1107--- plugins/wall/src/wall.cpp 2012-11-29 09:20:51 +0000
1108+++ plugins/wall/src/wall.cpp 2012-12-05 09:41:22 +0000
1109@@ -70,7 +70,6 @@
1110 float outline = 2.0f;
1111 int width, height, radius;
1112 float r, g, b, a;
1113- unsigned int i, j;
1114
1115 destroyCairoContext (switcherContext);
1116 setupCairoContext (switcherContext);
1117@@ -124,11 +123,11 @@
1118 cairo_restore (cr);
1119
1120 cairo_save (cr);
1121- for (i = 0; i < (unsigned int) screen->vpSize ().height (); i++)
1122+ for (unsigned int i = 0; i < (unsigned int) screen->vpSize ().height (); i++)
1123 {
1124 cairo_translate (cr, 0.0, viewportBorder);
1125 cairo_save (cr);
1126- for (j = 0; j < (unsigned int) screen->vpSize ().width (); j++)
1127+ for (unsigned int j = 0; j < (unsigned int) screen->vpSize ().width (); j++)
1128 {
1129 cairo_translate (cr, viewportBorder, 0.0);
1130
1131@@ -949,7 +948,6 @@
1132 float width, height;
1133 float topLeftX, topLeftY;
1134 float border;
1135- unsigned int i, j;
1136 GLTexture::Matrix matrix;
1137 BOX box;
1138 GLMatrix wTransform (transform);
1139@@ -1020,9 +1018,9 @@
1140 height = (float) thumbContext.height;
1141
1142 thumbContext.texture[0]->enable (GLTexture::Fast);
1143- for (i = 0; i < (unsigned int) screen->vpSize ().width (); i++)
1144+ for (unsigned int i = 0; i < (unsigned int) screen->vpSize ().width (); i++)
1145 {
1146- for (j = 0; j < (unsigned int) screen->vpSize ().height (); j++)
1147+ for (unsigned int j = 0; j < (unsigned int) screen->vpSize ().height (); j++)
1148 {
1149 if (i == gotoX && j == gotoY && moving)
1150 continue;
1151@@ -1197,7 +1195,6 @@
1152
1153 if (optionGetMiniscreen ())
1154 {
1155- unsigned int i, j;
1156 float mw, mh;
1157
1158 mw = viewportWidth;
1159@@ -1209,9 +1206,9 @@
1160 mSAttribs.opacity = OPAQUE * (1.0 + mSzCamera);
1161 mSAttribs.saturation = COLOR;
1162
1163- for (j = 0; j < (unsigned int) screen->vpSize ().height (); j++)
1164+ for (unsigned int j = 0; j < (unsigned int) screen->vpSize ().height (); j++)
1165 {
1166- for (i = 0; i < (unsigned int) screen->vpSize ().width (); i++)
1167+ for (unsigned int i = 0; i < (unsigned int) screen->vpSize ().width (); i++)
1168 {
1169 float mx, my;
1170 unsigned int msMask;
1171
1172=== modified file 'plugins/wobbly/src/wobbly.cpp'
1173--- plugins/wobbly/src/wobbly.cpp 2012-08-14 06:33:22 +0000
1174+++ plugins/wobbly/src/wobbly.cpp 2012-12-05 09:41:22 +0000
1175@@ -1218,7 +1218,6 @@
1176 {
1177 float coeffsU[4], coeffsV[4];
1178 float x, y;
1179- int i, j;
1180
1181 coeffsU[0] = (1 - u) * (1 - u) * (1 - u);
1182 coeffsU[1] = 3 * u * (1 - u) * (1 - u);
1183@@ -1232,9 +1231,9 @@
1184
1185 x = y = 0.0f;
1186
1187- for (i = 0; i < 4; i++)
1188+ for (int i = 0; i < 4; i++)
1189 {
1190- for (j = 0; j < 4; j++)
1191+ for (int j = 0; j < 4; j++)
1192 {
1193 x += coeffsU[i] * coeffsV[j] *
1194 objects[j * GRID_WIDTH + i].position.x;
1195@@ -1288,9 +1287,8 @@
1196 {
1197 Object *object = &objects[0];
1198 float distance, minDistance = 0.0;
1199- int i;
1200
1201- for (i = 0; i < numObjects; i++)
1202+ for (int i = 0; i < numObjects; i++)
1203 {
1204 distance = objects[i].distanceToPoint (x, y);
1205 if (i == 0 || distance < minDistance)
1206@@ -2054,8 +2052,7 @@
1207
1208 if (wScreen->optionGetGrabWindowMatch ().evaluate (window))
1209 {
1210- int i;
1211- for (i = 0; i < model->numSprings; i++)
1212+ for (int i = 0; i < model->numSprings; i++)
1213 {
1214 s = &model->springs[i];
1215
1216
1217=== modified file 'plugins/workspacenames/src/workspacenames.cpp'
1218--- plugins/workspacenames/src/workspacenames.cpp 2012-06-22 12:27:42 +0000
1219+++ plugins/workspacenames/src/workspacenames.cpp 2012-12-05 09:41:22 +0000
1220@@ -28,7 +28,7 @@
1221 WSNamesScreen::getCurrentWSName ()
1222 {
1223 int currentVp;
1224- int listSize, i;
1225+ int listSize;
1226 CompString ret;
1227 CompOption::Value::Vector names;
1228 CompOption::Value::Vector vpNumbers;
1229@@ -40,7 +40,7 @@
1230 screen->vp ().x () + 1;
1231 listSize = MIN (vpNumbers.size (), names.size ());
1232
1233- for (i = 0; i < listSize; i++)
1234+ for (int i = 0; i < listSize; i++)
1235 if (vpNumbers[i].i () == currentVp)
1236 return names[i].s ();
1237
1238
1239=== modified file 'src/action.cpp'
1240--- src/action.cpp 2012-10-02 10:28:01 +0000
1241+++ src/action.cpp 2012-12-05 09:41:22 +0000
1242@@ -113,9 +113,8 @@
1243 edgeMaskToBindingString (unsigned int edgeMask)
1244 {
1245 CompString binding;
1246- int i;
1247
1248- for (i = 0; i < SCREEN_EDGE_NUM; i++)
1249+ for (int i = 0; i < SCREEN_EDGE_NUM; i++)
1250 if (edgeMask & (1 << i))
1251 binding += edges[i].modifierName;
1252
1253
1254=== modified file 'src/event.cpp'
1255--- src/event.cpp 2012-09-24 11:34:23 +0000
1256+++ src/event.cpp 2012-12-05 09:41:22 +0000
1257@@ -972,9 +972,7 @@
1258 w = screen->findWindow (event->xclient.window);
1259 if (w)
1260 {
1261- unsigned int i;
1262-
1263- for (i = 0; i < SCREEN_EDGE_NUM; i++)
1264+ for (unsigned int i = 0; i < SCREEN_EDGE_NUM; i++)
1265 {
1266 if (event->xclient.window == screenEdge[i].id)
1267 {
1268@@ -1016,9 +1014,7 @@
1269 w = screen->findWindow (event->xclient.window);
1270 if (w)
1271 {
1272- unsigned int i;
1273-
1274- for (i = 0; i < SCREEN_EDGE_NUM; i++)
1275+ for (unsigned int i = 0; i < SCREEN_EDGE_NUM; i++)
1276 {
1277 if (xdndWindow == screenEdge[i].id)
1278 {
1279@@ -1696,11 +1692,10 @@
1280 if (w)
1281 {
1282 unsigned long wState, state;
1283- int i;
1284
1285 wState = w->state ();
1286
1287- for (i = 1; i < 3; i++)
1288+ for (int i = 1; i < 3; i++)
1289 {
1290 state = cps::windowStateMask (event->xclient.data.l[i]);
1291 if (state & ~CompWindowStateHiddenMask)
1292
1293=== modified file 'src/modifierhandler.cpp'
1294--- src/modifierhandler.cpp 2012-05-10 12:01:17 +0000
1295+++ src/modifierhandler.cpp 2012-12-05 09:41:22 +0000
1296@@ -156,9 +156,7 @@
1297 unsigned int
1298 ModifierHandler::virtualToRealModMask (unsigned int modMask)
1299 {
1300- int i;
1301-
1302- for (i = 0; i < CompModNum; i++)
1303+ for (int i = 0; i < CompModNum; i++)
1304 {
1305 if (modMask & virtualModMask[i])
1306 {
1307
1308=== modified file 'src/option.cpp'
1309--- src/option.cpp 2012-10-16 03:36:10 +0000
1310+++ src/option.cpp 2012-12-05 09:41:22 +0000
1311@@ -381,9 +381,7 @@
1312 CompString name,
1313 unsigned int *index)
1314 {
1315- unsigned int i;
1316-
1317- for (i = 0; i < options.size (); i++)
1318+ for (unsigned int i = 0; i < options.size (); i++)
1319 {
1320 if (options[i].priv->name == name)
1321 {
1322
1323=== modified file 'src/screen.cpp'
1324--- src/screen.cpp 2012-12-04 16:09:08 +0000
1325+++ src/screen.cpp 2012-12-05 09:41:22 +0000
1326@@ -1190,12 +1190,12 @@
1327 void
1328 PrivateScreen::handleSelectionRequest (XEvent *event)
1329 {
1330- XSelectionEvent reply;
1331-
1332 if (wmSnSelectionWindow != event->xselectionrequest.owner ||
1333 wmSnAtom != event->xselectionrequest.selection)
1334 return;
1335
1336+ XSelectionEvent reply;
1337+
1338 reply.type = SelectionNotify;
1339 reply.display = dpy;
1340 reply.requestor = event->xselectionrequest.requestor;
1341@@ -1691,9 +1691,7 @@
1342
1343 if (XGetWMProtocols (dpy, id, &protocol, &count))
1344 {
1345- int i;
1346-
1347- for (i = 0; i < count; i++)
1348+ for (int i = 0; i < count; i++)
1349 {
1350 if (protocol[i] == Atoms::wmDeleteWindow)
1351 protocols |= CompWindowProtocolDeleteMask;
1352@@ -1877,17 +1875,16 @@
1353 PrivateScreen::setDesktopHints ()
1354 {
1355 unsigned long *data;
1356- int dSize, offset, hintSize;
1357- unsigned int i;
1358
1359- dSize = nDesktop * 2 + nDesktop * 2 + nDesktop * 4 + 1;
1360+ int dSize = nDesktop * 2 + nDesktop * 2 + nDesktop * 4 + 1;
1361
1362 data = (unsigned long *) malloc (sizeof (unsigned long) * dSize);
1363 if (!data)
1364 return;
1365
1366- offset = 0;
1367- hintSize = nDesktop * 2;
1368+ unsigned int i;
1369+ int offset = 0;
1370+ int hintSize = nDesktop * 2;
1371
1372 for (i = 0; i < nDesktop; i++)
1373 {
1374@@ -2228,9 +2225,8 @@
1375 { 0, -1, 1, -1, 0, 2, 0, 2 }, /* bottom-left */
1376 { 1, -1, 1, -1, 0, 2, 0, 2 } /* bottom-right */
1377 };
1378- int i;
1379
1380- for (i = 0; i < SCREEN_EDGE_NUM; i++)
1381+ for (int i = 0; i < SCREEN_EDGE_NUM; i++)
1382 {
1383 if (screenEdge[i].id)
1384 XMoveResizeWindow (dpy, screenEdge[i].id,
1385@@ -3477,9 +3473,7 @@
1386
1387 if (action->edgeMask ())
1388 {
1389- int i;
1390-
1391- for (i = 0; i < SCREEN_EDGE_NUM; i++)
1392+ for (int i = 0; i < SCREEN_EDGE_NUM; i++)
1393 if (action->edgeMask () & (1 << i))
1394 privateScreen.enableEdge (i);
1395 }
1396@@ -3492,10 +3486,7 @@
1397 void
1398 CompScreenImpl::removeAction (CompAction *action)
1399 {
1400- if (!privateScreen.initialized)
1401- return;
1402-
1403- if (!action->active ())
1404+ if (!(privateScreen.initialized || action->active ()))
1405 return;
1406
1407 grabManager.setCurrentState(action->state());
1408@@ -3508,9 +3499,7 @@
1409
1410 if (action->edgeMask ())
1411 {
1412- int i;
1413-
1414- for (i = 0; i < SCREEN_EDGE_NUM; i++)
1415+ for (int i = 0; i < SCREEN_EDGE_NUM; i++)
1416 if (action->edgeMask () & (1 << i))
1417 privateScreen.disableEdge (i);
1418 }
1419@@ -3971,10 +3960,7 @@
1420 void
1421 PrivateScreen::setNumberOfDesktops (unsigned int nDesktop)
1422 {
1423- if (nDesktop < 1 || nDesktop >= 0xffffffff)
1424- return;
1425-
1426- if (nDesktop == this->nDesktop)
1427+ if (nDesktop < 1 || nDesktop >= 0xffffffff || nDesktop == this->nDesktop)
1428 return;
1429
1430 if (currentDesktop >= nDesktop)
1431@@ -3990,10 +3976,7 @@
1432 void
1433 PrivateScreen::setCurrentDesktop (unsigned int desktop)
1434 {
1435- if (desktop >= nDesktop)
1436- return;
1437-
1438- if (desktop == currentDesktop)
1439+ if (desktop >= nDesktop || desktop == currentDesktop)
1440 return;
1441
1442 currentDesktop = desktop;
1443@@ -4135,10 +4118,9 @@
1444 {
1445 CompActiveWindowHistory *history = &this->history[currentHistory_];
1446 Window tmp, next = id;
1447- int i;
1448
1449 /* walk and move history */
1450- for (i = 0; i < ACTIVE_WINDOW_HISTORY_SIZE; i++)
1451+ for (int i = 0; i < ACTIVE_WINDOW_HISTORY_SIZE; i++)
1452 {
1453 tmp = history->id[i];
1454 history->id[i] = next;
1455
1456=== modified file 'src/session.cpp'
1457--- src/session.cpp 2012-02-16 05:31:28 +0000
1458+++ src/session.cpp 2012-12-05 09:41:22 +0000
1459@@ -60,7 +60,6 @@
1460 int nValues)
1461 {
1462 SmProp prop, *pProp;
1463- int i;
1464
1465 prop.name = (char *) name;
1466 prop.type = const_cast<char *> (SmLISTofARRAY8);
1467@@ -69,7 +68,7 @@
1468 if (!prop.vals)
1469 return;
1470
1471- for (i = 0; i < nValues; i++)
1472+ for (int i = 0; i < nValues; i++)
1473 {
1474 prop.vals[i].value = (char *) values[i];
1475 prop.vals[i].length = strlen (values[i]);
1476@@ -88,7 +87,6 @@
1477 setCloneRestartCommands (SmcConn connection)
1478 {
1479 const char **args;
1480- int i, count = 0;
1481
1482 /* at maximum, we pass our old arguments + our new client id
1483 to the SM, so allocate for that case */
1484@@ -96,6 +94,8 @@
1485 if (!args)
1486 return;
1487
1488+ int i, count = 0;
1489+
1490 for (i = 0; i < programArgc; i++)
1491 {
1492 if (strcmp (programArgv[i], "--sm-client-id") == 0)
1493
1494=== modified file 'src/window.cpp'
1495--- src/window.cpp 2012-12-05 07:37:13 +0000
1496+++ src/window.cpp 2012-12-05 09:41:22 +0000
1497@@ -504,12 +504,10 @@
1498 void
1499 CompWindow::changeState (unsigned int newState)
1500 {
1501- unsigned int oldState;
1502-
1503 if (priv->state == newState)
1504 return;
1505
1506- oldState = priv->state;
1507+ unsigned int oldState = priv->state;
1508 priv->state = newState;
1509
1510 recalcType ();
1511@@ -807,12 +805,12 @@
1512 void
1513 PrivateWindow::updateFrameWindow ()
1514 {
1515+ if (!serverFrame)
1516+ return;
1517+
1518 XWindowChanges xwc = XWINDOWCHANGES_INIT;
1519 unsigned int valueMask = CWX | CWY | CWWidth | CWHeight;
1520
1521- if (!serverFrame)
1522- return;
1523-
1524 xwc.x = serverGeometry.x ();
1525 xwc.y = serverGeometry.y ();
1526 xwc.width = serverGeometry.width ();
1527@@ -1716,14 +1714,14 @@
1528 void
1529 CompWindow::sendSyncRequest ()
1530 {
1531+ if (priv->syncWait)
1532+ return;
1533+
1534+ if (!priv->initializeSyncCounter ())
1535+ return;
1536+
1537 XClientMessageEvent xev;
1538
1539- if (priv->syncWait)
1540- return;
1541-
1542- if (!priv->initializeSyncCounter ())
1543- return;
1544-
1545 xev.type = ClientMessage;
1546 xev.window = priv->id;
1547 xev.message_type = Atoms::wmProtocols;
1548@@ -1748,11 +1746,11 @@
1549 void
1550 PrivateWindow::configure (XConfigureEvent *ce)
1551 {
1552+ if (priv->frame)
1553+ return;
1554+
1555 unsigned int valueMask = 0;
1556
1557- if (priv->frame)
1558- return;
1559-
1560 /* remove configure event from pending configures */
1561 if (priv->geometry.x () != ce->x)
1562 valueMask |= CWX;
1563@@ -1800,13 +1798,13 @@
1564 void
1565 PrivateWindow::configureFrame (XConfigureEvent *ce)
1566 {
1567+ if (!priv->frame)
1568+ return;
1569+
1570 int x, y, width, height;
1571 CompWindow *above;
1572 unsigned int valueMask = 0;
1573
1574- if (!priv->frame)
1575- return;
1576-
1577 /* remove configure event from pending configures */
1578 if (priv->frameGeometry.x () != ce->x)
1579 valueMask |= CWX;
1580@@ -2891,12 +2889,12 @@
1581 void
1582 PrivateWindow::saveGeometry (int mask)
1583 {
1584- int m = mask & ~saveMask;
1585-
1586 /* only save geometry if window has been placed */
1587 if (!placed)
1588 return;
1589
1590+ int m = mask & ~saveMask;
1591+
1592 if (m & CWX)
1593 saveWc.x = serverGeometry.x ();
1594
1595@@ -2983,14 +2981,14 @@
1596 PrivateWindow::reconfigureXWindow (unsigned int valueMask,
1597 XWindowChanges *xwc)
1598 {
1599- unsigned int frameValueMask = 0;
1600-
1601 if (id == screen->root ())
1602 {
1603 compLogMessage ("core", CompLogLevelWarn, "attempted to reconfigure root window");
1604 return;
1605 }
1606
1607+ unsigned int frameValueMask = 0;
1608+
1609 /* Remove redundant bits */
1610
1611 xwc->x = valueMask & CWX ? xwc->x : serverGeometry.x ();
1612@@ -3950,13 +3948,12 @@
1613 void
1614 PrivateWindow::updateSize ()
1615 {
1616- XWindowChanges xwc = XWINDOWCHANGES_INIT;
1617- int mask;
1618-
1619 if (window->overrideRedirect () || !managed)
1620 return;
1621
1622- mask = priv->addWindowSizeChanges (&xwc, priv->serverGeometry);
1623+ XWindowChanges xwc = XWINDOWCHANGES_INIT;
1624+
1625+ int mask = priv->addWindowSizeChanges (&xwc, priv->serverGeometry);
1626 if (mask)
1627 {
1628 if (priv->mapNum && (mask & (CWWidth | CWHeight)))
1629@@ -4214,12 +4211,12 @@
1630 void
1631 CompWindow::updateAttributes (CompStackingUpdateMode stackingMode)
1632 {
1633+ if (overrideRedirect () || !priv->managed)
1634+ return;
1635+
1636 XWindowChanges xwc = XWINDOWCHANGES_INIT;
1637 int mask = 0;
1638
1639- if (overrideRedirect () || !priv->managed)
1640- return;
1641-
1642 if (priv->state & CompWindowStateShadedMask && !priv->shaded)
1643 {
1644 windowNotify (CompWindowNotifyShade);
1645@@ -4297,12 +4294,6 @@
1646 void
1647 PrivateWindow::ensureWindowVisibility ()
1648 {
1649- int x1, y1, x2, y2;
1650- int width = serverGeometry.widthIncBorders ();
1651- int height = serverGeometry.heightIncBorders ();
1652- int dx = 0;
1653- int dy = 0;
1654-
1655 if (struts || attrib.override_redirect)
1656 return;
1657
1658@@ -4311,18 +4302,24 @@
1659 CompWindowTypeUnknownMask))
1660 return;
1661
1662- x1 = screen->workArea ().x () - screen->width () * screen->vp ().x ();
1663- y1 = screen->workArea ().y () - screen->height () * screen->vp ().y ();
1664- x2 = x1 + screen->workArea ().width () + screen->vpSize ().width () *
1665+ int x1 = screen->workArea ().x () - screen->width () * screen->vp ().x ();
1666+ int y1 = screen->workArea ().y () - screen->height () * screen->vp ().y ();
1667+ int x2 = x1 + screen->workArea ().width () + screen->vpSize ().width () *
1668 screen->width ();
1669- y2 = y1 + screen->workArea ().height () + screen->vpSize ().height () *
1670+ int y2 = y1 + screen->workArea ().height () + screen->vpSize ().height () *
1671 screen->height ();
1672
1673+ int dx = 0;
1674+ int width = serverGeometry.widthIncBorders ();
1675+
1676 if (serverGeometry.x () - serverInput.left >= x2)
1677 dx = (x2 - 25) - serverGeometry.x ();
1678 else if (serverGeometry.x () + width + serverInput.right <= x1)
1679 dx = (x1 + 25) - (serverGeometry.x () + width);
1680
1681+ int dy = 0;
1682+ int height = serverGeometry.heightIncBorders ();
1683+
1684 if (serverGeometry.y () - serverInput.top >= y2)
1685 dy = (y2 - 25) - serverGeometry.y ();
1686 else if (serverGeometry.y () + height + serverInput.bottom <= y1)
1687@@ -4440,11 +4437,11 @@
1688 void
1689 PrivateWindow::hide ()
1690 {
1691- bool onDesktop = window->onCurrentDesktop ();
1692-
1693 if (!managed)
1694 return;
1695
1696+ bool onDesktop = window->onCurrentDesktop ();
1697+
1698 if (!window->minimized () && !inShowDesktopMode &&
1699 !hidden && onDesktop)
1700 {
1701@@ -4487,11 +4484,11 @@
1702 void
1703 PrivateWindow::show ()
1704 {
1705- bool onDesktop = window->onCurrentDesktop ();
1706-
1707 if (!managed)
1708 return;
1709
1710+ bool onDesktop = window->onCurrentDesktop ();
1711+
1712 if (minimized || inShowDesktopMode ||
1713 hidden || !onDesktop)
1714 {
1715@@ -4959,7 +4956,6 @@
1716
1717 if (iw && ih)
1718 {
1719- unsigned long j;
1720 icon = new CompIcon (iw, ih);
1721 if (!icon)
1722 continue;
1723@@ -4971,7 +4967,7 @@
1724 /* EWMH doesn't say if icon data is premultiplied or
1725 not but most applications seem to assume data should
1726 be unpremultiplied. */
1727- for (j = 0; j < iw * ih; j++)
1728+ for (unsigned long j = 0; j < iw * ih; j++)
1729 {
1730 alpha = (idata[i + j + 2] >> 24) & 0xff;
1731 red = (idata[i + j + 2] >> 16) & 0xff;
1732@@ -5527,12 +5523,12 @@
1733 void
1734 PrivateWindow::updatePassiveButtonGrabs ()
1735 {
1736+ if (!priv->frame)
1737+ return;
1738+
1739 bool onlyActions = (priv->id == screen->activeWindow() ||
1740 !screen->getCoreOptions().optionGetClickToFocus ());
1741
1742- if (!priv->frame)
1743- return;
1744-
1745 /* Ungrab everything */
1746 XUngrabButton (screen->dpy(), AnyButton, AnyModifier, frame);
1747
1748@@ -5713,7 +5709,6 @@
1749 {
1750 unsigned int valueMask = CWX | CWY;
1751 XWindowChanges xwc = XWINDOWCHANGES_INIT;
1752- int m, wx, wy;
1753
1754 if (!priv->managed)
1755 return;
1756@@ -5724,8 +5719,9 @@
1757 if (priv->state & CompWindowStateStickyMask)
1758 return;
1759
1760- wx = tx;
1761- wy = ty;
1762+ int wx = tx;
1763+ int wy = ty;
1764+ int m;
1765
1766 if (screen->vpSize ().width ()!= 1)
1767 {

Subscribers

People subscribed via source and target branches