Merge lp:~mc-return/compiz/compiz.merge-composite-cleanup into lp:compiz/0.9.10

Proposed by MC Return
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3659
Merged at revision: 3662
Proposed branch: lp:~mc-return/compiz/compiz.merge-composite-cleanup
Merge into: lp:compiz/0.9.10
Diff against target: 709 lines (+113/-148)
3 files modified
plugins/composite/src/composite.cpp (+5/-1)
plugins/composite/src/screen.cpp (+56/-76)
plugins/composite/src/window.cpp (+52/-71)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-composite-cleanup
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sam Spilsbury Approve
MC Return Needs Resubmitting
Review via email: mp+158757@code.launchpad.net

Commit message

Composite code cleanup:

Merged a few if-if condition checks.
Declaration and assignment of local variables in one line.
Removed redundant brackets.
Added and removed newlines to improve readability.
Fixed indentation.

Description of the change

Hopefully no errors in this cleanup ;)

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Most of this is good.

394 foreach (CompWindow *dw, screen->destroyedWindows ())
395 - {
396 if (dw->next == w)
397 {
398 priv->withDestroyedWindows.push_back (dw);
399 destroyedWindows.remove (dw);
400 break;
401 }
402 - }

I'd just avoid removing braces in flow control blocks where there are nested flow control statements as suggested in another review. It hampers readability can can cause maintenance issues in future.

Also, I'd generally be careful with removing braces between the foreach and the loop body, foreach is implemented as a macro, and I think its implementation assumes that the body will be braced.

3656. By MC Return

Readded brackets to foreach loops

3657. By MC Return

Readded brackets to foreach loop

3658. By MC Return

Added brackets to foreach loop

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

Ok, all done.

Also added brackets to a foreach loop that had them missing even before this MP.
TBH, I do not think that the brackets are really needed there, but they will not hurt either...

review: Needs Resubmitting
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

360 + if (priv->optionGetForceIndependentOutputPainting () ||
361 + !screen->hasOverlappingOutputs ())
362 foreach (CompOutput &o, screen->outputDevs ())
363 + {
364 outputs.push_back (&o);
365 - }
366 + }
367 else

Hmm, there is still this one here.

I suggested earlier that where you have nested bodies of if () or for () statements which have brackets then the parent if () or for () control flow statement should also have brackets.

So the rule would be:

if (foo)
{
    if (bar)
    {
    }
} // OK

if (foo)
    if (bar)
    {
    } // Bad

if (foo)
{
    if (bar)
        baz (); // OK
}

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

> 360 + if (priv->optionGetForceIndependentOutputPainting () ||
> 361 + !screen->hasOverlappingOutputs ())
> 362 foreach (CompOutput &o, screen->outputDevs ())
> 363 + {
> 364 outputs.push_back (&o);
> 365 - }
> 366 + }
> 367 else
>
> Hmm, there is still this one here.
>
> I suggested earlier that where you have nested bodies of if () or for ()
> statements which have brackets then the parent if () or for () control flow
> statement should also have brackets.
>
> So the rule would be:
>
> if (foo)
> {
> if (bar)
> {
> }
> } // OK
>
> if (foo)
> if (bar)
> {
> } // Bad
>
> if (foo)
> {
> if (bar)
> baz (); // OK
> }

I understood that, but here it was:
357 - if (priv->optionGetForceIndependentOutputPainting ()
358 - || !screen->hasOverlappingOutputs ())
359 - {
362 foreach (CompOutput &o, screen->outputDevs ())
364 outputs.push_back (&o);
365 - }

Now it is:

360 + if (priv->optionGetForceIndependentOutputPainting () ||
361 + !screen->hasOverlappingOutputs ())
362 foreach (CompOutput &o, screen->outputDevs ())
363 + {
364 outputs.push_back (&o);
366 + }

But if you like me to re-add the if brackets, I can do that ofc.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Fri, Apr 19, 2013 at 6:49 PM, MC Return <email address hidden> wrote:
>
> I understood that, but here it was:
> 357 - if (priv->optionGetForceIndependentOutputPainting ()
> 358 - || !screen->hasOverlappingOutputs ())
> 359 - {
> 362 foreach (CompOutput &o, screen->outputDevs ())
> 364 outputs.push_back (&o);
> 365 - }
>
> Now it is:
>
> 360 + if (priv->optionGetForceIndependentOutputPainting () ||
> 361 + !screen->hasOverlappingOutputs ())
> 362 foreach (CompOutput &o, screen->outputDevs ())
> 363 + {
> 364 outputs.push_back (&o);
> 366 + }
>
> But if you like me to re-add the if brackets, I can do that ofc.

The first version complied with the rules, the second version doesn't
(eg, its more like example 2).

The code should read:

if (priv->optionGetForceIndependentOutputPainting () ||
    !screen->hasOverlappingOutputs ())
{
    foreach (CompOutput &o, screen->outputDevs ())
    {
        outputs.push_back (&o);
    }
}
>
> --
> https://code.launchpad.net/~mc-return/compiz/compiz.merge-composite-cleanup/+merge/158757
> Your team Compiz Maintainers is requested to review the proposed merge of lp:~mc-return/compiz/compiz.merge-composite-cleanup into lp:compiz.

--
Sam Spilsbury

3659. By MC Return

Readded brackets

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

>
> The first version complied with the rules, the second version doesn't
> (eg, its more like example 2).
>
> The code should read:
>
> if (priv->optionGetForceIndependentOutputPainting () ||
> !screen->hasOverlappingOutputs ())
> {
> foreach (CompOutput &o, screen->outputDevs ())
> {
> outputs.push_back (&o);
> }
> }

Ok, done in r3659.

review: Needs Resubmitting
Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/composite/src/composite.cpp'
2--- plugins/composite/src/composite.cpp 2012-02-08 10:54:35 +0000
3+++ plugins/composite/src/composite.cpp 2013-04-19 11:05:33 +0000
4@@ -67,17 +67,21 @@
5 if (!rv || !CompOption::findOption (getOptions (), name, &index))
6 return false;
7
8- switch (index) {
9+ switch (index)
10+ {
11 case CompositeOptions::DetectRefreshRate:
12 if (optionGetDetectRefreshRate ())
13 detectRefreshRate ();
14 break;
15+
16 case CompositeOptions::RefreshRate:
17 if (optionGetDetectRefreshRate ())
18 return false;
19+
20 redrawTime = 1000 / optionGetRefreshRate ();
21 optimalRedrawTime = redrawTime;
22 break;
23+
24 default:
25 break;
26 }
27
28=== modified file 'plugins/composite/src/screen.cpp'
29--- plugins/composite/src/screen.cpp 2013-01-28 19:22:29 +0000
30+++ plugins/composite/src/screen.cpp 2013-04-19 11:05:33 +0000
31@@ -56,8 +56,8 @@
32 {
33 CompWindow *w;
34
35- switch (event->type) {
36-
37+ switch (event->type)
38+ {
39 case CreateNotify:
40 if (screen->root () == event->xcreatewindow.parent)
41 {
42@@ -69,6 +69,7 @@
43 return;
44 }
45 break;
46+
47 case PropertyNotify:
48 if (event->xproperty.atom == Atoms::winOpacity)
49 {
50@@ -89,18 +90,15 @@
51 CompositeWindow::get (w)->updateSaturation ();
52 }
53 break;
54+
55 default:
56 if (shapeExtension &&
57 event->type == shapeEvent + ShapeNotify)
58 {
59 w = screen->findWindow (((XShapeEvent *) event)->window);
60- if (w)
61- {
62- if (w->mapNum ())
63- {
64- CompositeWindow::get (w)->addDamage ();
65- }
66- }
67+ if (w &&
68+ w->mapNum ())
69+ CompositeWindow::get (w)->addDamage ();
70 }
71 else if (event->type == damageEvent + XDamageNotify)
72 {
73@@ -112,10 +110,12 @@
74
75 screen->handleEvent (event);
76
77- switch (event->type) {
78+ switch (event->type)
79+ {
80 case Expose:
81 handleExposeEvent (&event->xexpose);
82 break;
83+
84 case ClientMessage:
85 if (event->xclient.message_type == Atoms::winOpacity)
86 {
87@@ -128,8 +128,7 @@
88 Atoms::winOpacity, opacity);
89 }
90 }
91- else if (event->xclient.message_type ==
92- Atoms::winBrightness)
93+ else if (event->xclient.message_type == Atoms::winBrightness)
94 {
95 w = screen->findWindow (event->xclient.window);
96 if (w)
97@@ -140,8 +139,7 @@
98 Atoms::winBrightness, brightness);
99 }
100 }
101- else if (event->xclient.message_type ==
102- Atoms::winSaturation)
103+ else if (event->xclient.message_type == Atoms::winSaturation)
104 {
105 w = screen->findWindow (event->xclient.window);
106 if (w)
107@@ -153,15 +151,14 @@
108 }
109 }
110 break;
111+
112 default:
113 if (event->type == damageEvent + XDamageNotify)
114 {
115 XDamageNotifyEvent *de = (XDamageNotifyEvent *) event;
116
117 if (lastDamagedWindow && de->drawable == lastDamagedWindow->id ())
118- {
119 w = lastDamagedWindow;
120- }
121 else
122 {
123 w = screen->findWindow (de->drawable);
124@@ -176,13 +173,9 @@
125 event->type == shapeEvent + ShapeNotify)
126 {
127 w = screen->findWindow (((XShapeEvent *) event)->window);
128- if (w)
129- {
130- if (w->mapNum ())
131- {
132- CompositeWindow::get (w)->addDamage ();
133- }
134- }
135+
136+ if (w && w->mapNum ())
137+ CompositeWindow::get (w)->addDamage ();
138 }
139 else if (randrExtension &&
140 event->type == randrEvent + RRScreenChangeNotify)
141@@ -204,7 +197,6 @@
142 return priv->damageEvent;
143 }
144
145-
146 template class PluginClassHandler<CompositeScreen, CompScreen, COMPIZ_COMPOSITE_ABI>;
147
148 CompositeScreen::CompositeScreen (CompScreen *s) :
149@@ -262,10 +254,7 @@
150 priv->slowAnimations = false;
151
152 if (!priv->init ())
153- {
154- setFailed ();
155- }
156-
157+ setFailed ();
158 }
159
160 CompositeScreen::~CompositeScreen ()
161@@ -276,7 +265,6 @@
162 delete priv;
163 }
164
165-
166 PrivateCompositeScreen::PrivateCompositeScreen (CompositeScreen *cs) :
167 cScreen (cs),
168 compositeEvent (0),
169@@ -337,39 +325,35 @@
170 Time cmSnTimestamp = 0;
171 XEvent event;
172 XSetWindowAttributes attr;
173- Window currentCmSnOwner;
174 char buf[128];
175
176 snprintf (buf, 128, "_NET_WM_CM_S%d", screen->screenNum ());
177 cmSnAtom = XInternAtom (dpy, buf, 0);
178
179- currentCmSnOwner = XGetSelectionOwner (dpy, cmSnAtom);
180+ Window currentCmSnOwner = XGetSelectionOwner (dpy, cmSnAtom);
181
182- if (currentCmSnOwner != None)
183+ if (currentCmSnOwner != None &&
184+ !replaceCurrentWm)
185 {
186- if (!replaceCurrentWm)
187- {
188- compLogMessage (
189- "composite", CompLogLevelError,
190- "Screen %d on display \"%s\" already has a compositing "
191- "manager (%x); try using the --replace option to replace "
192- "the current compositing manager.",
193- screen->screenNum (), DisplayString (dpy), currentCmSnOwner);
194+ compLogMessage (
195+ "composite", CompLogLevelError,
196+ "Screen %d on display \"%s\" already has a compositing "
197+ "manager (%x); try using the --replace option to replace "
198+ "the current compositing manager.",
199+ screen->screenNum (), DisplayString (dpy), currentCmSnOwner);
200
201- return false;
202- }
203+ return false;
204 }
205
206 attr.override_redirect = true;
207 attr.event_mask = PropertyChangeMask;
208
209- newCmSnOwner =
210- XCreateWindow (dpy, screen->root (),
211- -100, -100, 1, 1, 0,
212- CopyFromParent, CopyFromParent,
213- CopyFromParent,
214- CWOverrideRedirect | CWEventMask,
215- &attr);
216+ newCmSnOwner = XCreateWindow (dpy, screen->root (),
217+ -100, -100, 1, 1, 0,
218+ CopyFromParent, CopyFromParent,
219+ CopyFromParent,
220+ CWOverrideRedirect | CWEventMask,
221+ &attr);
222
223 XChangeProperty (dpy, newCmSnOwner, Atoms::wmName, Atoms::utf8String, 8,
224 PropModeReplace, (unsigned char *) PACKAGE,
225@@ -407,7 +391,6 @@
226 return true;
227 }
228
229-
230 bool
231 CompositeScreen::registerPaintHandler (compiz::composite::PaintHandler *pHnd)
232 {
233@@ -505,7 +488,6 @@
234 * Call through damageRegion since plugins listening for incoming damage
235 * may need to know that the whole screen was redrawn
236 */
237-
238 if (!alreadyDamaged)
239 damageRegion (CompRegion (0, 0, screen->width (), screen->height ()));
240 }
241@@ -521,13 +503,15 @@
242 priv->damage += region;
243 priv->damageMask |= COMPOSITE_SCREEN_DAMAGE_REGION_MASK;
244
245- /* if the number of damage rectangles grows two much between repaints,
246- we have a lot of overhead just for doing the damage tracking -
247- in order to make sure we're not having too much overhead, damage
248- the whole screen if we have a lot of damage rects */
249+ /* If the number of damage rectangles grows two much between repaints,
250+ * we have a lot of overhead just for doing the damage tracking -
251+ * in order to make sure we're not having too much overhead, damage
252+ * the whole screen if we have a lot of damage rects
253+ */
254
255 if (priv->damage.numRects () > 100)
256- damageScreen ();
257+ damageScreen ();
258+
259 priv->scheduleRepaint ();
260 }
261
262@@ -575,9 +559,7 @@
263 CompositeScreen::hideOutputWindow ()
264 {
265 Display *dpy = screen->dpy ();
266- XserverRegion region;
267-
268- region = XFixesCreateRegion (dpy, NULL, 0);
269+ XserverRegion region = XFixesCreateRegion (dpy, NULL, 0);
270
271 XFixesSetWindowShapeRegion (dpy,
272 priv->output,
273@@ -600,9 +582,7 @@
274 screen->windows ().rbegin ();
275 rit != screen->windows ().rend (); ++rit)
276 if (CompositeWindow::get (*rit)->overlayWindow ())
277- {
278 tmpRegion -= (*rit)->region ();
279- }
280
281 XShapeCombineRegion (dpy, priv->output, ShapeBounding,
282 0, 0, tmpRegion.handle (), ShapeSet);
283@@ -619,7 +599,6 @@
284
285 priv->outputShapeChanged = true;
286 }
287-
288 }
289
290 bool
291@@ -735,18 +714,19 @@
292 scheduled = true;
293
294 int delay;
295+
296 if (FPSLimiterMode == CompositeFPSLimiterModeVSyncLike ||
297 (pHnd && pHnd->hasVSync ()))
298- {
299 delay = 1;
300- }
301 else
302 {
303 struct timeval now;
304 gettimeofday (&now, 0);
305 int elapsed = compiz::core::timer::timeval_diff (&now, &lastRedraw);
306+
307 if (elapsed < 0)
308 elapsed = 0;
309+
310 delay = elapsed < optimalRedrawTime ? optimalRedrawTime - elapsed : 1;
311 }
312
313@@ -778,12 +758,10 @@
314
315 if (priv->damageMask)
316 {
317- int timeDiff;
318-
319 if (priv->pHnd)
320 priv->pHnd->prepareDrawing ();
321
322- timeDiff = compiz::core::timer::timeval_diff (&tv, &priv->lastRedraw);
323+ int timeDiff = compiz::core::timer::timeval_diff (&tv, &priv->lastRedraw);
324
325 /* handle clock rollback */
326 if (timeDiff < 0)
327@@ -828,14 +806,13 @@
328
329 priv->tmpRegion = priv->damage & screen->region ();
330
331- if (priv->damageMask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK)
332- {
333- if (priv->tmpRegion == screen->region ())
334+ if (priv->damageMask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK &&
335+ priv->tmpRegion == screen->region ())
336 damageScreen ();
337- }
338
339 Display *dpy = screen->dpy ();
340 std::map<Damage, XRectangle>::iterator d = priv->damages.begin ();
341+
342 for (; d != priv->damages.end (); ++d)
343 {
344 XserverRegion sub = XFixesCreateRegion (dpy, &d->second, 1);
345@@ -845,6 +822,7 @@
346 XFixesDestroyRegion (dpy, sub);
347 }
348 }
349+
350 XSync (dpy, False);
351 priv->damages.clear ();
352
353@@ -855,11 +833,13 @@
354
355 CompOutput::ptrList outputs (0);
356
357- if (priv->optionGetForceIndependentOutputPainting ()
358- || !screen->hasOverlappingOutputs ())
359+ if (priv->optionGetForceIndependentOutputPainting () ||
360+ !screen->hasOverlappingOutputs ())
361 {
362 foreach (CompOutput &o, screen->outputDevs ())
363+ {
364 outputs.push_back (&o);
365+ }
366 }
367 else
368 outputs.push_back (&screen->fullscreenOutput ());
369@@ -890,8 +870,6 @@
370 return false;
371 }
372
373-
374-
375 void
376 CompositeScreen::preparePaint (int msSinceLastPaint)
377 WRAPABLE_HND_FUNCTN (preparePaint, msSinceLastPaint)
378@@ -964,10 +942,12 @@
379 if (event->count == 0)
380 {
381 CompRect rect;
382+
383 foreach (CompRect rect, exposeRects)
384 {
385 cScreen->damageRegion (CompRegion (rect));
386 }
387+
388 exposeRects.clear ();
389 }
390 }
391@@ -987,13 +967,13 @@
392 CompOption::Vector &options)
393 {
394 CompositeScreen *cs = CompositeScreen::get (screen);
395+
396 if (cs)
397 cs->priv->slowAnimations = !cs->priv->slowAnimations;
398
399 return true;
400 }
401
402-
403 void
404 CompositeScreenInterface::preparePaint (int msSinceLastPaint)
405 WRAPABLE_DEF (preparePaint, msSinceLastPaint)
406
407=== modified file 'plugins/composite/src/window.cpp'
408--- plugins/composite/src/window.cpp 2013-01-03 16:05:26 +0000
409+++ plugins/composite/src/window.cpp 2013-04-19 11:05:33 +0000
410@@ -37,16 +37,13 @@
411 CompScreen *s = screen;
412
413 if (w->windowClass () != InputOnly)
414- {
415 priv->damage = XDamageCreate (s->dpy (), w->id (),
416 XDamageReportBoundingBox);
417- }
418 else
419- {
420 priv->damage = None;
421- }
422
423 priv->opacity = OPAQUE;
424+
425 if (!(w->type () & CompWindowTypeDesktopMask))
426 priv->opacity = s->getWindowProp32 (w->id (),
427 Atoms::winOpacity, OPAQUE);
428@@ -63,7 +60,6 @@
429
430 CompositeWindow::~CompositeWindow ()
431 {
432-
433 if (priv->damage)
434 XDamageDestroy (screen->dpy (), priv->damage);
435
436@@ -129,13 +125,10 @@
437
438 PrivateCompositeWindow::~PrivateCompositeWindow ()
439 {
440-
441 if (sizeDamage)
442 free (damageRects);
443 }
444
445-
446-
447 bool
448 PrivateCompositeWindow::bind ()
449 {
450@@ -191,7 +184,6 @@
451 * but not yet on our side as it's pretty likely that plugins are
452 * currently using it for animations
453 */
454-
455 bool pendingUnmap = !window->mapNum () && window->isViewable ();
456 bool hidden = window->state () & CompWindowStateHiddenMask;
457 bool animated = window->hasUnmapReference ();
458@@ -257,10 +249,8 @@
459 priv->cScreen->updateOutputWindow ();
460
461 XCompositeUnredirectWindow (screen->dpy (),
462- ROOTPARENT (priv->window),
463- CompositeRedirectManual);
464-
465-
466+ ROOTPARENT (priv->window),
467+ CompositeRedirectManual);
468 }
469
470 bool
471@@ -288,12 +278,10 @@
472 float yTranslate,
473 const CompRect &rect)
474 {
475- int x1, x2, y1, y2;
476-
477- x1 = (short) (rect.x1 () * xScale) - 1;
478- y1 = (short) (rect.y1 () * yScale) - 1;
479- x2 = (short) (rect.x2 () * xScale + 0.5f) + 1;
480- y2 = (short) (rect.y2 () * yScale + 0.5f) + 1;
481+ int x1 = (short) (rect.x1 () * xScale) - 1;
482+ int y1 = (short) (rect.y1 () * yScale) - 1;
483+ int x2 = (short) (rect.x2 () * xScale + 0.5f) + 1;
484+ int y2 = (short) (rect.y2 () * yScale + 0.5f) + 1;
485
486 x1 += (short) xTranslate;
487 y1 += (short) yTranslate;
488@@ -322,16 +310,14 @@
489 if (priv->window->shaded () ||
490 (priv->window->isViewable ()))
491 {
492- int x1, x2, y1, y2;
493-
494 const CompWindow::Geometry &geom = priv->window->geometry ();
495 const CompWindowExtents &output = priv->window->output ();
496
497 /* top */
498- x1 = -output.left - geom.border ();
499- y1 = -output.top - geom.border ();
500- x2 = priv->window->size ().width () + output.right;
501- y2 = -geom.border ();
502+ int x1 = -output.left - geom.border ();
503+ int y1 = -output.top - geom.border ();
504+ int x2 = priv->window->size ().width () + output.right;
505+ int y2 = -geom.border ();
506
507 if (x1 < x2 && y1 < y2)
508 addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1));
509@@ -369,10 +355,8 @@
510
511 if (!damageRect (false, rect))
512 {
513- int x, y;
514-
515- x = rect.x ();
516- y = rect.y ();
517+ int x = rect.x ();
518+ int y = rect.y ();
519
520 const CompWindow::Geometry &geom = priv->window->geometry ();
521 x += geom.x () + geom.border ();
522@@ -393,7 +377,7 @@
523 if (priv->window->shaded () || force ||
524 (priv->window->isViewable ()))
525 {
526- int border = priv->window->serverGeometry ().border ();
527+ int border = priv->window->serverGeometry ().border ();
528
529 int x1 = -MAX (priv->window->output ().left,
530 priv->window->input ().left) - border;
531@@ -437,10 +421,8 @@
532 priv->nDamage++;
533 }
534 else
535- {
536- priv->handleDamageRect (this, de->area.x, de->area.y,
537+ priv->handleDamageRect (this, de->area.x, de->area.y,
538 de->area.width, de->area.height);
539- }
540 }
541
542 void
543@@ -453,12 +435,10 @@
544 if (!w->priv->redirected)
545 return;
546
547- bool initial = false;
548+ bool initial = false;
549
550 if (!w->priv->damaged)
551- {
552 w->priv->damaged = initial = true;
553- }
554
555 if (!w->damageRect (initial, CompRect (x, y, width, height)))
556 {
557@@ -467,7 +447,8 @@
558 x += geom.x () + geom.border ();
559 y += geom.y () + geom.border ();
560
561- w->priv->cScreen->damageRegion (CompRegion (CompRect (x, y, width, height)));
562+ w->priv->cScreen->damageRegion (CompRegion (CompRect
563+ (x, y, width, height)));
564 }
565
566 if (initial)
567@@ -480,8 +461,9 @@
568 if (priv->window->type () & CompWindowTypeDesktopMask)
569 return;
570
571- unsigned short opacity = screen->getWindowProp32 (priv->window->id (),
572- Atoms::winOpacity, OPAQUE);
573+ unsigned short opacity =
574+ screen->getWindowProp32 (priv->window->id (),
575+ Atoms::winOpacity, OPAQUE);
576
577 if (opacity != priv->opacity)
578 {
579@@ -493,10 +475,9 @@
580 void
581 CompositeWindow::updateBrightness ()
582 {
583- unsigned short brightness;
584-
585- brightness = screen->getWindowProp32 (priv->window->id (),
586- Atoms::winBrightness, BRIGHT);
587+ unsigned short brightness =
588+ screen->getWindowProp32 (priv->window->id (),
589+ Atoms::winBrightness, BRIGHT);
590
591 if (brightness != priv->brightness)
592 {
593@@ -508,10 +489,9 @@
594 void
595 CompositeWindow::updateSaturation ()
596 {
597- unsigned short saturation;
598-
599- saturation = screen->getWindowProp32 (priv->window->id (),
600- Atoms::winSaturation, COLOR);
601+ unsigned short saturation =
602+ screen->getWindowProp32 (priv->window->id (),
603+ Atoms::winSaturation, COLOR);
604
605 if (saturation != priv->saturation)
606 {
607@@ -555,6 +535,7 @@
608 allowFurtherRebindAttempts ();
609 damaged = false;
610 break;
611+
612 case CompWindowNotifyUnmap:
613 cWindow->addDamage (true);
614 cWindow->release ();
615@@ -562,24 +543,26 @@
616 if (!redirected && cScreen->compositingActive ())
617 cWindow->redirect ();
618 break;
619+
620 case CompWindowNotifyRestack:
621 case CompWindowNotifyHide:
622 case CompWindowNotifyShow:
623 case CompWindowNotifyAliveChanged:
624 cWindow->addDamage (true);
625 break;
626+
627 case CompWindowNotifyReparent:
628 case CompWindowNotifyUnreparent:
629 if (redirected)
630- {
631 cWindow->release ();
632- }
633 cScreen->damageScreen ();
634 cWindow->addDamage (true);
635 break;
636+
637 case CompWindowNotifyFrameUpdate:
638 cWindow->release ();
639 break;
640+
641 case CompWindowNotifySyncAlarm:
642 {
643 XRectangle *rects;
644@@ -595,6 +578,7 @@
645 }
646 break;
647 }
648+
649 default:
650 break;
651 }
652@@ -609,17 +593,15 @@
653
654 if (window->shaded () || (window->isViewable ()))
655 {
656- int x, y, x1, x2, y1, y2;
657-
658- x = window->geometry ().x ();
659- y = window->geometry ().y ();
660-
661- x1 = x - window->output ().left - dx;
662- y1 = y - window->output ().top - dy;
663- x2 = x + window->size ().width () +
664- window->output ().right - dx - dwidth;
665- y2 = y + window->size ().height () +
666- window->output ().bottom - dy - dheight;
667+ int x = window->geometry ().x ();
668+ int y = window->geometry ().y ();
669+
670+ int x1 = x - window->output ().left - dx;
671+ int y1 = y - window->output ().top - dy;
672+ int x2 = x + window->size ().width () +
673+ window->output ().right - dx - dwidth;
674+ int y2 = y + window->size ().height () +
675+ window->output ().bottom - dy - dheight;
676
677 cScreen->damageRegion (CompRegion (CompRect (x1, y1, x2 - x1, y2 - y1)));
678 }
679@@ -633,20 +615,19 @@
680 {
681 if (window->shaded () || (window->isViewable ()))
682 {
683- int x, y, x1, x2, y1, y2;
684-
685- x = window->geometry ().x ();
686- y = window->geometry ().y ();
687-
688- x1 = x - window->output ().left - dx;
689- y1 = y - window->output ().top - dy;
690- x2 = x + window->geometry ().width () +
691- window->output ().right - dx;
692- y2 = y + window->geometry ().height () +
693- window->output ().bottom - dy;
694+ int x = window->geometry ().x ();
695+ int y = window->geometry ().y ();
696+
697+ int x1 = x - window->output ().left - dx;
698+ int y1 = y - window->output ().top - dy;
699+ int x2 = x + window->geometry ().width () +
700+ window->output ().right - dx;
701+ int y2 = y + window->geometry ().height () +
702+ window->output ().bottom - dy;
703
704 cScreen->damageRegion (CompRegion (CompRect (x1, y1, x2 - x1, y2 - y1)));
705 }
706+
707 cWindow->addDamage ();
708
709 window->moveNotify (dx, dy, now);

Subscribers

People subscribed via source and target branches

to all changes: