Merge lp:~muktupavels/compiz/lp1574866 into lp:compiz/0.9.12

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 4011
Merged at revision: 4013
Proposed branch: lp:~muktupavels/compiz/lp1574866
Merge into: lp:compiz/0.9.12
Diff against target: 192 lines (+60/-11)
7 files modified
include/core/screen.h (+3/-0)
plugins/opengl/src/paint.cpp (+1/-1)
src/event.cpp (+10/-2)
src/privatescreen.h (+5/-1)
src/privatescreen/tests/test-privatescreen.cpp (+3/-0)
src/screen.cpp (+24/-5)
src/window.cpp (+14/-2)
To merge this branch: bzr merge lp:~muktupavels/compiz/lp1574866
Reviewer Review Type Date Requested Status
Andrea Azzarone Approve
Review via email: mp+292865@code.launchpad.net

Commit message

OpenGL: use the number of Opaque windows around to decide whether paint the bg or not

- count only opaque windows, ignore if window has alpha and/or 32 depth.

To post a comment you must log in.
lp:~muktupavels/compiz/lp1574866 updated
4011. By Alberts Muktupāvels

LP: #1574866

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

Please take a look to diff comments.

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

+1. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/core/screen.h'
2--- include/core/screen.h 2015-10-20 22:43:42 +0000
3+++ include/core/screen.h 2016-04-26 12:43:18 +0000
4@@ -169,8 +169,11 @@
5 {
6 public:
7 virtual void incrementDesktopWindowCount() = 0;
8+ virtual void incrementOpaqueDesktopWindowCount() = 0;
9 virtual void decrementDesktopWindowCount() = 0;
10+ virtual void decrementOpaqueDesktopWindowCount() = 0;
11 virtual int desktopWindowCount() = 0;
12+ virtual int opaqueDesktopWindowCount() = 0;
13 protected:
14 ~DesktopWindowCount() {}
15 };
16
17=== modified file 'plugins/opengl/src/paint.cpp'
18--- plugins/opengl/src/paint.cpp 2015-04-07 14:20:32 +0000
19+++ plugins/opengl/src/paint.cpp 2016-04-26 12:43:18 +0000
20@@ -86,7 +86,7 @@
21 if (!nBox)
22 return;
23
24- if (screen->desktopWindowCount ())
25+ if (screen->opaqueDesktopWindowCount ())
26 {
27 if (!backgroundTextures.empty ())
28 {
29
30=== modified file 'src/event.cpp'
31--- src/event.cpp 2015-10-13 11:33:31 +0000
32+++ src/event.cpp 2016-04-26 12:43:18 +0000
33@@ -1679,9 +1679,17 @@
34 if (w->isViewable ())
35 {
36 if (w->type () == CompWindowTypeDesktopMask)
37- decrementDesktopWindowCount();
38+ {
39+ decrementDesktopWindowCount ();
40+ if (!w->alpha ())
41+ decrementOpaqueDesktopWindowCount ();
42+ }
43 else if (type == CompWindowTypeDesktopMask)
44- incrementDesktopWindowCount();
45+ {
46+ incrementDesktopWindowCount ();
47+ if (!w->alpha ())
48+ incrementOpaqueDesktopWindowCount ();
49+ }
50 }
51
52 w->wmType () = type;
53
54=== modified file 'src/privatescreen.h'
55--- src/privatescreen.h 2015-10-26 17:15:50 +0000
56+++ src/privatescreen.h 2016-04-26 12:43:18 +0000
57@@ -542,10 +542,14 @@
58 DesktopWindowCount();
59 virtual ~DesktopWindowCount() {}
60 virtual void incrementDesktopWindowCount();
61+ virtual void incrementOpaqueDesktopWindowCount();
62 virtual void decrementDesktopWindowCount();
63+ virtual void decrementOpaqueDesktopWindowCount();
64 virtual int desktopWindowCount();
65+ virtual int opaqueDesktopWindowCount();
66 private:
67- int count;
68+ int countAll;
69+ int countOpaque;
70 };
71
72 class MapNum :
73
74=== modified file 'src/privatescreen/tests/test-privatescreen.cpp'
75--- src/privatescreen/tests/test-privatescreen.cpp 2015-10-26 17:15:50 +0000
76+++ src/privatescreen/tests/test-privatescreen.cpp 2016-04-26 12:43:18 +0000
77@@ -145,6 +145,7 @@
78 CompSize &size,
79 void *&data));
80 MOCK_METHOD0(desktopWindowCount, int ());
81+ MOCK_METHOD0(opaqueDesktopWindowCount, int ());
82 MOCK_METHOD0(attrib, XWindowAttributes ());
83 MOCK_CONST_METHOD0(defaultIcon, CompIcon *());
84 virtual bool otherGrabExist (const char *, ...) { return false; } // TODO How to mock?
85@@ -183,7 +184,9 @@
86 MOCK_METHOD0(snDisplay, SnDisplay * ());
87 MOCK_CONST_METHOD0(createFailed, bool ());
88 MOCK_METHOD0(incrementDesktopWindowCount, void ());
89+ MOCK_METHOD0(incrementOpaqueDesktopWindowCount, void ());
90 MOCK_METHOD0(decrementDesktopWindowCount, void ());
91+ MOCK_METHOD0(decrementOpaqueDesktopWindowCount, void ());
92 MOCK_METHOD0(nextMapNum, unsigned int ());
93 MOCK_CONST_METHOD0(updatePassiveKeyGrabs, void ());
94 MOCK_METHOD1(updatePassiveButtonGrabs, void (Window serverFrame));
95
96=== modified file 'src/screen.cpp'
97--- src/screen.cpp 2015-10-26 17:15:50 +0000
98+++ src/screen.cpp 2016-04-26 12:43:18 +0000
99@@ -4565,7 +4565,13 @@
100 int
101 cps::DesktopWindowCount::desktopWindowCount ()
102 {
103- return count;
104+ return countAll;
105+}
106+
107+int
108+cps::DesktopWindowCount::opaqueDesktopWindowCount ()
109+{
110+ return countOpaque;
111 }
112
113 unsigned int
114@@ -4879,19 +4885,32 @@
115 }
116
117 cps::DesktopWindowCount::DesktopWindowCount() :
118-count(0)
119+countAll(0), countOpaque(0)
120 {
121 }
122
123 void
124 cps::DesktopWindowCount::incrementDesktopWindowCount()
125 {
126- count++;
127-}
128+ countAll++;
129+}
130+
131+void
132+cps::DesktopWindowCount::incrementOpaqueDesktopWindowCount()
133+{
134+ countOpaque++;
135+}
136+
137 void
138 cps::DesktopWindowCount::decrementDesktopWindowCount()
139 {
140- count--;
141+ countAll--;
142+}
143+
144+void
145+cps::DesktopWindowCount::decrementOpaqueDesktopWindowCount()
146+{
147+ countOpaque--;
148 }
149
150 cps::MapNum::MapNum() :
151
152=== modified file 'src/window.cpp'
153--- src/window.cpp 2015-08-05 11:26:30 +0000
154+++ src/window.cpp 2016-04-26 12:43:18 +0000
155@@ -1372,7 +1372,11 @@
156 screen->updateClientList ();
157
158 if (priv->type & CompWindowTypeDesktopMask)
159- screen->incrementDesktopWindowCount();
160+ {
161+ screen->incrementDesktopWindowCount ();
162+ if (!alpha ())
163+ screen->incrementOpaqueDesktopWindowCount ();
164+ }
165
166 if (priv->protocols & CompWindowProtocolSyncRequestMask)
167 {
168@@ -1456,7 +1460,11 @@
169 return;
170
171 if (priv->type == CompWindowTypeDesktopMask)
172- screen->decrementDesktopWindowCount();
173+ {
174+ screen->decrementDesktopWindowCount ();
175+ if (!alpha ())
176+ screen->decrementOpaqueDesktopWindowCount ();
177+ }
178
179 priv->attrib.map_state = IsUnmapped;
180 priv->invisible = true;
181@@ -6333,7 +6341,11 @@
182 if (priv->attrib.map_state == IsViewable)
183 {
184 if (priv->type == CompWindowTypeDesktopMask)
185+ {
186 screen->decrementDesktopWindowCount ();
187+ if (!alpha ())
188+ screen->decrementOpaqueDesktopWindowCount ();
189+ }
190
191 if (priv->destroyed && priv->struts)
192 screen->updateWorkarea ();

Subscribers

People subscribed via source and target branches