Merge lp:~ken-vandine/compiz/0.9.9.fix_1165343 into lp:compiz/0.9.9

Proposed by Ken VanDine
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3652
Merged at revision: 3650
Proposed branch: lp:~ken-vandine/compiz/0.9.9.fix_1165343
Merge into: lp:compiz/0.9.9
Diff against target: 493 lines (+102/-312)
5 files modified
debian/changelog (+9/-0)
plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h (+0/-6)
plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp (+5/-62)
plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp (+58/-235)
plugins/place/src/place.cpp (+30/-9)
To merge this branch: bzr merge lp:~ken-vandine/compiz/0.9.9.fix_1165343
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sam Spilsbury Approve
Łukasz Zemczak Approve
Review via email: mp+159412@code.launchpad.net

Commit message

Revert 3636 from lp:compiz/0.9.9 to fix Qt apps getting window decorations placed behind the panel. (LP: #1165343)
 * This reintroduces bug 1159324, Guake window appears placed by offset non-existent decoration

Description of the change

Revert 3636 from lp:compiz/0.9.9 to fix Qt apps getting window decorations placed behind the panel. (LP: #1165343)
 * This reintroduces bug 1159324, Guake window appears placed by offset non-existent decoration

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Base revert LGTM. +1

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Lets do this for now - I have an idea on how to handle this problem but it needs time for QA.

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Actually, back to NR, kenvandine needs to remove the visible check.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

and back.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

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-04-15 04:17:29 +0000
3+++ debian/changelog 2013-04-17 16:04:25 +0000
4@@ -1,3 +1,12 @@
5+compiz (1:0.9.9~daily13.04.15-0ubuntu2) UNRELEASED; urgency=low
6+
7+ * Revert 3636 from lp:compiz/0.9.9 to fix Qt apps getting window decorations
8+ placed behind the panel. (LP: #1165343)
9+ - This reintroduces bug 1159324, Guake window appears placed by offset
10+ non-existent decoration
11+
12+ -- Ken VanDine <ken.vandine@canonical.com> Wed, 17 Apr 2013 09:37:57 -0400
13+
14 compiz (1:0.9.9~daily13.04.15-0ubuntu1) raring; urgency=low
15
16 [ Łukasz 'sil2100' Zemczak ]
17
18=== modified file 'plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h'
19--- plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h 2013-03-24 05:51:41 +0000
20+++ plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h 2013-04-17 16:04:25 +0000
21@@ -41,12 +41,6 @@
22 const CompWindowExtents &border,
23 unsigned int flags,
24 const CompSize &screenSize);
25-
26-CompPoint & constrainPositionToWorkArea (CompPoint &pos,
27- const compiz::window::Geometry &serverGeometry,
28- const CompWindowExtents &border,
29- const CompRect &workArea,
30- bool staticGravity);
31 }
32 }
33
34
35=== modified file 'plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp'
36--- plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp 2013-03-24 05:51:41 +0000
37+++ plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp 2013-04-17 16:04:25 +0000
38@@ -31,15 +31,12 @@
39 }
40 }
41
42-namespace cp = compiz::place;
43-namespace cw = compiz::window;
44-
45 void
46-cp::clampGeometryToWorkArea (cw::Geometry &g,
47- const CompRect &workArea,
48- const CompWindowExtents &border,
49- unsigned int flags,
50- const CompSize &screenSize)
51+compiz::place::clampGeometryToWorkArea (compiz::window::Geometry &g,
52+ const CompRect &workArea,
53+ const CompWindowExtents &border,
54+ unsigned int flags,
55+ const CompSize &screenSize)
56 {
57 int x, y, left, right, bottom, top;
58
59@@ -137,57 +134,3 @@
60 g.setY (g.y () + top - y);
61 }
62 }
63-
64-CompPoint &
65-cp::constrainPositionToWorkArea (CompPoint &pos,
66- const cw::Geometry &serverGeometry,
67- const CompWindowExtents &border,
68- const CompRect &workArea,
69- bool staticGravity)
70-{
71- CompWindowExtents extents;
72- int delta;
73-
74- CompWindowExtents effectiveBorders = border;
75-
76- /* Ignore borders in the StaticGravity case for placement
77- * because the window intended to be placed as if it didn't
78- * have them */
79- if (staticGravity)
80- {
81- effectiveBorders.left = 0;
82- effectiveBorders.right = 0;
83- effectiveBorders.top = 0;
84- effectiveBorders.bottom = 0;
85- }
86-
87- extents.left = pos.x () - effectiveBorders.left;
88- extents.top = pos.y () - effectiveBorders.top;
89- extents.right = extents.left + serverGeometry.widthIncBorders () +
90- (effectiveBorders.left +
91- effectiveBorders.right);
92- extents.bottom = extents.top + serverGeometry.heightIncBorders () +
93- (effectiveBorders.top +
94- effectiveBorders.bottom);
95-
96- delta = workArea.right () - extents.right;
97- if (delta < 0)
98- extents.left += delta;
99-
100- delta = workArea.left () - extents.left;
101- if (delta > 0)
102- extents.left += delta;
103-
104- delta = workArea.bottom () - extents.bottom;
105- if (delta < 0)
106- extents.top += delta;
107-
108- delta = workArea.top () - extents.top;
109- if (delta > 0)
110- extents.top += delta;
111-
112- pos.setX (extents.left + effectiveBorders.left);
113- pos.setY (extents.top + effectiveBorders.top);
114-
115- return pos;
116-}
117
118=== modified file 'plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp'
119--- plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp 2013-03-24 05:51:41 +0000
120+++ plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp 2013-04-17 16:04:25 +0000
121@@ -23,258 +23,81 @@
122 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
123 */
124
125-#include <tr1/tuple>
126 #include <test-constrain-to-workarea.h>
127 #include <constrain-to-workarea.h>
128 #include <iostream>
129 #include <stdlib.h>
130 #include <cstring>
131
132-namespace cw = compiz::window;
133-namespace cwe = cw::extents;
134-namespace cp = compiz::place;
135-
136-using ::testing::WithParamInterface;
137-using ::testing::ValuesIn;
138-using ::testing::Combine;
139-
140-class PlaceClampGeometryToWorkArea :
141+class CompPlaceTestConstrainToWorkarea :
142 public CompPlaceTest
143 {
144- public:
145-
146- PlaceClampGeometryToWorkArea () :
147- screensize (1000, 2000),
148- workArea (50, 50, 900, 1900),
149- flags (0)
150- {
151- memset (&extents, 0, sizeof (cwe::Extents));
152- }
153-
154- protected:
155-
156- CompSize screensize;
157- CompRect workArea;
158- cw::Geometry g;
159- cwe::Extents extents;
160- unsigned int flags;
161 };
162
163-namespace
164-{
165- const cw::Geometry LimitOfAllowedGeometry (50, 50, 900, 1900, 0);
166-}
167-
168-namespace compiz
169-{
170-namespace window
171-{
172-std::ostream & operator<<(std::ostream &os, const Geometry &g)
173-{
174- return os << "Window Geometry: (" << g.x () <<
175- ", " << g.y () <<
176- ", " << g.width () <<
177- ", " << g.height () <<
178- ", " << g.border () << ")";
179-}
180-namespace extents
181-{
182-std::ostream & operator<<(std::ostream &os, const Extents &e)
183-{
184- return os << "Window Extents: (left: " << e.left <<
185- ", right: " << e.right <<
186- ", top: " << e.top <<
187- ", bottom: " << e.bottom << ")";
188-}
189-}
190-}
191-}
192-
193-std::ostream & operator<<(std::ostream &os, const CompPoint &p)
194-{
195- return os << "Point: (" << p.x () << ", " << p.y () << ")";
196-}
197-
198-TEST_F (PlaceClampGeometryToWorkArea, NoConstrainmentRequired)
199-{
200- g = cw::Geometry (100, 100, 200, 200, 0);
201+TEST_F(CompPlaceTestConstrainToWorkarea, TestConstrainToWorkarea)
202+{
203+ CompSize screensize (1000, 2000);
204+ CompRect workArea (50, 50, 900, 1900);
205+ compiz::window::Geometry g (100, 100, 200, 200, 0);
206+ compiz::window::extents::Extents extents;
207+ unsigned int flags = 0;
208+
209+ memset (&extents, 0, sizeof (compiz::window::extents::Extents));
210
211 /* Do nothing */
212- cp::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
213-
214- EXPECT_EQ (g, cw::Geometry (100, 100, 200, 200, 0));
215-}
216-
217-TEST_F (PlaceClampGeometryToWorkArea, LargerThanWorkAreaConstrainsToWorkAreaSize)
218-{
219+ compiz::place::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
220+
221+ EXPECT_EQ (g, compiz::window::Geometry (100, 100, 200, 200, 0));
222+
223 /* Larger than workArea */
224- g = cw::Geometry (50, 50, 950, 1950, 0);
225-
226- cp::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
227-
228- EXPECT_EQ (g, LimitOfAllowedGeometry);
229-}
230-
231-TEST_F (PlaceClampGeometryToWorkArea, OutsideTopLeftConstrainment)
232-{
233+ g = compiz::window::Geometry (50, 50, 950, 1950, 0);
234+
235+ compiz::place::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
236+
237+ EXPECT_EQ (g, compiz::window::Geometry (50, 50, 900, 1900, 0));
238+
239 /* Outside top left */
240- g = cw::Geometry (0, 0, 900, 1900, 0);
241-
242- cp::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
243-
244- EXPECT_EQ (g, LimitOfAllowedGeometry);
245-}
246-
247-TEST_F (PlaceClampGeometryToWorkArea, OutsideTopRightConstrainment)
248-{
249+ g = compiz::window::Geometry (0, 0, 900, 1900, 0);
250+
251+ compiz::place::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
252+
253+ EXPECT_EQ (g, compiz::window::Geometry (50, 50, 900, 1900, 0));
254+
255 /* Outside top right */
256- g = cw::Geometry (100, 0, 900, 1900, 0);
257-
258- cp::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
259-
260- EXPECT_EQ (g, LimitOfAllowedGeometry);
261-}
262-
263-TEST_F (PlaceClampGeometryToWorkArea, OutsideBottomLeftConstrainment)
264-{
265+ g = compiz::window::Geometry (100, 0, 900, 1900, 0);
266+
267+ compiz::place::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
268+
269+ EXPECT_EQ (g, compiz::window::Geometry (50, 50, 900, 1900, 0));
270+
271 /* Outside bottom left */
272- g = cw::Geometry (0, 100, 900, 1900, 0);
273-
274- cp::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
275-
276- EXPECT_EQ (g, LimitOfAllowedGeometry);
277-}
278-
279-TEST_F (PlaceClampGeometryToWorkArea, OutsideBottomRightConstrainment)
280-{
281+ g = compiz::window::Geometry (0, 100, 900, 1900, 0);
282+
283+ compiz::place::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
284+
285+ EXPECT_EQ (g, compiz::window::Geometry (50, 50, 900, 1900, 0));
286+
287 /* Outside bottom right */
288- g = cw::Geometry (100, 100, 900, 1900, 0);
289-
290- cp::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
291-
292- EXPECT_EQ (g, LimitOfAllowedGeometry);
293-}
294-
295-TEST_F (PlaceClampGeometryToWorkArea, NoChangePositionIfSizeUnchanged)
296-{
297+ g = compiz::window::Geometry (100, 100, 900, 1900, 0);
298+
299+ compiz::place::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
300+
301+ EXPECT_EQ (g, compiz::window::Geometry (50, 50, 900, 1900, 0));
302+
303 /* For the size only case, we should not
304 * change the position of the window if
305 * the size does not change */
306- g = cw::Geometry (0, 0, 900, 1900, 0);
307- flags = cp::clampGeometrySizeOnly;
308-
309- cp::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
310-
311- EXPECT_EQ (g, cw::Geometry (0, 0, 900, 1900, 0));
312-}
313-
314-TEST_F (PlaceClampGeometryToWorkArea, ChangePositionIfSizeChanged)
315-{
316- g = cw::Geometry (0, 0, 1000, 2000, 0);
317- flags = cp::clampGeometrySizeOnly;
318-
319- cp::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
320-
321- EXPECT_EQ (g, LimitOfAllowedGeometry);
322-}
323-
324-namespace
325-{
326-typedef std::tr1::tuple <cw::Geometry, cwe::Extents> ConstrainPositionToWorkAreaParam;
327-
328-const cw::Geometry & WindowGeometry (const ConstrainPositionToWorkAreaParam &p)
329-{
330- return std::tr1::get <0> (p);
331-}
332-
333-const cwe::Extents & WindowExtents (const ConstrainPositionToWorkAreaParam &p)
334-{
335- return std::tr1::get <1> (p);
336-}
337-
338-CompPoint InitialPosition (const ConstrainPositionToWorkAreaParam &p)
339-{
340- /* Initial position is where the window is right now */
341- return (std::tr1::get <0> (p)).pos ();
342-}
343-
344-const CompRect WArea (50, 50, 900, 1900);
345-const CompPoint ExpectedPosition (WArea.pos ());
346-}
347-
348-class PlaceConstrainPositionToWorkArea :
349- public CompPlaceTest,
350- public WithParamInterface <ConstrainPositionToWorkAreaParam>
351-{
352- public:
353-
354- PlaceConstrainPositionToWorkArea ()
355- {
356- memset (&extents, 0, sizeof (cwe::Extents));
357- }
358-
359- protected:
360-
361- CompRect workArea;
362- cw::Geometry g;
363- cwe::Extents extents;
364-};
365-
366-TEST_P (PlaceConstrainPositionToWorkArea, PositionConstrainedWithExtents)
367-{
368- g = WindowGeometry (GetParam ());
369- extents = WindowExtents (GetParam ());
370-
371- CompPoint pos = InitialPosition (GetParam ());
372- pos = cp::constrainPositionToWorkArea (pos, g, extents, WArea, false);
373-
374- const CompPoint expectedAfterExtentsAdjustment = ExpectedPosition +
375- CompPoint (extents.left,
376- extents.top);
377-
378- EXPECT_EQ (expectedAfterExtentsAdjustment, pos);
379-}
380-
381-TEST_P (PlaceConstrainPositionToWorkArea, PositionConstrainedStaticGravity)
382-{
383- g = WindowGeometry (GetParam ());
384- extents = WindowExtents (GetParam ());
385-
386- CompPoint pos = InitialPosition (GetParam ());
387- pos = cp::constrainPositionToWorkArea (pos, g, extents, WArea, true);
388-
389- /* Do not adjust residual position for extents with windows
390- * that have a static gravity */
391- EXPECT_EQ (ExpectedPosition, pos);
392-}
393-
394-namespace
395-{
396-cwe::Extents PossibleExtents[] =
397-{
398- cwe::Extents (0, 0, 0, 0),
399- cwe::Extents (1, 0, 0, 0),
400- cwe::Extents (0, 1, 0, 0),
401- cwe::Extents (0, 0, 1, 0),
402- cwe::Extents (0, 0, 0, 1)
403-};
404-
405-cw::Geometry PossibleGeometries[] =
406-{
407- cw::Geometry (WArea.x (), WArea.y (),
408- WArea.width (), WArea.height (), 0),
409- cw::Geometry (WArea.x () - 1, WArea.y (),
410- WArea.width (), WArea.height (), 0),
411- cw::Geometry (WArea.x (), WArea.y () - 1,
412- WArea.width (), WArea.height (), 0),
413- cw::Geometry (WArea.x () + 1, WArea.y (),
414- WArea.width (), WArea.height (), 0),
415- cw::Geometry (WArea.x (), WArea.y () + 1,
416- WArea.width (), WArea.height (), 0)
417-};
418-}
419-
420-INSTANTIATE_TEST_CASE_P (PlacementData,
421- PlaceConstrainPositionToWorkArea,
422- Combine (ValuesIn (PossibleGeometries),
423- ValuesIn (PossibleExtents)));
424+ g = compiz::window::Geometry (0, 0, 900, 1900, 0);
425+ flags = compiz::place::clampGeometrySizeOnly;
426+
427+ compiz::place::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
428+
429+ EXPECT_EQ (g, compiz::window::Geometry (0, 0, 900, 1900, 0));
430+
431+ g = compiz::window::Geometry (0, 0, 1000, 2000, 0);
432+ flags = compiz::place::clampGeometrySizeOnly;
433+
434+ compiz::place::clampGeometryToWorkArea (g, workArea, extents, flags, screensize);
435+
436+ EXPECT_EQ (g, compiz::window::Geometry (50, 50, 900, 1900, 0));
437+}
438
439=== modified file 'plugins/place/src/place.cpp'
440--- plugins/place/src/place.cpp 2013-04-08 06:27:38 +0000
441+++ plugins/place/src/place.cpp 2013-04-17 16:04:25 +0000
442@@ -24,8 +24,6 @@
443
444 COMPIZ_PLUGIN_20090315 (place, PlacePluginVTable)
445
446-namespace cp = compiz::place;
447-
448 #define XWINDOWCHANGES_INIT {0, 0, 0, 0, 0, None, 0}
449
450 PlaceScreen::PlaceScreen (CompScreen *screen) :
451@@ -1207,13 +1205,36 @@
452 PlaceWindow::constrainToWorkarea (const CompRect &workArea,
453 CompPoint &pos)
454 {
455- bool staticGravity = window->sizeHints ().win_gravity & StaticGravity;
456-
457- pos = cp::constrainPositionToWorkArea (pos,
458- window->serverGeometry (),
459- window->border (),
460- workArea,
461- staticGravity);
462+ CompWindowExtents extents;
463+ int delta;
464+
465+ extents.left = pos.x () - window->border ().left;
466+ extents.top = pos.y () - window->border ().top;
467+ extents.right = extents.left + window->serverGeometry ().widthIncBorders () +
468+ (window->border ().left +
469+ window->border ().right);
470+ extents.bottom = extents.top + window->serverGeometry ().heightIncBorders () +
471+ (window->border ().top +
472+ window->border ().bottom);
473+
474+ delta = workArea.right () - extents.right;
475+ if (delta < 0)
476+ extents.left += delta;
477+
478+ delta = workArea.left () - extents.left;
479+ if (delta > 0)
480+ extents.left += delta;
481+
482+ delta = workArea.bottom () - extents.bottom;
483+ if (delta < 0)
484+ extents.top += delta;
485+
486+ delta = workArea.top () - extents.top;
487+ if (delta > 0)
488+ extents.top += delta;
489+
490+ pos.setX (extents.left + window->border ().left);
491+ pos.setY (extents.top + window->border ().top);
492
493 }
494

Subscribers

People subscribed via source and target branches