Merge lp:~3v1n0/compiz/static-compregion-memory-curruption-fix into lp:compiz/0.9.13

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4140
Proposed branch: lp:~3v1n0/compiz/static-compregion-memory-curruption-fix
Merge into: lp:compiz/0.9.13
Diff against target: 592 lines (+61/-59)
30 files modified
include/core/abiversion.h (+1/-1)
plugins/animationaddon/src/beamup.cpp (+1/-1)
plugins/animationaddon/src/burn.cpp (+1/-1)
plugins/animationaddon/src/particle.cpp (+1/-1)
plugins/animationplus/src/bonanza.cpp (+2/-2)
plugins/blur/src/blur.cpp (+5/-5)
plugins/compiztoolbox/src/compiztoolbox.cpp (+2/-2)
plugins/composite/src/backbuffertracking/tests/test-composite-backbuffertracking.cpp (+5/-5)
plugins/decor/src/clip-groups/src/clip-groups.cpp (+2/-2)
plugins/decor/src/decor.cpp (+1/-1)
plugins/expo/src/expo.cpp (+1/-1)
plugins/group/src/paint.cpp (+1/-1)
plugins/group/src/selection.cpp (+1/-1)
plugins/group/src/tab.cpp (+1/-1)
plugins/imgsvg/src/imgsvg.cpp (+1/-1)
plugins/kdecompat/src/kdecompat.cpp (+2/-2)
plugins/opacify/src/opacify.cpp (+1/-1)
plugins/opengl/src/paint.cpp (+1/-1)
plugins/resize/src/logic/src/resize-logic.cpp (+1/-1)
plugins/ring/src/ring.cpp (+1/-1)
plugins/shift/src/shift.cpp (+3/-3)
plugins/stackswitch/src/stackswitch.cpp (+2/-2)
plugins/staticswitcher/src/staticswitcher.cpp (+1/-1)
plugins/switcher/src/switcher.cpp (+1/-1)
plugins/td/src/3d.cpp (+1/-1)
plugins/thumbnail/src/thumbnail.cpp (+1/-1)
plugins/wallpaper/src/wallpaper.cpp (+1/-1)
src/region/include/core/region.h (+3/-3)
src/region/src/region.cpp (+14/-12)
src/window.cpp (+2/-2)
To merge this branch: bzr merge lp:~3v1n0/compiz/static-compregion-memory-curruption-fix
Reviewer Review Type Date Requested Status
Andrea Azzarone Approve
Review via email: mp+338342@code.launchpad.net

Commit message

Region: define static const functions returning infinite and empty regions

As per https://gcc.gnu.org/ml/gcc-help/2010-10/msg00255.html we can't define some
static variables as extern and link them statically inside objects.
Otherwise these might be redefined multiple times, allocated mutiple times and
destroyed, again, multiple times causing memory errors.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
4139. By Marco Trevisan (Treviño)

Region: define static const functions returning infinite and empty regions

See https://gcc.gnu.org/ml/gcc-help/2010-10/msg00255.html

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/core/abiversion.h'
2--- include/core/abiversion.h 2017-06-29 17:19:00 +0000
3+++ include/core/abiversion.h 2018-02-21 17:31:01 +0000
4@@ -5,6 +5,6 @@
5 # error Conflicting definitions of CORE_ABIVERSION
6 #endif
7
8-#define CORE_ABIVERSION 20170630
9+#define CORE_ABIVERSION 20180221
10
11 #endif // COMPIZ_ABIVERSION_H
12
13=== modified file 'plugins/animationaddon/src/beamup.cpp'
14--- plugins/animationaddon/src/beamup.cpp 2013-02-27 11:33:10 +0000
15+++ plugins/animationaddon/src/beamup.cpp 2018-02-21 17:31:01 +0000
16@@ -181,7 +181,7 @@
17 }
18 else
19 {
20- mDrawRegion = emptyRegion;
21+ mDrawRegion = CompRegion::empty ();
22 }
23
24 mUseDrawRegion = (fabs (newProgress) > 1e-5);
25
26=== modified file 'plugins/animationaddon/src/burn.cpp'
27--- plugins/animationaddon/src/burn.cpp 2013-02-27 11:33:10 +0000
28+++ plugins/animationaddon/src/burn.cpp 2018-02-21 17:31:01 +0000
29@@ -326,7 +326,7 @@
30 }
31 else
32 {
33- mDrawRegion = emptyRegion;
34+ mDrawRegion = CompRegion::empty ();
35 }
36 mUseDrawRegion = (fabs (newProgress) > 1e-5);
37
38
39=== modified file 'plugins/animationaddon/src/particle.cpp'
40--- plugins/animationaddon/src/particle.cpp 2016-07-09 19:36:23 +0000
41+++ plugins/animationaddon/src/particle.cpp 2018-02-21 17:31:01 +0000
42@@ -297,7 +297,7 @@
43 }
44 }
45
46- if (mUseDrawRegion && mDrawRegion != emptyRegion)
47+ if (mUseDrawRegion && mDrawRegion != CompRegion::empty ())
48 // expand BB with bounding box of draw region
49 mAWindow->expandBBWithBox (mDrawRegion.handle ()->extents);
50 else // drawing full window
51
52=== modified file 'plugins/animationplus/src/bonanza.cpp'
53--- plugins/animationplus/src/bonanza.cpp 2016-05-24 01:54:30 +0000
54+++ plugins/animationplus/src/bonanza.cpp 2018-02-21 17:31:01 +0000
55@@ -208,12 +208,12 @@
56 }
57
58 Region pointsRegion = XPolygonRegion (&pts[0], 20, WindingRule);;
59- mDrawRegion = CompRegionRef(pointsRegion) - emptyRegion.united (rect);
60+ mDrawRegion = CompRegionRef(pointsRegion) - CompRegion::empty ().united (rect);
61 XDestroyRegion (pointsRegion);
62 }
63 else
64 {
65- mDrawRegion = emptyRegion;
66+ mDrawRegion = CompRegion::empty ();
67 }
68
69
70
71=== modified file 'plugins/blur/src/blur.cpp'
72--- plugins/blur/src/blur.cpp 2016-05-13 07:57:01 +0000
73+++ plugins/blur/src/blur.cpp 2018-02-21 17:31:01 +0000
74@@ -449,7 +449,7 @@
75 * and then use the real damage in order to determine what blur regions
76 * should be updated
77 */
78- backbufferUpdateRegionThisFrame &= emptyRegion;
79+ backbufferUpdateRegionThisFrame &= CompRegion::empty ();
80 CompRegion frameAgeDamage = damageQuery->damageForFrameAge (cScreen->getFrameAge ());
81 foreach (CompWindow *w, screen->windows ())
82 {
83@@ -466,7 +466,7 @@
84 continue;
85
86 if (!bw->projectedBlurRegion.isEmpty ())
87- bw->projectedBlurRegion &= emptyRegion;
88+ bw->projectedBlurRegion &= CompRegion::empty ();
89
90 GLMatrix screenSpace;
91 screenSpace.toScreenSpace (this->output, -DEFAULT_Z_CAMERA);
92@@ -561,7 +561,7 @@
93 clientThreshold = 0;
94
95 if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
96- reg = &infiniteRegion;
97+ reg = &CompRegion::infinite ();
98 else
99 reg = &region;
100
101@@ -1218,7 +1218,7 @@
102 GLTexture::MatrixList ml;
103
104 gWindow->vertexBuffer ()->begin ();
105- gWindow->glAddGeometry (ml, bScreen->tmpRegion2, infiniteRegion);
106+ gWindow->glAddGeometry (ml, bScreen->tmpRegion2, CompRegion::infinite ());
107
108 if (!gWindow->vertexBuffer ()->end ())
109 return;
110@@ -1627,7 +1627,7 @@
111 const CompRegion *reg = NULL;
112
113 if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
114- reg = &infiniteRegion;
115+ reg = &CompRegion::infinite ();
116 else
117 reg = &region;
118
119
120=== modified file 'plugins/compiztoolbox/src/compiztoolbox.cpp'
121--- plugins/compiztoolbox/src/compiztoolbox.cpp 2015-08-22 21:46:01 +0000
122+++ plugins/compiztoolbox/src/compiztoolbox.cpp 2018-02-21 17:31:01 +0000
123@@ -504,7 +504,7 @@
124 very ugly but necessary until the vertex stage has been made
125 fully pluggable. */
126 gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
127- gWindow->glDraw (wTransform, sAttrib, infiniteRegion, mask);
128+ gWindow->glDraw (wTransform, sAttrib, CompRegion::infinite (), mask);
129 gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex);
130
131 gScreen->setTextureFilter (filter);
132@@ -552,7 +552,7 @@
133 gWindow->vertexBuffer ()->begin ();
134
135 gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
136- gWindow->glAddGeometry (matrix, iconReg, infiniteRegion);
137+ gWindow->glAddGeometry (matrix, iconReg, CompRegion::infinite ());
138 gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex);
139
140 if (gWindow->vertexBuffer ()->end ())
141
142=== modified file 'plugins/composite/src/backbuffertracking/tests/test-composite-backbuffertracking.cpp'
143--- plugins/composite/src/backbuffertracking/tests/test-composite-backbuffertracking.cpp 2013-05-12 05:49:43 +0000
144+++ plugins/composite/src/backbuffertracking/tests/test-composite-backbuffertracking.cpp 2018-02-21 17:31:01 +0000
145@@ -181,7 +181,7 @@
146 allowDamage (false);
147 CompRegion damage (100, 100, 100, 100);
148 roster->dirtyAreaOnCurrentFrame (damage);
149- EXPECT_EQ (emptyRegion, roster->currentFrameDamage ());
150+ EXPECT_EQ (CompRegion::empty (), roster->currentFrameDamage ());
151 }
152
153 TEST_F (BackbufferTracking, DirtyAreaSubtraction)
154@@ -210,7 +210,7 @@
155 CompRegion all (0, 0, screen.width (), screen.height ());
156 roster->dirtyAreaOnCurrentFrame (all);
157 roster->incrementFrameAges ();
158- EXPECT_EQ (emptyRegion, roster->damageForFrameAge (1));
159+ EXPECT_EQ (CompRegion::empty (), roster->damageForFrameAge (1));
160 }
161
162 TEST_F (BackbufferTracking, DirtyAreaIfMoreSinceLastFrame)
163@@ -429,21 +429,21 @@
164 {
165 EXPECT_CALL (mockDamageAgeTracker, dirtyAreaOnCurrentFrame (_)).Times (0);
166 ageing.unobserve (mockDamageAgeTracker);
167- ageing.markAreaDirty (emptyRegion);
168+ ageing.markAreaDirty (CompRegion::empty ());
169 }
170
171 TEST_F (AgeingDamageBuffers, SubtractObscuredAreaOnInvalidRosters)
172 {
173 EXPECT_CALL (mockDamageAgeTracker, subtractObscuredArea (_)).Times (0);
174 ageing.unobserve (mockDamageAgeTracker);
175- ageing.subtractObscuredArea (emptyRegion);
176+ ageing.subtractObscuredArea (CompRegion::empty ());
177 }
178
179 TEST_F (AgeingDamageBuffers, AddOverdrawAreaOnInvalidRosters)
180 {
181 EXPECT_CALL (mockDamageAgeTracker, overdrawRegionOnPaintingFrame (_)).Times (0);
182 ageing.unobserve (mockDamageAgeTracker);
183- ageing.markAreaDirtyOnLastFrame (emptyRegion);
184+ ageing.markAreaDirtyOnLastFrame (CompRegion::empty ());
185 }
186
187
188
189=== modified file 'plugins/decor/src/clip-groups/src/clip-groups.cpp'
190--- plugins/decor/src/clip-groups/src/clip-groups.cpp 2012-03-30 14:29:18 +0000
191+++ plugins/decor/src/clip-groups/src/clip-groups.cpp 2018-02-21 17:31:01 +0000
192@@ -41,7 +41,7 @@
193 if (it != mClippables.end ())
194 {
195 dc->setOwner (NULL);
196- dc->updateShadow (emptyRegion);
197+ dc->updateShadow (CompRegion::empty ());
198 mClippables.erase (it);
199 regenerateClipRegion ();
200
201@@ -54,7 +54,7 @@
202 void
203 GenericDecorClipGroup::doRegenerateClipRegion ()
204 {
205- mRegion -= infiniteRegion;
206+ mRegion -= CompRegion::infinite ();
207
208 foreach (DecorClippableInterface *clippable, mClippables)
209 {
210
211=== modified file 'plugins/decor/src/decor.cpp'
212--- plugins/decor/src/decor.cpp 2015-09-01 08:50:37 +0000
213+++ plugins/decor/src/decor.cpp 2018-02-21 17:31:01 +0000
214@@ -253,7 +253,7 @@
215 PAINT_WINDOW_WITH_OFFSET_MASK)))
216 preg = &region;
217 else if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
218- preg = &infiniteRegion;
219+ preg = &CompRegion::infinite ();
220 else if (mClipGroup)
221 {
222 tmpRegion = mOutputRegion;
223
224=== modified file 'plugins/expo/src/expo.cpp'
225--- plugins/expo/src/expo.cpp 2016-08-18 09:39:05 +0000
226+++ plugins/expo/src/expo.cpp 2018-02-21 17:31:01 +0000
227@@ -1336,7 +1336,7 @@
228 /* reset geometry and paint */
229 gWindow->vertexBuffer ()->begin ();
230 gWindow->vertexBuffer ()->end ();
231- paintGlow (transform, attrib, infiniteRegion, mask);
232+ paintGlow (transform, attrib, CompRegion::infinite (), mask);
233 }
234
235 return status;
236
237=== modified file 'plugins/group/src/paint.cpp'
238--- plugins/group/src/paint.cpp 2012-07-30 09:53:16 +0000
239+++ plugins/group/src/paint.cpp 2018-02-21 17:31:01 +0000
240@@ -829,7 +829,7 @@
241 if (mGroup && (mGroup->mWindows.size () > 1) && mGlowQuads)
242 {
243 if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
244- paintRegion = CompRegion (infiniteRegion);
245+ paintRegion = CompRegion (CompRegion::infinite ());
246
247 if (paintRegion.numRects ())
248 {
249
250=== modified file 'plugins/group/src/selection.cpp'
251--- plugins/group/src/selection.cpp 2012-12-04 15:34:01 +0000
252+++ plugins/group/src/selection.cpp 2018-02-21 17:31:01 +0000
253@@ -249,7 +249,7 @@
254 MIN (mY1, mY2) + 4;
255
256 rect = CompRect (x, y, width, height);
257- reg = emptyRegion.united (rect);
258+ reg = CompRegion::empty ().united (rect);
259
260 gs->cScreen->damageRegion (reg);
261
262
263=== modified file 'plugins/group/src/tab.cpp'
264--- plugins/group/src/tab.cpp 2013-03-26 22:02:39 +0000
265+++ plugins/group/src/tab.cpp 2018-02-21 17:31:01 +0000
266@@ -2015,7 +2015,7 @@
267 space = optionGetThumbSpace ();
268 thumbSize = optionGetThumbSize ();
269
270- slot->mRegion = emptyRegion;
271+ slot->mRegion = CompRegion::empty ();
272
273 /* Padding between slots, account for this */
274 box.setX (space + ((thumbSize + space) * slotPos));
275
276=== modified file 'plugins/imgsvg/src/imgsvg.cpp'
277--- plugins/imgsvg/src/imgsvg.cpp 2013-05-16 11:55:17 +0000
278+++ plugins/imgsvg/src/imgsvg.cpp 2018-02-21 17:31:01 +0000
279@@ -230,7 +230,7 @@
280 return status;
281
282 const CompRegion &reg = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
283- infiniteRegion : region;
284+ CompRegion::infinite () : region;
285
286 if (context && reg.numRects ())
287 {
288
289=== modified file 'plugins/kdecompat/src/kdecompat.cpp'
290--- plugins/kdecompat/src/kdecompat.cpp 2013-05-15 10:23:30 +0000
291+++ plugins/kdecompat/src/kdecompat.cpp 2018-02-21 17:31:01 +0000
292@@ -323,7 +323,7 @@
293 matrices[0].y0 -= (tw->y () * icon->matrix ().yy);
294
295 gtw->vertexBuffer ()->begin ();
296- gtw->glAddGeometry (matrices, tw->geometry (), infiniteRegion);
297+ gtw->glAddGeometry (matrices, tw->geometry (), CompRegion::infinite ());
298 gtw->vertexBuffer ()->end ();
299 }
300 }
301@@ -343,7 +343,7 @@
302
303 if (!gtw->textures ().empty ())
304 gtw->glDraw (wTransform, attrib,
305- infiniteRegion, paintMask);
306+ CompRegion::infinite (), paintMask);
307 else if (icon)
308 gtw->glDrawTexture (icon, wTransform, attrib, paintMask);
309 }
310
311=== modified file 'plugins/opacify/src/opacify.cpp'
312--- plugins/opacify/src/opacify.cpp 2013-12-03 11:12:32 +0000
313+++ plugins/opacify/src/opacify.cpp 2018-02-21 17:31:01 +0000
314@@ -407,7 +407,7 @@
315 isToggle (optionGetInitToggle ()),
316 newActive (NULL),
317 active (screen->activeWindow ()),
318- intersect (emptyRegion),
319+ intersect (CompRegion::empty ()),
320 justMoved (false)
321 {
322 ScreenInterface::setHandler (screen, false);
323
324=== modified file 'plugins/opengl/src/paint.cpp'
325--- plugins/opengl/src/paint.cpp 2016-07-09 20:10:40 +0000
326+++ plugins/opengl/src/paint.cpp 2018-02-21 17:31:01 +0000
327@@ -1315,7 +1315,7 @@
328 attrib, region, mask)
329
330 const CompRegion &reg = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
331- infiniteRegion : region;
332+ CompRegion::infinite () : region;
333
334 if (reg.isEmpty ())
335 return true;
336
337=== modified file 'plugins/resize/src/logic/src/resize-logic.cpp'
338--- plugins/resize/src/logic/src/resize-logic.cpp 2017-06-29 01:36:32 +0000
339+++ plugins/resize/src/logic/src/resize-logic.cpp 2018-02-21 17:31:01 +0000
340@@ -1440,7 +1440,7 @@
341 lastGoodSize = w->serverSize ();
342
343 /* Combine the work areas of all outputs */
344- constraintRegion = emptyRegion;
345+ constraintRegion = CompRegion::empty ();
346 foreach (CompOutput &output, mScreen->outputDevs ())
347 constraintRegion += output.workArea ();
348 }
349
350=== modified file 'plugins/ring/src/ring.cpp'
351--- plugins/ring/src/ring.cpp 2013-05-15 10:23:30 +0000
352+++ plugins/ring/src/ring.cpp 2018-02-21 17:31:01 +0000
353@@ -768,7 +768,7 @@
354 RING_WINDOW (w);
355
356 status |= rw->gWindow->glPaint (rw->gWindow->paintAttrib (),
357- sTransform, infiniteRegion, 0);
358+ sTransform, CompRegion::infinite (), 0);
359 }
360
361 if (mState != RingStateIn)
362
363=== modified file 'plugins/shift/src/shift.cpp'
364--- plugins/shift/src/shift.cpp 2015-10-20 15:12:34 +0000
365+++ plugins/shift/src/shift.cpp 2018-02-21 17:31:01 +0000
366@@ -1155,7 +1155,7 @@
367 mActiveSlot = &mDrawSlots[i];
368 {
369 sw->gWindow->glPaint (sw->gWindow->paintAttrib (), rTransform,
370- infiniteRegion, 0);
371+ CompRegion::infinite (), 0);
372 }
373 }
374
375@@ -1248,7 +1248,7 @@
376 mActiveSlot = &mDrawSlots[i];
377 {
378 sw->gWindow->glPaint (sw->gWindow->paintAttrib (), sTransform,
379- infiniteRegion, 0);
380+ CompRegion::infinite (), 0);
381 }
382 }
383
384@@ -1288,7 +1288,7 @@
385 SHIFT_WINDOW (w);
386
387 sw->gWindow->glPaint (sw->gWindow->paintAttrib (), sTransform,
388- infiniteRegion, 0);
389+ CompRegion::infinite (), 0);
390 }
391
392 mPaintingAbove = false;
393
394=== modified file 'plugins/stackswitch/src/stackswitch.cpp'
395--- plugins/stackswitch/src/stackswitch.cpp 2013-05-11 09:30:49 +0000
396+++ plugins/stackswitch/src/stackswitch.cpp 2018-02-21 17:31:01 +0000
397@@ -380,7 +380,7 @@
398 matl.push_back (matrix);
399
400 gWindow->geometry ().reset ();
401- gWindow->glAddGeometry (matl, iconReg, infiniteRegion);
402+ gWindow->glAddGeometry (matl, iconReg, CompRegion::infinite ());
403
404 if (gWindow->geometry ().vCount)
405 {
406@@ -888,7 +888,7 @@
407
408 STACKSWITCH_WINDOW (w);
409
410- sw->gWindow->glPaint (sw->gWindow->paintAttrib (), sTransform, infiniteRegion, 0);
411+ sw->gWindow->glPaint (sw->gWindow->paintAttrib (), sTransform, CompRegion::infinite (), 0);
412 }
413 }
414
415
416=== modified file 'plugins/staticswitcher/src/staticswitcher.cpp'
417--- plugins/staticswitcher/src/staticswitcher.cpp 2015-08-22 21:46:01 +0000
418+++ plugins/staticswitcher/src/staticswitcher.cpp 2018-02-21 17:31:01 +0000
419@@ -965,7 +965,7 @@
420 sw->cWindow->damaged ())
421 {
422 sw->gWindow->glPaint (sw->gWindow->paintAttrib (),
423- sTransform, infiniteRegion, 0);
424+ sTransform, CompRegion::infinite (), 0);
425 }
426 }
427 }
428
429=== modified file 'plugins/switcher/src/switcher.cpp'
430--- plugins/switcher/src/switcher.cpp 2016-07-20 09:50:17 +0000
431+++ plugins/switcher/src/switcher.cpp 2018-02-21 17:31:01 +0000
432@@ -790,7 +790,7 @@
433 sw->cWindow->damaged ())
434 {
435 sw->gWindow->glPaint (sw->gWindow->paintAttrib (),
436- sTransform, infiniteRegion, 0);
437+ sTransform, CompRegion::infinite (), 0);
438 }
439 }
440 }
441
442=== modified file 'plugins/td/src/3d.cpp'
443--- plugins/td/src/3d.cpp 2015-08-05 05:57:15 +0000
444+++ plugins/td/src/3d.cpp 2018-02-21 17:31:01 +0000
445@@ -458,7 +458,7 @@
446
447 GL::shaders = false;
448 tdw->gWindow->glPaint (tdw->gWindow->paintAttrib (), mTransform,
449- infiniteRegion, newMask);
450+ CompRegion::infinite (), newMask);
451 GL::shaders = true;
452
453 gScreen->glDisableOutputClipping ();
454
455=== modified file 'plugins/thumbnail/src/thumbnail.cpp'
456--- plugins/thumbnail/src/thumbnail.cpp 2013-06-28 14:23:21 +0000
457+++ plugins/thumbnail/src/thumbnail.cpp 2018-02-21 17:31:01 +0000
458@@ -908,7 +908,7 @@
459 very ugly but necessary until the vertex stage has been made
460 fully pluggable. */
461 gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
462- gWindow->glDraw (wTransform, sAttrib, infiniteRegion, mask);
463+ gWindow->glDraw (wTransform, sAttrib, CompRegion::infinite (), mask);
464
465 gScreen->setTextureFilter (filter);
466 }
467
468=== modified file 'plugins/wallpaper/src/wallpaper.cpp'
469--- plugins/wallpaper/src/wallpaper.cpp 2013-05-15 22:15:41 +0000
470+++ plugins/wallpaper/src/wallpaper.cpp 2018-02-21 17:31:01 +0000
471@@ -450,7 +450,7 @@
472
473 gWindow->glAddGeometry (tmpMatrixList, screen->region (),
474 (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
475- infiniteRegion : region);
476+ CompRegion::infinite () : region);
477
478 if (ws->optionGetCycleWallpapers ())
479 tmpAttrib.opacity *= fadingIn ? (1.0f - ws->alpha) : ws->alpha;
480
481=== modified file 'src/region/include/core/region.h'
482--- src/region/include/core/region.h 2012-10-17 06:22:10 +0000
483+++ src/region/include/core/region.h 2018-02-21 17:31:01 +0000
484@@ -52,6 +52,9 @@
485 CompRegion (const CompRect &);
486 ~CompRegion ();
487
488+ static const CompRegion &infinite();
489+ static const CompRegion &empty();
490+
491 /**
492 * Returns a CompRect which encapsulates a given CompRegion
493 */
494@@ -193,7 +196,4 @@
495 ~CompRegionRef ();
496 };
497
498-extern const CompRegion infiniteRegion;
499-extern const CompRegion emptyRegion;
500-
501 #endif
502
503=== modified file 'src/region/src/region.cpp'
504--- src/region/src/region.cpp 2012-10-16 07:00:03 +0000
505+++ src/region/src/region.cpp 2018-02-21 17:31:01 +0000
506@@ -38,19 +38,21 @@
507
508 template class std::vector<CompRegion>;
509
510-const CompRegion infiniteRegion (CompRect (MINSHORT, MINSHORT,
511- MAXSHORT * 2, MAXSHORT * 2));
512-const CompRegion emptyRegion;
513-
514-/* Alternate emptyRegion, mostly just required to construct infiniteRegion
515- when emptyRegion may still be uninitialized */
516-static const CompRegion &
517-_emptyRegion ()
518+const CompRegion &
519+CompRegion::empty ()
520 {
521 static const CompRegion r;
522 return r;
523 }
524
525+const CompRegion &
526+CompRegion::infinite ()
527+{
528+ static const CompRegion r(CompRect (MINSHORT, MINSHORT,
529+ MAXSHORT * 2, MAXSHORT * 2));
530+ return r;
531+}
532+
533 CompRegion::CompRegion ()
534 {
535 init ();
536@@ -59,7 +61,7 @@
537 CompRegion::CompRegion (const CompRegion &c)
538 {
539 init ();
540- XUnionRegion (_emptyRegion ().handle (), c.handle (), handle ());
541+ XUnionRegion (empty ().handle (), c.handle (), handle ());
542 }
543
544 CompRegion::CompRegion ( int x, int y, int w, int h)
545@@ -73,7 +75,7 @@
546 rect.width = w;
547 rect.height = h;
548
549- XUnionRectWithRegion (&rect, _emptyRegion ().handle (), handle ());
550+ XUnionRectWithRegion (&rect, empty ().handle (), handle ());
551 }
552
553 CompRegion::CompRegion (const CompRect &r)
554@@ -87,7 +89,7 @@
555 rect.width = r.width ();
556 rect.height = r.height ();
557
558- XUnionRectWithRegion (&rect, _emptyRegion ().handle (), handle ());
559+ XUnionRectWithRegion (&rect, empty ().handle (), handle ());
560 }
561
562 CompRegion::CompRegion (Region external)
563@@ -129,7 +131,7 @@
564 CompRegion &
565 CompRegion::operator= (const CompRegion &c)
566 {
567- XUnionRegion (emptyRegion.handle (), c.handle (), handle ());
568+ XUnionRegion (empty ().handle (), c.handle (), handle ());
569 return *this;
570 }
571
572
573=== modified file 'src/window.cpp'
574--- src/window.cpp 2017-04-20 07:41:24 +0000
575+++ src/window.cpp 2018-02-21 17:31:01 +0000
576@@ -950,7 +950,7 @@
577 const CompWindow::Geometry &geom = attrib.override_redirect ?
578 priv->geometry : priv->serverGeometry;
579
580- priv->region = priv->inputRegion = emptyRegion;
581+ priv->region = priv->inputRegion = CompRegion::empty ();
582
583 r.x = -geom.border ();
584 r.y = -geom.border ();
585@@ -6658,7 +6658,7 @@
586 {
587 if (priv->serverFrame)
588 {
589- priv->frameRegion = emptyRegion;
590+ priv->frameRegion = CompRegion::empty ();
591
592 updateFrameRegion (priv->frameRegion);
593

Subscribers

People subscribed via source and target branches