Merge lp:~compiz-team/compiz/compiz.fix_1159430 into lp:compiz/0.9.10

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1159430
Merge into: lp:compiz/0.9.10
Diff against target: 398 lines (+173/-25)
11 files modified
debian/changelog (+2/-1)
include/core/abiversion.h (+1/-1)
include/core/screen.h (+11/-3)
plugins/opengl/src/paint.cpp (+6/-1)
plugins/wallpaper/src/wallpaper.cpp (+29/-2)
plugins/wallpaper/src/wallpaper.h (+4/-0)
src/event.cpp (+7/-2)
src/privatescreen.h (+6/-3)
src/privatescreen/tests/test-privatescreen.cpp (+67/-2)
src/screen.cpp (+20/-7)
src/window.cpp (+20/-3)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1159430
Reviewer Review Type Date Requested Status
MC Return Pending
Daniel van Vugt Pending
PS Jenkins bot continuous-integration Pending
Sebastien Bacher Pending
Review via email: mp+176799@code.launchpad.net

This proposal supersedes a proposal from 2013-06-21.

Description of the change

Handle ARGB desktop windows correctly.

core: compiz::private_screen::DesktopWindowCount - provide methods to
increment or decrement desktop windows based on their visual type.

desktopWindowCount () now returns the number of RGB and ARGB desktop windows,
argbDesktopWindowCount () just returns the number of ARGB desktop windows.

If they are equal, the only desktop window is ARGB.

opengl: Draw the root window background if the desktop window is ARGB.
wallpaper: Lie to core and say that our fake desktop window is RGB so that
core does not draw the root window background. Paint the desktop wallpaper
beneath the desktop window so that the ARGB desktop window is visible on
top of it.

Tests added for the increment/decrement logic in DesktopWindowCount.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

I am sorry, I cannot test this...

(still on Raring, using a patched Nautilus 3.4 as Nautilus is getting worse and worse with each version)

review: Abstain
Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

Can anyone help with testing this on Saucy ?

Revision history for this message
Alberts Muktupāvels (muktupavels) wrote : Posted in a previous version of this proposal

> Can anyone help with testing this on Saucy ?
How to test?

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Please re-target to lp:compiz

review: Needs Resubmitting

Unmerged revisions

3744. By Sam Spilsbury

Added more missing changes

3743. By Sam Spilsbury

Add missing change

3742. By Sam Spilsbury

Handle ARGB desktop windows correctly.

core: compiz::private_screen::DesktopWindowCount - provide methods to
increment or decrement desktop windows based on their visual type.

desktopWindowCount () now returns the number of RGB and ARGB desktop windows,
argbDesktopWindowCount () just returns the number of ARGB desktop windows.

If they are equal, the only desktop window is ARGB.

opengl: Draw the root window background if the desktop window is ARGB.
wallpaper: Lie to core and say that our fake desktop window is RGB so that
core does not draw the root window background. Paint the desktop wallpaper
beneath the desktop window so that the ARGB desktop window is visible on
top of it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-06-01 00:10:24 +0000
3+++ debian/changelog 2013-07-24 21:57:49 +0000
4@@ -1,8 +1,9 @@
5 compiz (1:0.9.10-0ubuntu1) UNRELEASED; urgency=low
6
7 * Bump version to 0.9.10
8+ - Bump ABI to 20130621
9
10- -- Sam Spilsbury <smspillaz@interpol> Thu, 25 Apr 2013 11:13:32 +0800
11+ -- Sam Spilsbury <smspillaz@gmail.com> Thu, 25 Apr 2013 11:13:32 +0800
12
13 compiz (1:0.9.9~daily13.02.28-0ubuntu1) raring; urgency=low
14
15
16=== modified file 'include/core/abiversion.h'
17--- include/core/abiversion.h 2013-04-17 06:58:36 +0000
18+++ include/core/abiversion.h 2013-07-24 21:57:49 +0000
19@@ -5,6 +5,6 @@
20 # error Conflicting definitions of CORE_ABIVERSION
21 #endif
22
23-#define CORE_ABIVERSION 20130415
24+#define CORE_ABIVERSION 20130621
25
26 #endif // COMPIZ_ABIVERSION_H
27
28=== modified file 'include/core/screen.h'
29--- include/core/screen.h 2012-12-03 10:36:42 +0000
30+++ include/core/screen.h 2013-07-24 21:57:49 +0000
31@@ -167,9 +167,17 @@
32 class DesktopWindowCount
33 {
34 public:
35- virtual void incrementDesktopWindowCount() = 0;
36- virtual void decrementDesktopWindowCount() = 0;
37- virtual int desktopWindowCount() = 0;
38+
39+ enum VisualType
40+ {
41+ RGB,
42+ ARGB
43+ };
44+
45+ virtual void incrementDesktopWindowCount (VisualType) = 0;
46+ virtual void decrementDesktopWindowCount (VisualType) = 0;
47+ virtual int desktopWindowCount () = 0;
48+ virtual int argbDesktopWindowCount () = 0;
49 protected:
50 ~DesktopWindowCount() {}
51 };
52
53=== modified file 'plugins/opengl/src/paint.cpp'
54--- plugins/opengl/src/paint.cpp 2013-06-28 01:10:57 +0000
55+++ plugins/opengl/src/paint.cpp 2013-07-24 21:57:49 +0000
56@@ -86,7 +86,12 @@
57 if (!nBox)
58 return;
59
60- if (screen->desktopWindowCount ())
61+ unsigned int rgbDesktops = screen->desktopWindowCount () -
62+ screen->argbDesktopWindowCount ();
63+
64+ /* RGB desktops are assumed to cover the entire background
65+ * so we do not need to paint any background behind them */
66+ if (rgbDesktops > 0)
67 {
68 if (!backgroundTextures.empty ())
69 {
70
71=== modified file 'plugins/wallpaper/src/wallpaper.cpp'
72--- plugins/wallpaper/src/wallpaper.cpp 2013-05-15 22:15:41 +0000
73+++ plugins/wallpaper/src/wallpaper.cpp 2013-07-24 21:57:49 +0000
74@@ -567,8 +567,6 @@
75 {
76 WALLPAPER_SCREEN (screen);
77
78- bool ret = gWindow->glDraw (transform, attrib, region, mask);
79-
80 if ((!ws->desktop || ws->desktop == window) &&
81 !ws->backgroundsPrimary.empty() &&
82 window->type () & CompWindowTypeDesktopMask)
83@@ -597,6 +595,9 @@
84 ws->desktop = window;
85 }
86
87+ /* Draw wallpaper behind window */
88+ bool ret = gWindow->glDraw (transform, attrib, region, mask);
89+
90 return ret;
91 }
92
93@@ -673,14 +674,40 @@
94 destroyFakeDesktopWindow ();
95 }
96
97+bool
98+WallpaperWindow::alpha () const
99+{
100+ return true;
101+}
102+
103 WallpaperWindow::WallpaperWindow (CompWindow *window) :
104 PluginClassHandler <WallpaperWindow, CompWindow> (window),
105 window (window),
106 cWindow (CompositeWindow::get (window)),
107 gWindow (GLWindow::get (window))
108 {
109+ WallpaperScreen *ws = WallpaperScreen::get (screen);
110+
111+ bool isFakeDesktopWindow =
112+ window->id () == ws->fakeDesktop;
113+
114+ /* If we are the fake desktop, tell compiz that we have
115+ * an alpha channel so that we don't get added to the argb
116+ * desktop window count and compiz doesn't draw its own
117+ * background */
118+ WindowInterface::setHandler (window, isFakeDesktopWindow);
119 CompositeWindowInterface::setHandler (cWindow, true);
120 GLWindowInterface::setHandler (gWindow, true);
121+
122+ if (isFakeDesktopWindow)
123+ ws->desktop = window;
124+}
125+
126+WallpaperWindow::~WallpaperWindow ()
127+{
128+ WallpaperScreen *ws = WallpaperScreen::get (screen);
129+ if (ws->desktop == window)
130+ ws->desktop = NULL;
131 }
132
133 bool
134
135=== modified file 'plugins/wallpaper/src/wallpaper.h'
136--- plugins/wallpaper/src/wallpaper.h 2013-05-15 22:15:41 +0000
137+++ plugins/wallpaper/src/wallpaper.h 2013-07-24 21:57:49 +0000
138@@ -124,12 +124,14 @@
139
140 class WallpaperWindow :
141 public PluginClassHandler <WallpaperWindow, CompWindow>,
142+ public WindowInterface,
143 public CompositeWindowInterface,
144 public GLWindowInterface
145 {
146 public:
147
148 WallpaperWindow (CompWindow *);
149+ ~WallpaperWindow ();
150
151 CompWindow *window;
152 CompositeWindow *cWindow;
153@@ -150,6 +152,8 @@
154
155 bool damageRect (bool ,
156 const CompRect &);
157+
158+ bool alpha () const;
159 };
160
161 #define WALLPAPER_SCREEN(s) \
162
163=== modified file 'src/event.cpp'
164--- src/event.cpp 2013-06-28 01:10:57 +0000
165+++ src/event.cpp 2013-07-24 21:57:49 +0000
166@@ -1577,10 +1577,15 @@
167 {
168 if (w->isViewable ())
169 {
170+ ::compiz::DesktopWindowCount::VisualType visual =
171+ w->alpha () ?
172+ ::compiz::DesktopWindowCount::ARGB :
173+ ::compiz::DesktopWindowCount::RGB;
174+
175 if (w->type () == CompWindowTypeDesktopMask)
176- decrementDesktopWindowCount();
177+ decrementDesktopWindowCount (visual);
178 else if (type == CompWindowTypeDesktopMask)
179- incrementDesktopWindowCount();
180+ incrementDesktopWindowCount (visual);
181 }
182
183 w->wmType () = type;
184
185=== modified file 'src/privatescreen.h'
186--- src/privatescreen.h 2013-05-12 08:20:10 +0000
187+++ src/privatescreen.h 2013-07-24 21:57:49 +0000
188@@ -531,11 +531,14 @@
189 {
190 public:
191 DesktopWindowCount();
192- virtual void incrementDesktopWindowCount();
193- virtual void decrementDesktopWindowCount();
194+
195+ virtual void incrementDesktopWindowCount(VisualType);
196+ virtual void decrementDesktopWindowCount(VisualType);
197 virtual int desktopWindowCount();
198+ virtual int argbDesktopWindowCount();
199 private:
200- int count;
201+ int rgbCount;
202+ int argbCount;
203 };
204
205 class MapNum :
206
207=== modified file 'src/privatescreen/tests/test-privatescreen.cpp'
208--- src/privatescreen/tests/test-privatescreen.cpp 2013-04-17 06:58:36 +0000
209+++ src/privatescreen/tests/test-privatescreen.cpp 2013-07-24 21:57:49 +0000
210@@ -144,6 +144,7 @@
211 CompSize &size,
212 void *&data));
213 MOCK_METHOD0(desktopWindowCount, int ());
214+ MOCK_METHOD0(argbDesktopWindowCount, int ());
215 MOCK_METHOD0(attrib, XWindowAttributes ());
216 MOCK_CONST_METHOD0(defaultIcon, CompIcon *());
217 virtual bool otherGrabExist (const char *, ...) { return false; } // TODO How to mock?
218@@ -178,8 +179,8 @@
219 MOCK_METHOD0(grabbed, bool ());
220 MOCK_METHOD0(snDisplay, SnDisplay * ());
221 MOCK_CONST_METHOD0(createFailed, bool ());
222- MOCK_METHOD0(incrementDesktopWindowCount, void ());
223- MOCK_METHOD0(decrementDesktopWindowCount, void ());
224+ MOCK_METHOD1(incrementDesktopWindowCount, void (VisualType));
225+ MOCK_METHOD1(decrementDesktopWindowCount, void (VisualType));
226 MOCK_METHOD0(nextMapNum, unsigned int ());
227 MOCK_CONST_METHOD0(updatePassiveKeyGrabs, void ());
228 MOCK_METHOD1(updatePassiveButtonGrabs, void (Window serverFrame));
229@@ -1416,3 +1417,67 @@
230 ca::setActionActiveState (action, false);
231 ASSERT_EQ (action.active (), false);
232 }
233+
234+class DesktopWindowCountTest :
235+ public ::testing::Test
236+{
237+ protected:
238+
239+ ::compiz::private_screen::DesktopWindowCount count;
240+};
241+
242+TEST_F (DesktopWindowCountTest, IncrementRGBIncCount)
243+{
244+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
245+ EXPECT_EQ (1, count.desktopWindowCount ());
246+}
247+
248+TEST_F (DesktopWindowCountTest, IncrementRGBNoIncARGBCount)
249+{
250+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
251+ EXPECT_EQ (0, count.argbDesktopWindowCount ());
252+}
253+
254+TEST_F (DesktopWindowCountTest, DecrementRGBDecCount)
255+{
256+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
257+ count.decrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
258+ EXPECT_EQ (0, count.desktopWindowCount ());
259+}
260+
261+TEST_F (DesktopWindowCountTest, DecrementRGBNoDecARGBCount)
262+{
263+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
264+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
265+ count.decrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
266+ EXPECT_EQ (1, count.argbDesktopWindowCount ());
267+}
268+
269+TEST_F (DesktopWindowCountTest, IncrementARGBandRGBIncrementCountTwice)
270+{
271+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
272+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
273+ EXPECT_EQ (2, count.desktopWindowCount ());
274+}
275+
276+TEST_F (DesktopWindowCountTest, DecrementARGBandRGBDecrementCountTwice)
277+{
278+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
279+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
280+ count.decrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
281+ count.decrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
282+ EXPECT_EQ (0, count.desktopWindowCount ());
283+}
284+
285+TEST_F (DesktopWindowCountTest, IncrementARGBNoIncRGBCount)
286+{
287+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
288+ EXPECT_EQ (1, count.desktopWindowCount ());
289+}
290+
291+TEST_F (DesktopWindowCountTest, NoRGBDesktopWindowsTest)
292+{
293+ count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
294+ EXPECT_EQ (0, count.desktopWindowCount () -
295+ count.argbDesktopWindowCount ());
296+}
297
298=== modified file 'src/screen.cpp'
299--- src/screen.cpp 2013-05-13 13:27:30 +0000
300+++ src/screen.cpp 2013-07-24 21:57:49 +0000
301@@ -4314,7 +4314,13 @@
302 int
303 cps::DesktopWindowCount::desktopWindowCount ()
304 {
305- return count;
306+ return rgbCount + argbCount;
307+}
308+
309+int
310+cps::DesktopWindowCount::argbDesktopWindowCount ()
311+{
312+ return argbCount;
313 }
314
315 unsigned int
316@@ -4627,20 +4633,27 @@
317 windowManager.incrementPendingDestroys();
318 }
319
320-cps::DesktopWindowCount::DesktopWindowCount() :
321-count(0)
322+cps::DesktopWindowCount::DesktopWindowCount () :
323+ rgbCount (0),
324+ argbCount (0)
325 {
326 }
327
328 void
329-cps::DesktopWindowCount::incrementDesktopWindowCount()
330+cps::DesktopWindowCount::incrementDesktopWindowCount (VisualType type)
331 {
332- count++;
333+ if (type == ARGB)
334+ ++argbCount;
335+ else
336+ ++rgbCount;
337 }
338 void
339-cps::DesktopWindowCount::decrementDesktopWindowCount()
340+cps::DesktopWindowCount::decrementDesktopWindowCount (VisualType type)
341 {
342- count--;
343+ if (type == ARGB)
344+ --argbCount;
345+ else
346+ --rgbCount;
347 }
348
349 cps::MapNum::MapNum() :
350
351=== modified file 'src/window.cpp'
352--- src/window.cpp 2013-07-19 18:39:38 +0000
353+++ src/window.cpp 2013-07-24 21:57:49 +0000
354@@ -1337,7 +1337,13 @@
355 screen->updateClientList ();
356
357 if (priv->type & CompWindowTypeDesktopMask)
358- screen->incrementDesktopWindowCount();
359+ {
360+ ::compiz::DesktopWindowCount::VisualType visual =
361+ alpha () ?
362+ ::compiz::DesktopWindowCount::ARGB :
363+ ::compiz::DesktopWindowCount::RGB;
364+ screen->incrementDesktopWindowCount (visual);
365+ }
366
367 if (priv->protocols & CompWindowProtocolSyncRequestMask)
368 {
369@@ -1421,7 +1427,13 @@
370 return;
371
372 if (priv->type == CompWindowTypeDesktopMask)
373- screen->decrementDesktopWindowCount();
374+ {
375+ ::compiz::DesktopWindowCount::VisualType visual =
376+ alpha () ?
377+ ::compiz::DesktopWindowCount::ARGB :
378+ ::compiz::DesktopWindowCount::RGB;
379+ screen->decrementDesktopWindowCount (visual);
380+ }
381
382 priv->attrib.map_state = IsUnmapped;
383 priv->invisible = true;
384@@ -6219,8 +6231,13 @@
385
386 if (priv->attrib.map_state == IsViewable)
387 {
388+ ::compiz::DesktopWindowCount::VisualType visual =
389+ alpha () ?
390+ ::compiz::DesktopWindowCount::ARGB :
391+ ::compiz::DesktopWindowCount::RGB;
392+
393 if (priv->type == CompWindowTypeDesktopMask)
394- screen->decrementDesktopWindowCount ();
395+ screen->decrementDesktopWindowCount (visual);
396
397 if (priv->destroyed && priv->struts)
398 screen->updateWorkarea ();

Subscribers

People subscribed via source and target branches

to all changes: