Merge lp:~compiz-team/compiz/compiz.fix_1198000.update-tests.1 into lp:compiz/0.9.10

Proposed by Sam Spilsbury
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3757
Merged at revision: 3765
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1198000.update-tests.1
Merge into: lp:compiz/0.9.10
Prerequisite: lp:~azzar1/compiz/fix-1198000
Diff against target: 725 lines (+333/-75)
5 files modified
plugins/decor/src/decor.cpp (+6/-4)
plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt (+1/-0)
plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp (+297/-66)
src/privatewindow.h (+1/-0)
src/window.cpp (+28/-5)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1198000.update-tests.1
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sam Spilsbury Approve
Andrea Azzarone Approve
Review via email: mp+174649@code.launchpad.net

This proposal supersedes a proposal from 2013-07-15.

Commit message

Adjust acceptance tests for the fix to LP: #1198000

  1. Always set frame extents before updating the frame
  2. Added COMPIZ_NO_CONFIGURE_BUFFER_LOCKS so that we don't have to deal
     with the delayed configure requests logic in the tests where it
     does not help
  3. Split restoredDecorationSize in to restoredDecorationBorderSize
     and restoredDecorationInputSize so that we can measure the size of
     the decoration both in terms of its visible and invisible border
  4. Wait for the default decoration properly
  5. Capture the initial geometry of the window with and without decorations
     when the window gets its first decoration. Use these values to calculate
     the size changes in the window from then on instead of its creation
     values
  6. Just flag when the window was first decorated in setWindowFrameExtents
     rather than checking if it is mapped. We only want to not resize
     the window once.

Description of the change

  Adjust acceptance tests for the fix to LP: #1198000

  1. Always set frame extents before updating the frame
  2. Added COMPIZ_NO_CONFIGURE_BUFFER_LOCKS so that we don't have to deal
     with the delayed configure requests logic in the tests where it
     does not help
  3. Split restoredDecorationSize in to restoredDecorationBorderSize
     and restoredDecorationInputSize so that we can measure the size of
     the decoration both in terms of its visible and invisible border
  4. Wait for the default decoration properly
  5. Capture the initial geometry of the window with and without decorations
     when the window gets its first decoration. Use these values to calculate
     the size changes in the window from then on instead of its creation
     values
  6. Just flag when the window was first decorated in setWindowFrameExtents
     rather than checking if it is mapped. We only want to not resize
     the window once.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
3757. By Sam Spilsbury

Merge lp:compiz

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
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/decor/src/decor.cpp'
2--- plugins/decor/src/decor.cpp 2013-06-28 01:10:57 +0000
3+++ plugins/decor/src/decor.cpp 2013-07-19 04:17:27 +0000
4@@ -1651,14 +1651,16 @@
5 CompWindowExtents emptyExtents;
6 wd = NULL;
7
8+ /* _NET_FRAME_EXTENTS should be updated before the frame
9+ * atom is */
10+ memset (&emptyExtents, 0, sizeof (CompWindowExtents));
11+
12+ window->setWindowFrameExtents (&emptyExtents, &emptyExtents);
13+
14 /* Undecorated windows need to have the
15 * input and output frame removed and the
16 * frame window geometry reset */
17 updateFrame ();
18-
19- memset (&emptyExtents, 0, sizeof (CompWindowExtents));
20-
21- window->setWindowFrameExtents (&emptyExtents, &emptyExtents);
22 }
23
24 /* We need to damage the current output extents
25
26=== modified file 'plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt'
27--- plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt 2013-06-28 21:07:41 +0000
28+++ plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt 2013-07-19 04:17:27 +0000
29@@ -22,6 +22,7 @@
30 decoration
31 compiz_point
32 compiz_size
33+ compiz_rect
34 ${GMOCK_LIBRARY}
35 ${GMOCK_MAIN_LIBRARY}
36 ${GTEST_BOTH_LIBRARIES}
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-19 04:17:27 +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/privatewindow.h'
655--- src/privatewindow.h 2013-06-26 10:49:55 +0000
656+++ src/privatewindow.h 2013-07-19 04:17:27 +0000
657@@ -401,6 +401,7 @@
658 bool shaded;
659 bool hidden;
660 bool grabbed;
661+ bool alreadyDecorated;
662
663 unsigned int desktop;
664
665
666=== modified file 'src/window.cpp'
667--- src/window.cpp 2013-07-18 13:06:24 +0000
668+++ src/window.cpp 2013-07-19 04:17:27 +0000
669@@ -6273,9 +6273,25 @@
670
671 namespace
672 {
673+class NullConfigureBufferLock :
674+ public crb::BufferLock
675+{
676+ public:
677+
678+ NullConfigureBufferLock (crb::CountedFreeze *cf) {}
679+
680+ void lock () {}
681+ void release () {}
682+};
683+
684 crb::BufferLock::Ptr
685 createConfigureBufferLock (crb::CountedFreeze *cf)
686 {
687+ /* Return an implementation that does nothing if the user explicitly
688+ * disabled buffer locks for this running instance */
689+ if (getenv ("COMPIZ_NO_CONFIGURE_BUFFER_LOCKS"))
690+ return boost::make_shared <NullConfigureBufferLock> (cf);
691+
692 return boost::make_shared <crb::ConfigureBufferLock> (cf);
693 }
694 }
695@@ -6322,6 +6338,7 @@
696 shaded (false),
697 hidden (false),
698 grabbed (false),
699+ alreadyDecorated (false),
700
701 desktop (0),
702
703@@ -6568,11 +6585,17 @@
704
705 CompSize sizeDelta;
706
707- if (isMapped())
708- sizeDelta = CompSize (-((b->left + b->right) -
709- (priv->border.left + priv->border.right)),
710- -((b->top + b->bottom) -
711- (priv->border.top + priv->border.bottom)));
712+ /* We don't want to change the size of the window the first time we
713+ * decorate it, but we do thereafter */
714+ if (priv->alreadyDecorated)
715+ {
716+ sizeDelta.setWidth (-((b->left + b->right) -
717+ (priv->border.left + priv->border.right)));
718+ sizeDelta.setHeight (-((b->top + b->bottom) -
719+ (priv->border.top + priv->border.bottom)));
720+ }
721+ else
722+ priv->alreadyDecorated = true;
723
724 priv->serverInput = *i;
725 priv->border = *b;

Subscribers

People subscribed via source and target branches

to all changes: