Merge lp:~compiz-team/compiz/compiz.fix_1067246 into lp:compiz/0.9.10
- compiz.fix_1067246
- Merge into 0.9.10
Status: | Superseded |
---|---|
Proposed branch: | lp:~compiz-team/compiz/compiz.fix_1067246 |
Merge into: | lp:compiz/0.9.10 |
Diff against target: |
816 lines (+336/-138) 7 files modified
include/core/CMakeLists.txt (+1/-0) plugins/decor/src/decor.cpp (+6/-4) plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp (+297/-66) src/logmessage/CMakeLists.txt (+0/-13) src/logmessage/include/core/logmessage.h (+0/-51) src/privatewindow.h (+1/-0) src/window.cpp (+31/-4) |
To merge this branch: | bzr merge lp:~compiz-team/compiz/compiz.fix_1067246 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Spilsbury | Approve | ||
Review via email:
|
This proposal supersedes a proposal from 2013-05-20.
This proposal has been superseded by a proposal from 2013-07-15.
Commit message
Remove redundant src/logmessage/
(LP: #1067246)
Description of the change
Remove redundant src/logmessage/
(LP: #1067246)

Micheal Hsu (mkhu) wrote : Posted in a previous version of this proposal | # |

Micheal Hsu (mkhu) wrote : Posted in a previous version of this proposal | # |
I' like to know your opinion

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
On Mon, May 20, 2013 at 11:16 AM, Hu Kang <email address hidden> wrote:
> there is a lot of inconsistency in src/:
You'd be right. There was a half-finished effort to split the compiz
core code into "modules" - although these days that model doesn't
really make sense.
>
> 1. headers. where should we put public headers?
> some headers are in $(top_srcdir)
> some are in $(top_srcdir)
> my proposal: put all public headers in $(top_srcdir)
Lets put all the public headers in include/.
> 2. .cpp files. where should we put source files?
> some .cpp files are in $(top_srcdir)/src : e.g. plugin.cpp
> some .cpp files are in $(top_srcdir)
> my proposal: put all .cpp files in $(top_srcdir)/src/
They can probably all go in src/ - as long as they are still compiled
into independent static libraries.
> 3. tests. where should we put tests?
> some tests are in $(top_srcdir)
> some tests are in $(top_srcdir)
> my proposal: put all tests in $(top_srcdir)
Likewise.
The only places where (2) and (3) cannot apply is in the plugins,
because CompizPlugin.cmake will take all the files in src/*.cpp and
compile that into the plugin, which isn't really what we want for
testing purposes.
> 4. tests naming inconsistency:
> e.g. compiz_option_test, option.cpp for option/tests
> compiz_plugin_test, test-plugin.cpp for plugin/tests
> compiz_
> my proposal: all test executables should be "compiz_test_xxxx"
> all test files should be "test-xxxx"
>
I think compiz_test_xxx for executables and compiz_test_xxx.cpp for
the test files really.
> --
> https:/
> Your team Compiz Maintainers is requested to review the proposed merge of lp:~stevenhooke11/compiz/compiz.fix_1067246 into lp:compiz.
--
Sam Spilsbury

Micheal Hsu (mkhu) wrote : Posted in a previous version of this proposal | # |
Sam. thanks for your comment
some corrections for my previous comment:
(I am talking about files in $(top_srcdir)/src/)
///////
2. .cpp files. where should we put source files?
some .cpp files are in $(top_srcdir)/src : e.g. plugin.cpp
some .cpp files are in $(top_srcdir)
my proposal: put all .cpp files in $(top_srcdir)/src/
3. tests. where should we put tests?
some tests are in $(top_srcdir)
some tests are in $(top_srcdir)
my proposal: put all tests in $(top_srcdir)
///////
I'll push a new branch with 1, 2, 3, 4, applied to $(top_srcdir)/src/.

MC Return (mc-return) wrote : Posted in a previous version of this proposal | # |
Hu, great to see that you are helping with the cleanup/
This was one point on my TODO list. :) Thanks for taking care of it...
+1

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Just before this can be merged in, the install () command which installs whatever is in PUBLIC_HEADERS needs to be removed to (and that would effectively make the SET_TARGET_
Right now, there are two install () statements that cover the same file.
(Sorry for the late review on that one, today's been kind of hectic, and the next week is going to be a bit all over the place too).

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Hey Hu.
Were you going to get to this? I should be able to make the required changes myself - I just don't want to accidentally step on you! :)

Micheal Hsu (mkhu) wrote : Posted in a previous version of this proposal | # |
sorry, i've been a little busy recently. i do have a branch, but haven't tested throughly.
so i guess i won't have time to do that.

MC Return (mc-return) wrote : Posted in a previous version of this proposal | # |
> sorry, i've been a little busy recently. i do have a branch, but haven't
> tested throughly.
> so i guess i won't have time to do that.
Please take your time, but do not throw away work you've already done...
We will simply wait :)
- 3759. By Sam Spilsbury
-
Fixes LP: #1067246

Sam Spilsbury (smspillaz) : | # |
Unmerged revisions
- 3759. By Sam Spilsbury
-
Fixes LP: #1067246
- 3758. By Sam Spilsbury
-
Install logmessage.h
- 3757. By Sam Spilsbury
-
Don't install files twice
- 3756. By Sam Spilsbury
Preview Diff
1 | === modified file 'include/core/CMakeLists.txt' |
2 | --- include/core/CMakeLists.txt 2013-01-03 16:05:26 +0000 |
3 | +++ include/core/CMakeLists.txt 2013-07-15 21:00:34 +0000 |
4 | @@ -6,6 +6,7 @@ |
5 | countedlist.h |
6 | global.h |
7 | icon.h |
8 | + logmessage.h |
9 | match.h |
10 | modifierhandler.h |
11 | option.h |
12 | |
13 | === modified file 'plugins/decor/src/decor.cpp' |
14 | --- plugins/decor/src/decor.cpp 2013-06-28 01:10:57 +0000 |
15 | +++ plugins/decor/src/decor.cpp 2013-07-15 21:00:34 +0000 |
16 | @@ -1651,14 +1651,16 @@ |
17 | CompWindowExtents emptyExtents; |
18 | wd = NULL; |
19 | |
20 | + /* _NET_FRAME_EXTENTS should be updated before the frame |
21 | + * atom is */ |
22 | + memset (&emptyExtents, 0, sizeof (CompWindowExtents)); |
23 | + |
24 | + window->setWindowFrameExtents (&emptyExtents, &emptyExtents); |
25 | + |
26 | /* Undecorated windows need to have the |
27 | * input and output frame removed and the |
28 | * frame window geometry reset */ |
29 | updateFrame (); |
30 | - |
31 | - memset (&emptyExtents, 0, sizeof (CompWindowExtents)); |
32 | - |
33 | - window->setWindowFrameExtents (&emptyExtents, &emptyExtents); |
34 | } |
35 | |
36 | /* We need to damage the current output extents |
37 | |
38 | === modified file 'plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp' |
39 | --- plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp 2013-06-29 07:07:12 +0000 |
40 | +++ plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp 2013-07-15 21:00:34 +0000 |
41 | @@ -38,10 +38,13 @@ |
42 | |
43 | #include <core/point.h> |
44 | #include <core/size.h> |
45 | +#include <core/rect.h> |
46 | |
47 | #include <xorg/gtest/xorg-gtest.h> |
48 | #include <compiz-xorg-gtest.h> |
49 | |
50 | +#include <gtest_shared_tmpenv.h> |
51 | + |
52 | namespace xt = xorg::testing; |
53 | namespace ct = compiz::testing; |
54 | |
55 | @@ -83,6 +86,8 @@ |
56 | Atom mDecorationInputFrameAtom; |
57 | Atom mDecorationOutputFrameAtom; |
58 | |
59 | + TmpEnv mDisableConfigureBufferLocksEnv; |
60 | + |
61 | private: |
62 | |
63 | int GetEventMask () const; |
64 | @@ -96,7 +101,10 @@ |
65 | mDecorationTypePixmap (0), |
66 | mDecorationTypeWindow (0), |
67 | mDecorationInputFrameAtom (0), |
68 | - mDecorationOutputFrameAtom (0) |
69 | + mDecorationOutputFrameAtom (0), |
70 | + /* Disable configure buffer locks as they cause event delivery indeterminacy |
71 | + * that isn't useful for a testing environment */ |
72 | + mDisableConfigureBufferLocksEnv ("COMPIZ_NO_CONFIGURE_BUFFER_LOCKS", "1") |
73 | { |
74 | } |
75 | |
76 | @@ -256,7 +264,8 @@ |
77 | unsigned int actions) const; |
78 | |
79 | virtual CompPoint restoredFrameWindowOffset () const = 0; |
80 | - virtual CompSize restoredDecorationSize () const = 0; |
81 | + virtual CompSize restoredDecorationBorderSize () const = 0; |
82 | + virtual CompSize restoredDecorationInputSize () const = 0; |
83 | |
84 | protected: |
85 | |
86 | @@ -290,7 +299,8 @@ |
87 | size_t propertyDataSize () const; |
88 | void addPropertyData (std::vector<long> &) const; |
89 | CompPoint restoredFrameWindowOffset () const; |
90 | - CompSize restoredDecorationSize () const; |
91 | + CompSize restoredDecorationBorderSize () const; |
92 | + CompSize restoredDecorationInputSize () const; |
93 | |
94 | static const unsigned int WindowDecorationSize = 8; |
95 | |
96 | @@ -323,7 +333,8 @@ |
97 | void changeRestoredInput (const decor_extents_t &input); |
98 | |
99 | CompPoint restoredFrameWindowOffset () const; |
100 | - CompSize restoredDecorationSize () const; |
101 | + CompSize restoredDecorationBorderSize () const; |
102 | + CompSize restoredDecorationInputSize () const; |
103 | |
104 | protected: |
105 | |
106 | @@ -619,12 +630,18 @@ |
107 | } |
108 | |
109 | CompSize |
110 | -cdt::FakeWindowTypeDecoration::restoredDecorationSize () const |
111 | +cdt::FakeWindowTypeDecoration::restoredDecorationBorderSize () const |
112 | { |
113 | return CompSize (mRestored.left + mRestored.right, |
114 | mRestored.top + mRestored.bottom); |
115 | } |
116 | |
117 | +CompSize |
118 | +cdt::FakeWindowTypeDecoration::restoredDecorationInputSize () const |
119 | +{ |
120 | + return restoredDecorationBorderSize (); |
121 | +} |
122 | + |
123 | cdt::FakePixmapTypeDecoration::FakePixmapTypeDecoration (unsigned int type, |
124 | unsigned int state, |
125 | unsigned int actions, |
126 | @@ -713,7 +730,14 @@ |
127 | } |
128 | |
129 | CompSize |
130 | -cdt::FakePixmapTypeDecoration::restoredDecorationSize () const |
131 | +cdt::FakePixmapTypeDecoration::restoredDecorationBorderSize () const |
132 | +{ |
133 | + return CompSize (mRestoredBorder.left + mRestoredBorder.right, |
134 | + mRestoredBorder.top + mRestoredBorder.bottom); |
135 | +} |
136 | + |
137 | +CompSize |
138 | +cdt::FakePixmapTypeDecoration::restoredDecorationInputSize () const |
139 | { |
140 | return CompSize (mRestoredInput.left + mRestoredInput.right, |
141 | mRestoredInput.top + mRestoredInput.bottom); |
142 | @@ -1314,6 +1338,11 @@ |
143 | |
144 | protected: |
145 | |
146 | + cdt::FakeDecoration::Ptr defaultActiveDecoration (); |
147 | + |
148 | + cdt::FakeDecoration::Ptr rootActiveDecoration; |
149 | + cdt::FakeDecoration::Ptr rootBareDecoration; |
150 | + |
151 | cdt::FakeDecorationList rootActiveDecorationList; |
152 | cdt::FakeDecorationList rootBareDecorationList; |
153 | |
154 | @@ -1484,7 +1513,7 @@ |
155 | |
156 | decor_extents_t emptyExtents (DecorationExtents (0, 0, 0, 0)); |
157 | |
158 | - cdt::FakeDecoration::Ptr rootActiveDecoration = |
159 | + rootActiveDecoration = |
160 | MakeFakePixmapTypeDecoration (DECOR_WINDOW_TYPE_NORMAL, |
161 | 0, |
162 | 0, |
163 | @@ -1495,7 +1524,7 @@ |
164 | activeInputMaximized, |
165 | Display ()); |
166 | |
167 | - cdt::FakeDecoration::Ptr rootBareDecoration = |
168 | + rootBareDecoration = |
169 | MakeFakePixmapTypeDecoration (0, 0, 0, |
170 | 1, 1, |
171 | emptyExtents, |
172 | @@ -1519,10 +1548,15 @@ |
173 | DecorWithPixmapDefaultsAcceptance::TearDown () |
174 | { |
175 | /* Remove inserted decorations */ |
176 | - rootActiveDecorationList.RemoveDecoration (DECOR_WINDOW_TYPE_NORMAL, |
177 | - 0, |
178 | - 0); |
179 | - rootBareDecorationList.RemoveDecoration (0, 0, 0); |
180 | + rootActiveDecorationList.RemoveAllDecorations (); |
181 | + rootBareDecorationList.RemoveAllDecorations (); |
182 | + |
183 | + /* This is a bit of a kludge, but we also need to reset |
184 | + * the two decorations manually before TearDown. We can |
185 | + * probably fix this later by encapsulating it all in one |
186 | + * class, but that's a bit of an effort */ |
187 | + rootActiveDecoration.reset (); |
188 | + rootBareDecoration.reset (); |
189 | |
190 | DecorFakeDecoratorAcceptance::TearDown (); |
191 | } |
192 | @@ -1644,6 +1678,8 @@ |
193 | typedef cdt::FakeDecoration::Ptr FakeDecorPtr; |
194 | typedef cdt::FakePixmapTypeDecoration::Ptr FakePixDecorPtr; |
195 | |
196 | + virtual void TearDown (); |
197 | + |
198 | Window CreateDecoratableWindow (::Display *display); |
199 | Window MapAndReparent (::Display *display, |
200 | Window window); |
201 | @@ -1654,6 +1690,10 @@ |
202 | void WaitForDecoration (::Display *display, |
203 | Window window, |
204 | const FakeDecorPtr &decoration); |
205 | + void WaitForDefaultDecoration (::Display *display, |
206 | + Window window, |
207 | + CompRect &testFrameDecorationGeometry, |
208 | + CompRect &testWindowDecorationGeometry); |
209 | void WaitForDecorationUpdate (::Display *display, |
210 | Window window, |
211 | const FakeDecorPtr &decor); |
212 | @@ -1678,6 +1718,14 @@ |
213 | std::map <Window, Window> windowParents; |
214 | }; |
215 | |
216 | +void |
217 | +PixmapDecoratorAcceptance::TearDown () |
218 | +{ |
219 | + windowDecorations.clear (); |
220 | + |
221 | + DecorWithPixmapDefaultsAcceptance::TearDown (); |
222 | +} |
223 | + |
224 | Window |
225 | PixmapDecoratorAcceptance::CreateDecoratableWindow (::Display *display) |
226 | { |
227 | @@ -1734,8 +1782,47 @@ |
228 | Window window, |
229 | const FakeDecorPtr &decoration) |
230 | { |
231 | + WaitForDecorationUpdate (display, window, decoration); |
232 | WaitForPropertyNotify (display, window, DECOR_INPUT_FRAME_ATOM_NAME); |
233 | - WaitForDecorationUpdate (display, window, decoration); |
234 | +} |
235 | + |
236 | +void |
237 | +PixmapDecoratorAcceptance::WaitForDefaultDecoration (::Display *display, |
238 | + Window window, |
239 | + CompRect &decoratedWindowGeometry, |
240 | + CompRect &decoratedFrameGeometry) |
241 | +{ |
242 | + WaitForDecoration (display, window, rootActiveDecoration); |
243 | + |
244 | + /* Fetch the window's absolute geometry */ |
245 | + int x, y; |
246 | + unsigned int width, height, border; |
247 | + |
248 | + ct::AbsoluteWindowGeometry (display, window, x, y, width, height, border); |
249 | + |
250 | + /* Fetch frame extents */ |
251 | + boost::shared_ptr <unsigned char> data; |
252 | + |
253 | + FetchAndVerifyProperty (Display (), |
254 | + window, |
255 | + NETWMFrameExtentsAtom, |
256 | + XA_CARDINAL, |
257 | + 32, |
258 | + 4, |
259 | + 0, |
260 | + data); |
261 | + |
262 | + unsigned long *frameExtents = |
263 | + reinterpret_cast <unsigned long *> (data.get ()); |
264 | + |
265 | + decoratedWindowGeometry.setGeometry (x, y, width, height); |
266 | + |
267 | + /* Adjust for decoration size. This is what future decorations |
268 | + * will add and subtract from */ |
269 | + decoratedFrameGeometry.setGeometry (x - frameExtents[0], |
270 | + y - frameExtents[2], |
271 | + width + (frameExtents[0] + frameExtents[1]), |
272 | + height + (frameExtents[2] + frameExtents[3])); |
273 | } |
274 | |
275 | void |
276 | @@ -1811,6 +1898,123 @@ |
277 | return windowDecorations[window]; |
278 | } |
279 | |
280 | +class PixmapInitialDecorationAcceptance : |
281 | + public PixmapDecoratorAcceptance |
282 | +{ |
283 | + public: |
284 | + |
285 | + virtual void SetUp (); |
286 | + virtual void TearDown (); |
287 | + |
288 | + virtual bool StartDecoratorOnSetUp () const; |
289 | + |
290 | + Window CreateDecoratedWindow (); |
291 | + |
292 | + protected: |
293 | + |
294 | + cdt::FakePixmapTypeDecoration::Ptr mTestWindowDecoration; |
295 | + CompRect mClientGeometryOnInitialDecoration; |
296 | + CompRect mBorderGeometryOnInitialDecoration; |
297 | +}; |
298 | + |
299 | +void |
300 | +PixmapInitialDecorationAcceptance::SetUp () |
301 | +{ |
302 | + PixmapDecoratorAcceptance::SetUp (); |
303 | + |
304 | + unsigned int ResBo = ActiveBorderExtent + 1; |
305 | + unsigned int ResIn = ActiveInputExtent; |
306 | + unsigned int MaxEx = MaximizedBorderExtent; |
307 | + |
308 | + mTestWindowDecoration = |
309 | + MakeFakePixmapTypeDecoration (DECOR_WINDOW_TYPE_NORMAL, |
310 | + 0, |
311 | + 0, |
312 | + 10, |
313 | + 10, |
314 | + DecorationExtents (ResBo, ResBo, ResBo, ResBo), |
315 | + DecorationExtents (ResIn, ResIn, ResIn, ResIn), |
316 | + DecorationExtents (MaxEx, MaxEx, MaxEx, MaxEx), |
317 | + DecorationExtents (MaxEx, MaxEx, MaxEx, MaxEx), |
318 | + Display ()); |
319 | +} |
320 | + |
321 | +bool |
322 | +PixmapInitialDecorationAcceptance::StartDecoratorOnSetUp () const |
323 | +{ |
324 | + return false; |
325 | +} |
326 | + |
327 | +void |
328 | +PixmapInitialDecorationAcceptance::TearDown () |
329 | +{ |
330 | + mTestWindowDecoration.reset (); |
331 | + PixmapDecoratorAcceptance::TearDown (); |
332 | +} |
333 | + |
334 | +Window |
335 | +PixmapInitialDecorationAcceptance::CreateDecoratedWindow () |
336 | +{ |
337 | + Window testWindow = CreateDecoratableWindow (Display ()); |
338 | + |
339 | + /* We need to first explicitly recieve PropertyNotify events before |
340 | + * core starts sending them */ |
341 | + RecievePropertyNotifyEvents (Display (), testWindow); |
342 | + |
343 | + /* Map and reparent the window so that it gets a decoration */ |
344 | + MapAndReparent (Display (), testWindow); |
345 | + |
346 | + /* Start the decorator */ |
347 | + SetUpDecorator (); |
348 | + |
349 | + WaitForDefaultDecoration (Display (), |
350 | + testWindow, |
351 | + mClientGeometryOnInitialDecoration, |
352 | + mBorderGeometryOnInitialDecoration); |
353 | + DecorateWindow (Display (), testWindow, mTestWindowDecoration); |
354 | + WaitForDecorationUpdate (Display (), testWindow, mTestWindowDecoration); |
355 | + |
356 | + return testWindow; |
357 | +} |
358 | + |
359 | +std::ostream & |
360 | +operator<< (std::ostream &os, const CompSize &sz) |
361 | +{ |
362 | + return os << "Size: (width: " |
363 | + << sz.width () |
364 | + << " height: " |
365 | + << sz.height () |
366 | + << ")"; |
367 | +} |
368 | + |
369 | +TEST_F (PixmapInitialDecorationAcceptance, NoSizeChangeInitially) |
370 | +{ |
371 | + CreateDecoratedWindow (); |
372 | + EXPECT_EQ (CompSize (mClientGeometryOnInitialDecoration.width (), |
373 | + mClientGeometryOnInitialDecoration.height ()), |
374 | + CompSize (ct::WINDOW_WIDTH, |
375 | + ct::WINDOW_HEIGHT)); |
376 | +} |
377 | + |
378 | +TEST_F (PixmapInitialDecorationAcceptance, SizeChangesApplySubsequently) |
379 | +{ |
380 | + Window testWindow = CreateDecoratedWindow (); |
381 | + |
382 | + /* Measuring size change from default decoration to real decoration */ |
383 | + const CompSize &size (mTestWindowDecoration->restoredDecorationBorderSize ()); |
384 | + |
385 | + EXPECT_THAT (testWindow, |
386 | + HasGeometry (Display (), |
387 | + RelativeWindowGeometry, |
388 | + _, |
389 | + _, |
390 | + mBorderGeometryOnInitialDecoration.width () - |
391 | + size.width (), |
392 | + mBorderGeometryOnInitialDecoration.height () - |
393 | + size.height (), |
394 | + _)); |
395 | +} |
396 | + |
397 | class PixmapDecoratedWindowAcceptance : |
398 | public PixmapDecoratorAcceptance |
399 | { |
400 | @@ -1831,6 +2035,8 @@ |
401 | Window mTestWindowParent; |
402 | |
403 | cdt::FakePixmapTypeDecoration::Ptr mTestWindowDecoration; |
404 | + CompRect mClientGeometryOnInitialDecoration; |
405 | + CompRect mBorderGeometryOnInitialDecoration; |
406 | }; |
407 | |
408 | PixmapDecoratedWindowAcceptance::PixmapDecoratedWindowAcceptance () : |
409 | @@ -1851,6 +2057,11 @@ |
410 | /* Start the decorator */ |
411 | SetUpDecorator (); |
412 | |
413 | + WaitForDefaultDecoration (display, |
414 | + mTestWindow, |
415 | + mClientGeometryOnInitialDecoration, |
416 | + mBorderGeometryOnInitialDecoration); |
417 | + |
418 | /* We need to change the border extent so that the window |
419 | * will move from its position in the default decoration */ |
420 | unsigned int ResBo = RealDecorationActiveBorderExtent; |
421 | @@ -1870,15 +2081,16 @@ |
422 | Display ()); |
423 | |
424 | DecorateWindow (display, mTestWindow, mTestWindowDecoration); |
425 | - WaitForDecoration (display, mTestWindow, mTestWindowDecoration); |
426 | + WaitForDecorationUpdate (display, mTestWindow, mTestWindowDecoration); |
427 | } |
428 | |
429 | void |
430 | PixmapDecoratedWindowAcceptance::TearDown () |
431 | { |
432 | + mTestWindowDecoration.reset (); |
433 | DestroyWindow (Display (), mTestWindow); |
434 | |
435 | - DecorWithPixmapDefaultsAcceptance::TearDown (); |
436 | + PixmapDecoratorAcceptance::TearDown (); |
437 | } |
438 | |
439 | bool |
440 | @@ -2196,25 +2408,25 @@ |
441 | |
442 | /* Ensure that a window expands to its original size when it is |
443 | * undecorated */ |
444 | -TEST_F (PixmapDecoratedWindowAcceptance, UndecoratedWindowExpandToOrigSize) |
445 | +TEST_F (PixmapDecoratedWindowAcceptance, UndecoratedWindowExpandToOrigSizePlusInitialBorder) |
446 | { |
447 | DisallowDecorationsOnWindow (mTestWindow); |
448 | |
449 | WaitForConfigureOn (Display (), |
450 | mTestWindowParent, |
451 | - ct::WINDOW_X, |
452 | - ct::WINDOW_Y, |
453 | - ct::WINDOW_WIDTH, |
454 | - ct::WINDOW_HEIGHT, |
455 | + mBorderGeometryOnInitialDecoration.x (), |
456 | + mBorderGeometryOnInitialDecoration.y (), |
457 | + mBorderGeometryOnInitialDecoration.width (), |
458 | + mBorderGeometryOnInitialDecoration.height (), |
459 | CWX | CWY | CWWidth | CWHeight); |
460 | |
461 | EXPECT_THAT (mTestWindow, |
462 | HasGeometry (Display (), |
463 | AbsoluteWindowGeometry, |
464 | - ct::WINDOW_X, |
465 | - ct::WINDOW_Y, |
466 | - ct::WINDOW_WIDTH, |
467 | - ct::WINDOW_HEIGHT, |
468 | + mBorderGeometryOnInitialDecoration.x (), |
469 | + mBorderGeometryOnInitialDecoration.y (), |
470 | + mBorderGeometryOnInitialDecoration.width (), |
471 | + mBorderGeometryOnInitialDecoration.height (), |
472 | _)); |
473 | } |
474 | |
475 | @@ -2230,19 +2442,19 @@ |
476 | |
477 | WaitForConfigureOn (Display (), |
478 | mTestWindowParent, |
479 | - ct::WINDOW_X, |
480 | - ct::WINDOW_Y, |
481 | - ct::WINDOW_WIDTH, |
482 | - ct::WINDOW_HEIGHT, |
483 | + mBorderGeometryOnInitialDecoration.x (), |
484 | + mBorderGeometryOnInitialDecoration.y (), |
485 | + mBorderGeometryOnInitialDecoration.width (), |
486 | + mBorderGeometryOnInitialDecoration.height (), |
487 | CWX | CWY | CWWidth | CWHeight); |
488 | |
489 | EXPECT_THAT (mTestWindow, |
490 | HasGeometry (Display (), |
491 | AbsoluteWindowGeometry, |
492 | - ct::WINDOW_X, |
493 | - ct::WINDOW_Y, |
494 | - ct::WINDOW_WIDTH, |
495 | - ct::WINDOW_HEIGHT, |
496 | + mBorderGeometryOnInitialDecoration.x (), |
497 | + mBorderGeometryOnInitialDecoration.y (), |
498 | + mBorderGeometryOnInitialDecoration.width (), |
499 | + mBorderGeometryOnInitialDecoration.height (), |
500 | _)); |
501 | } |
502 | |
503 | @@ -2324,8 +2536,10 @@ |
504 | |
505 | EXPECT_THAT (mTestWindow, HasGeometry (Display (), |
506 | AbsoluteWindowGeometry, |
507 | - ct::WINDOW_X + GetParam ().left, |
508 | - ct::WINDOW_Y + GetParam ().top, |
509 | + mBorderGeometryOnInitialDecoration.x () + |
510 | + GetParam ().left, |
511 | + mBorderGeometryOnInitialDecoration.y () + |
512 | + GetParam ().top, |
513 | _, |
514 | _, |
515 | _)); |
516 | @@ -2344,10 +2558,12 @@ |
517 | AbsoluteWindowGeometry, |
518 | _, |
519 | _, |
520 | - ct::WINDOW_WIDTH - (GetParam ().left + |
521 | - GetParam ().right), |
522 | - ct::WINDOW_HEIGHT - (GetParam ().top + |
523 | - GetParam ().bottom), |
524 | + mBorderGeometryOnInitialDecoration.width () - |
525 | + (GetParam ().left + |
526 | + GetParam ().right), |
527 | + mBorderGeometryOnInitialDecoration.height () - |
528 | + (GetParam ().top + |
529 | + GetParam ().bottom), |
530 | _)); |
531 | } |
532 | |
533 | @@ -2373,10 +2589,12 @@ |
534 | AbsoluteWindowGeometry, |
535 | _, |
536 | _, |
537 | - ct::WINDOW_WIDTH - (newExtents.left + |
538 | - newExtents.right), |
539 | - ct::WINDOW_HEIGHT - (newExtents.top + |
540 | - newExtents.bottom), |
541 | + mBorderGeometryOnInitialDecoration.width () - |
542 | + (newExtents.left + |
543 | + newExtents.right), |
544 | + mBorderGeometryOnInitialDecoration.height () - |
545 | + (newExtents.top + |
546 | + newExtents.bottom), |
547 | _)); |
548 | } |
549 | |
550 | @@ -2401,7 +2619,7 @@ |
551 | WindowDecorationAtom); |
552 | |
553 | const CompPoint &off (mTestWindowDecoration->restoredFrameWindowOffset ()); |
554 | - const CompSize &size (mTestWindowDecoration->restoredDecorationSize ()); |
555 | + const CompSize &size (mTestWindowDecoration->restoredDecorationInputSize ()); |
556 | |
557 | /* As the window is shrunk to accomodate the border size, we must subtract |
558 | * the border from the original window size */ |
559 | @@ -2409,19 +2627,26 @@ |
560 | (newExtents.top + newExtents.bottom)); |
561 | |
562 | RestoreWindow (mTestWindow, |
563 | - ct::WINDOW_X + off.x (), |
564 | - ct::WINDOW_Y + off.y (), |
565 | - ct::WINDOW_WIDTH - shrink.width () + size.width (), |
566 | - ct::WINDOW_HEIGHT - shrink.height () + size.height ()); |
567 | + mBorderGeometryOnInitialDecoration.x () + off.x (), |
568 | + mBorderGeometryOnInitialDecoration.y () + off.y (), |
569 | + mBorderGeometryOnInitialDecoration.width () - |
570 | + shrink.width () + size.width (), |
571 | + mBorderGeometryOnInitialDecoration.height () - |
572 | + shrink.height () + size.height ()); |
573 | |
574 | + /* Subtract the old offset and size and add on the new decoration geometry */ |
575 | EXPECT_THAT (mTestWindow, HasGeometry (Display (), |
576 | AbsoluteWindowGeometry, |
577 | - ct::WINDOW_X + newExtents.left, |
578 | - ct::WINDOW_Y + newExtents.top, |
579 | - ct::WINDOW_WIDTH - (newExtents.left + |
580 | - newExtents.right), |
581 | - ct::WINDOW_HEIGHT - (newExtents.top + |
582 | - newExtents.bottom), |
583 | + mBorderGeometryOnInitialDecoration.x () + |
584 | + newExtents.left, |
585 | + mBorderGeometryOnInitialDecoration.y () + |
586 | + newExtents.top, |
587 | + mBorderGeometryOnInitialDecoration.width () - |
588 | + ((newExtents.left + |
589 | + newExtents.right)), |
590 | + mBorderGeometryOnInitialDecoration.height () - |
591 | + ((newExtents.top + |
592 | + newExtents.bottom)), |
593 | _)); |
594 | } |
595 | |
596 | @@ -2451,7 +2676,7 @@ |
597 | AllowDecorationsOnWindow (mTestWindow); |
598 | |
599 | const CompPoint &off (mTestWindowDecoration->restoredFrameWindowOffset ()); |
600 | - const CompSize &size (mTestWindowDecoration->restoredDecorationSize ()); |
601 | + const CompSize &size (mTestWindowDecoration->restoredDecorationInputSize ()); |
602 | |
603 | /* As the window is shrunk to accomadate the border size, we must subtract |
604 | * the border from the original window size */ |
605 | @@ -2460,20 +2685,26 @@ |
606 | |
607 | WaitForConfigureOn (Display (), |
608 | mTestWindowParent, |
609 | - ct::WINDOW_X + off.x (), |
610 | - ct::WINDOW_Y + off.y (), |
611 | - ct::WINDOW_WIDTH - shrink.width () + size.width (), |
612 | - ct::WINDOW_HEIGHT - shrink.height () + size.height (), |
613 | + mBorderGeometryOnInitialDecoration.x () + off.x (), |
614 | + mBorderGeometryOnInitialDecoration.y () + off.y (), |
615 | + mBorderGeometryOnInitialDecoration.width () - |
616 | + shrink.width () + size.width (), |
617 | + mBorderGeometryOnInitialDecoration.height () - |
618 | + shrink.height () + size.height (), |
619 | CWX | CWY | CWWidth | CWHeight); |
620 | |
621 | EXPECT_THAT (mTestWindow, HasGeometry (Display (), |
622 | AbsoluteWindowGeometry, |
623 | - ct::WINDOW_X + newExtents.left, |
624 | - ct::WINDOW_Y + newExtents.top, |
625 | - ct::WINDOW_WIDTH - (newExtents.left + |
626 | - newExtents.right), |
627 | - ct::WINDOW_HEIGHT - (newExtents.top + |
628 | - newExtents.bottom), |
629 | + mBorderGeometryOnInitialDecoration.x () + |
630 | + newExtents.left, |
631 | + mBorderGeometryOnInitialDecoration.y () + |
632 | + newExtents.top, |
633 | + mBorderGeometryOnInitialDecoration.width () - |
634 | + (newExtents.left + |
635 | + newExtents.right), |
636 | + mBorderGeometryOnInitialDecoration.height () - |
637 | + (newExtents.top + |
638 | + newExtents.bottom), |
639 | _)); |
640 | } |
641 | |
642 | @@ -2490,8 +2721,8 @@ |
643 | |
644 | EXPECT_THAT (mTestWindow, HasGeometry (Display (), |
645 | AbsoluteWindowGeometry, |
646 | - ct::WINDOW_X + 1, |
647 | - ct::WINDOW_Y + 1, |
648 | + mBorderGeometryOnInitialDecoration.x () + 1, |
649 | + mBorderGeometryOnInitialDecoration.y () + 1, |
650 | _, |
651 | _, |
652 | _)); |
653 | |
654 | === modified file 'src/logmessage/CMakeLists.txt' |
655 | --- src/logmessage/CMakeLists.txt 2012-01-23 17:46:28 +0000 |
656 | +++ src/logmessage/CMakeLists.txt 2013-07-15 21:00:34 +0000 |
657 | @@ -1,15 +1,9 @@ |
658 | - |
659 | INCLUDE_DIRECTORIES( |
660 | - ${CMAKE_CURRENT_SOURCE_DIR}/include |
661 | - |
662 | ${compiz_SOURCE_DIR}/include |
663 | |
664 | ${Boost_INCLUDE_DIRS} |
665 | ) |
666 | |
667 | -SET( PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/core/logmessage.h ) |
668 | -SET( PRIVATE_HEADERS ) |
669 | - |
670 | SET( SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/logmessage.cpp ) |
671 | |
672 | ADD_LIBRARY( |
673 | @@ -24,10 +18,3 @@ |
674 | IF (COMPIZ_BUILD_TESTING) |
675 | ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) |
676 | ENDIF (COMPIZ_BUILD_TESTING) |
677 | - |
678 | -SET_TARGET_PROPERTIES( |
679 | - compiz_logmessage PROPERTIES |
680 | - PUBLIC_HEADER "${PUBLIC_HEADERS}" |
681 | -) |
682 | - |
683 | -install (FILES ${PUBLIC_HEADERS} DESTINATION ${COMPIZ_CORE_INCLUDE_DIR}) |
684 | |
685 | === removed directory 'src/logmessage/include' |
686 | === removed directory 'src/logmessage/include/core' |
687 | === removed file 'src/logmessage/include/core/logmessage.h' |
688 | --- src/logmessage/include/core/logmessage.h 2011-10-31 13:51:00 +0000 |
689 | +++ src/logmessage/include/core/logmessage.h 1970-01-01 00:00:00 +0000 |
690 | @@ -1,51 +0,0 @@ |
691 | -/* |
692 | - * Copyright © 2007 Novell, Inc. |
693 | - * |
694 | - * Permission to use, copy, modify, distribute, and sell this software |
695 | - * and its documentation for any purpose is hereby granted without |
696 | - * fee, provided that the above copyright notice appear in all copies |
697 | - * and that both that copyright notice and this permission notice |
698 | - * appear in supporting documentation, and that the name of |
699 | - * Novell, Inc. not be used in advertising or publicity pertaining to |
700 | - * distribution of the software without specific, written prior permission. |
701 | - * Novell, Inc. makes no representations about the suitability of this |
702 | - * software for any purpose. It is provided "as is" without express or |
703 | - * implied warranty. |
704 | - * |
705 | - * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
706 | - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
707 | - * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
708 | - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
709 | - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
710 | - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
711 | - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
712 | - * |
713 | - * Author: David Reveman <davidr@novell.com> |
714 | - */ |
715 | - |
716 | -#ifndef _COMPIZ_LOGMESSAGE_H |
717 | -#define _COMPIZ_LOGMESSAGE_H |
718 | - |
719 | -typedef enum { |
720 | - CompLogLevelFatal = 0, |
721 | - CompLogLevelError, |
722 | - CompLogLevelWarn, |
723 | - CompLogLevelInfo, |
724 | - CompLogLevelDebug |
725 | -} CompLogLevel; |
726 | - |
727 | -void |
728 | -logMessage (const char *componentName, |
729 | - CompLogLevel level, |
730 | - const char *message); |
731 | - |
732 | -void |
733 | -compLogMessage (const char *componentName, |
734 | - CompLogLevel level, |
735 | - const char *format, |
736 | - ...); |
737 | - |
738 | -const char * |
739 | -logLevelToString (CompLogLevel level); |
740 | - |
741 | -#endif |
742 | |
743 | === modified file 'src/privatewindow.h' |
744 | --- src/privatewindow.h 2013-03-06 12:31:24 +0000 |
745 | +++ src/privatewindow.h 2013-07-15 21:00:34 +0000 |
746 | @@ -400,6 +400,7 @@ |
747 | bool shaded; |
748 | bool hidden; |
749 | bool grabbed; |
750 | + bool alreadyDecorated; |
751 | |
752 | unsigned int desktop; |
753 | |
754 | |
755 | === modified file 'src/window.cpp' |
756 | --- src/window.cpp 2013-06-28 01:10:57 +0000 |
757 | +++ src/window.cpp 2013-07-15 21:00:34 +0000 |
758 | @@ -6299,9 +6299,25 @@ |
759 | |
760 | namespace |
761 | { |
762 | +class NullConfigureBufferLock : |
763 | + public crb::BufferLock |
764 | +{ |
765 | + public: |
766 | + |
767 | + NullConfigureBufferLock (crb::CountedFreeze *cf) {} |
768 | + |
769 | + void lock () {} |
770 | + void release () {} |
771 | +}; |
772 | + |
773 | crb::BufferLock::Ptr |
774 | createConfigureBufferLock (crb::CountedFreeze *cf) |
775 | { |
776 | + /* Return an implementation that does nothing if the user explicitly |
777 | + * disabled buffer locks for this running instance */ |
778 | + if (getenv ("COMPIZ_NO_CONFIGURE_BUFFER_LOCKS")) |
779 | + return boost::make_shared <NullConfigureBufferLock> (cf); |
780 | + |
781 | return boost::make_shared <crb::ConfigureBufferLock> (cf); |
782 | } |
783 | } |
784 | @@ -6348,6 +6364,7 @@ |
785 | shaded (false), |
786 | hidden (false), |
787 | grabbed (false), |
788 | + alreadyDecorated (false), |
789 | |
790 | desktop (0), |
791 | |
792 | @@ -6591,10 +6608,20 @@ |
793 | priv->sizeHints.win_gravity) - |
794 | compiz::window::extents::shift (priv->border, |
795 | priv->sizeHints.win_gravity); |
796 | - CompSize sizeDelta = CompSize (-((b->left + b->right) - |
797 | - (priv->border.left + priv->border.right)), |
798 | - -((b->top + b->bottom) - |
799 | - (priv->border.top + priv->border.bottom))); |
800 | + |
801 | + CompSize sizeDelta; |
802 | + |
803 | + /* We don't want to change the size of the window the first time we |
804 | + * decorate it, but we do thereafter */ |
805 | + if (priv->alreadyDecorated) |
806 | + { |
807 | + sizeDelta.setWidth (-((b->left + b->right) - |
808 | + (priv->border.left + priv->border.right))); |
809 | + sizeDelta.setHeight (-((b->top + b->bottom) - |
810 | + (priv->border.top + priv->border.bottom))); |
811 | + } |
812 | + else |
813 | + priv->alreadyDecorated = true; |
814 | |
815 | priv->serverInput = *i; |
816 | priv->border = *b; |
there is a lot of inconsistency in src/:
1. headers. where should we put public headers? /include, : e.g. plugin.h, point.h /src/<sub_ directory> /include/ : e.g. string.h /include /<sub_directory >/src/: e.g. point.cpp /src/<sub_ directory> /tests: e.g. plugin, point /tests/ /src/tests
compiz_ plugin_ test, test-plugin.cpp for plugin/tests
compiz_ test_outputdevi ces, test_outputdevi ces.cpp for tests/
some headers are in $(top_srcdir)
some are in $(top_srcdir)
my proposal: put all public headers in $(top_srcdir)
2. .cpp files. where should we put source files?
some .cpp files are in $(top_srcdir)/src : e.g. plugin.cpp
some .cpp files are in $(top_srcdir)
my proposal: put all .cpp files in $(top_srcdir)/src/
3. tests. where should we put tests?
some tests are in $(top_srcdir)
some tests are in $(top_srcdir)
my proposal: put all tests in $(top_srcdir)
4. tests naming inconsistency:
e.g. compiz_option_test, option.cpp for option/tests
my proposal: all test executables should be "compiz_test_xxxx"
all test files should be "test-xxxx"