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

Proposed by Sam Spilsbury
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3735
Merged at revision: 3736
Proposed branch: lp:~compiz-team/compiz/compiz.revert_3728
Merge into: lp:compiz/0.9.10
Diff against target: 648 lines (+158/-179)
10 files modified
.bzrignore (+0/-1)
plugins/decor/src/decor.cpp (+38/-78)
plugins/decor/src/decor.h (+0/-6)
plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h (+6/-3)
plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp (+49/-25)
plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp (+57/-4)
plugins/place/src/place.cpp (+8/-3)
src/window/extents/src/windowextents.cpp (+0/-10)
tests/manual/README.txt (+0/-9)
tests/manual/plugins/decor.txt (+0/-40)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.revert_3728
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
MC Return Abstain
Brandon Schaefer (community) Approve
Review via email: mp+167894@code.launchpad.net

Commit message

Revert revision 3278.

Description of the change

Revert revision 3278.

It isn't quite ready yet.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Alright, reverting!

review: Approve
Revision history for this message
MC Return (mc-return) wrote :

What about Sam's "It isn't quite ready yet." comment ?

review: Needs Information
Revision history for this message
MC Return (mc-return) wrote :

Setting to "On Hold"/"WIP" until Sam has verified that this is ready...

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Hmm I thought he was talking about the branch that was r3278 was not ready, hence why he wanted to revert it?

Revision history for this message
MC Return (mc-return) wrote :

Ah yes, maybe you are right -> I am not sure though...

review: Abstain
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Haha, yeah now im not 100% sure either, soo ill just wait for Sam to come around and global approve it :)

Revision history for this message
MC Return (mc-return) wrote :

+1

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)
Revision history for this message
MC Return (mc-return) wrote :

Oh, the misunderstanding was on my side. Sorry... ;)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file '.bzrignore'
--- .bzrignore 2013-05-26 06:01:34 +0000
+++ .bzrignore 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
1.bzr-repo
20
=== modified file 'plugins/decor/src/decor.cpp'
--- plugins/decor/src/decor.cpp 2013-05-20 15:26:11 +0000
+++ plugins/decor/src/decor.cpp 2013-06-07 06:12:28 +0000
@@ -1165,8 +1165,6 @@
11651165
1166 xwc.x += w->serverGeometry ().x ();1166 xwc.x += w->serverGeometry ().x ();
1167 xwc.y += w->serverGeometry ().y ();1167 xwc.y += w->serverGeometry ().y ();
1168 xwc.width += w->serverGeometry ().width ();
1169 xwc.height += w->serverGeometry ().height ();
11701168
1171 w->configureXWindow (mask, &xwc);1169 w->configureXWindow (mask, &xwc);
1172 screen->handleCompizEvent ("decor", "window_decorated", o);1170 screen->handleCompizEvent ("decor", "window_decorated", o);
@@ -1511,68 +1509,38 @@
15111509
1512void1510void
1513DecorWindow::moveDecoratedWindowBy (const CompPoint &movement,1511DecorWindow::moveDecoratedWindowBy (const CompPoint &movement,
1514 const CompSize &sizeDelta,
1515 bool instant)1512 bool instant)
1516{1513{
1517 /* movement and sizeDelta are the shift of the client window1514 /* Need to actually move the window */
1518 * as a result of decoration from a theoretical neutral position,1515 if (window->placed () && !window->overrideRedirect () &&
1519 * lastShift and lastSizeDelta are the last recorded shift 1516 (movement.x () || movement.y ()))
1520 * and size-change. The true difference between two decorations
1521 * is movement - lastShift, sizeDelta - sizeDelta */
1522
1523 int dx = movement.x () - lastShift.x ();
1524 int dy = movement.y () - lastShift.y ();
1525 int dwidth = sizeDelta.width () - lastSizeDelta.height ();
1526 int dheight = sizeDelta.height () - lastSizeDelta.height ();
1527
1528 /* We don't apply these rules to override-redirect windows
1529 * and we need to check that both the position and of the window
1530 * would change as a result of decoration in order to move it
1531 * (this is usually the case because as a window is decorated
1532 * it will necessarily get bigger or smaller in order to fit
1533 * inside its decoration) */
1534 if (!window->overrideRedirect () &&
1535 ((dx || dy) && (dwidth || dheight)))
1536 {1517 {
1537 XWindowChanges xwc;1518 XWindowChanges xwc;
1538 unsigned int mask = CWX | CWY | CWWidth | CWHeight;1519 unsigned int mask = CWX | CWY;
15391520
1540 memset (&xwc, 0, sizeof (XWindowChanges));1521 memset (&xwc, 0, sizeof (XWindowChanges));
15411522
1542 /* Grab the geometry last sent to server at configureXWindow1523 /* Grab the geometry last sent to server at configureXWindow
1543 * time and not here since serverGeometry may be updated by1524 * time and not here since serverGeometry may be updated by
1544 * the time that we do call configureXWindow */1525 * the time that we do call configureXWindow */
1545 xwc.x = dx;1526 xwc.x = movement.x ();
1546 xwc.y = dy;1527 xwc.y = movement.y ();
1547 xwc.width = dwidth;
1548 xwc.height = dheight;
15491528
1550 /* Except if it's fullscreen, maximized or such */1529 /* Except if it's fullscreen, maximized or such */
1551 if (window->state () & CompWindowStateFullscreenMask)1530 if (window->state () & CompWindowStateFullscreenMask)
1552 mask &= ~(CWX | CWY | CWWidth | CWHeight);1531 mask &= ~(CWX | CWY);
15531532
1554 if (window->state () & CompWindowStateMaximizedHorzMask)1533 if (window->state () & CompWindowStateMaximizedHorzMask)
1555 mask &= ~(CWX | CWWidth);1534 mask &= ~CWX;
15561535
1557 if (window->state () & CompWindowStateMaximizedVertMask)1536 if (window->state () & CompWindowStateMaximizedVertMask)
1558 mask &= ~(CWY | CWHeight);1537 mask &= ~CWY;
15591538
1560 if (window->saveMask () & CWX)1539 if (window->saveMask () & CWX)
1561 window->saveWc ().x += xwc.x;1540 window->saveWc ().x += movement.x ();
15621541
1563 if (window->saveMask () & CWY)1542 if (window->saveMask () & CWY)
1564 window->saveWc ().y += xwc.y;1543 window->saveWc ().y += movement.y ();
1565
1566 if (window->saveMask () & CWWidth)
1567 window->saveWc ().width += xwc.width;
1568
1569 if (window->saveMask () & CWHeight)
1570 window->saveWc ().height += xwc.height;
1571
1572 /* If the window has not been placed, do not move it this time
1573 * but record what we would have moved it by */
1574 if (!window->placed ())
1575 mask = 0;
15761544
1577 if (mask)1545 if (mask)
1578 {1546 {
@@ -1590,15 +1558,6 @@
1590 else1558 else
1591 moveUpdate.start (boost::bind (decorOffsetMove, window, xwc, mask), 0);1559 moveUpdate.start (boost::bind (decorOffsetMove, window, xwc, mask), 0);
1592 }1560 }
1593
1594 /* Even if the window has not yet been placed, we still
1595 * need to store what we would have moved it by in order
1596 * to put it in the right position. The place plugin will
1597 * set a position that makes the most sense, but we need
1598 * to know how much to move back by should the window
1599 * become undecorated again */
1600 lastShift = movement;
1601 lastSizeDelta = sizeDelta;
1602 }1561 }
1603}1562}
16041563
@@ -1609,9 +1568,9 @@
1609 bool shadowOnly,1568 bool shadowOnly,
1610 bool isSwitcher)1569 bool isSwitcher)
1611{1570{
1612 const bool frameOrUnmapReference = (w->frame () ||1571 const bool visible = (w->frame () ||
1613 w->hasUnmapReference ());1572 w->hasUnmapReference ());
1614 const bool realDecoration = frameOrUnmapReference && !shadowOnly;1573 const bool realDecoration = visible && !shadowOnly;
1615 const bool forceDecoration = isSwitcher;1574 const bool forceDecoration = isSwitcher;
16161575
1617 return realDecoration || forceDecoration;1576 return realDecoration || forceDecoration;
@@ -1657,8 +1616,7 @@
1657DecorWindow::update (bool allowDecoration)1616DecorWindow::update (bool allowDecoration)
1658{1617{
1659 Decoration::Ptr old, decoration;1618 Decoration::Ptr old, decoration;
1660 CompPoint movement;1619 CompPoint oldShift, movement;
1661 CompSize sizeDelta;
16621620
1663 if (wd)1621 if (wd)
1664 old = wd->decor;1622 old = wd->decor;
@@ -1692,9 +1650,13 @@
1692 if (decoration == old)1650 if (decoration == old)
1693 return false;1651 return false;
16941652
1695 /* Destroy the old WindowDecoration */1653 /* Determine how much we moved the window for the old
1654 * decoration and save that, also destroy the old
1655 * WindowDecoration */
1696 if (old)1656 if (old)
1697 {1657 {
1658 oldShift = cwe::shift (window->border (), window->sizeHints ().win_gravity);
1659
1698 WindowDecoration::destroy (wd);1660 WindowDecoration::destroy (wd);
1699 wd = NULL;1661 wd = NULL;
1700 }1662 }
@@ -1716,6 +1678,7 @@
1716 else if (!window->hasUnmapReference ())1678 else if (!window->hasUnmapReference ())
1717 window->setWindowFrameExtents (&decoration->border,1679 window->setWindowFrameExtents (&decoration->border,
1718 &decoration->input);1680 &decoration->input);
1681
1719 /* This window actually needs its decoration contents updated1682 /* This window actually needs its decoration contents updated
1720 * as it was actually visible */1683 * as it was actually visible */
1721 if (decorate ||1684 if (decorate ||
@@ -1732,11 +1695,7 @@
1732 }1695 }
17331696
1734 movement = cwe::shift (window->border (), window->sizeHints ().win_gravity);1697 movement = cwe::shift (window->border (), window->sizeHints ().win_gravity);
17351698 movement -= oldShift;
1736 sizeDelta = CompSize (-(window->border ().left +
1737 window->border ().right),
1738 -(window->border ().top +
1739 window->border ().bottom));
17401699
1741 window->updateWindowOutputExtents ();1700 window->updateWindowOutputExtents ();
17421701
@@ -1765,6 +1724,8 @@
1765 memset (&emptyExtents, 0, sizeof (CompWindowExtents));1724 memset (&emptyExtents, 0, sizeof (CompWindowExtents));
17661725
1767 window->setWindowFrameExtents (&emptyExtents, &emptyExtents);1726 window->setWindowFrameExtents (&emptyExtents, &emptyExtents);
1727
1728 movement -= oldShift;
1768 }1729 }
17691730
1770 /* We need to damage the current output extents1731 /* We need to damage the current output extents
@@ -1778,7 +1739,6 @@
1778 }1739 }
17791740
1780 moveDecoratedWindowBy (movement,1741 moveDecoratedWindowBy (movement,
1781 sizeDelta,
1782 !allowDecoration);1742 !allowDecoration);
17831743
1784 return true;1744 return true;
@@ -2320,20 +2280,6 @@
2320}2280}
23212281
2322/*2282/*
2323 * DecorWindow::place
2324 *
2325 * Update any windows just before placement
2326 * so that placement algorithms will have the
2327 * border size at place-time
2328 */
2329bool
2330DecorWindow::place (CompPoint &pos)
2331{
2332 update (true);
2333 return window->place (pos);
2334}
2335
2336/*
2337 * DecorWindow::windowNotify2283 * DecorWindow::windowNotify
2338 *2284 *
2339 * Window event notification handler. On various2285 * Window event notification handler. On various
@@ -3011,6 +2957,9 @@
3011{2957{
3012 if (wd && wd->decor)2958 if (wd && wd->decor)
3013 {2959 {
2960 CompPoint oldShift = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity);
2961
2962
3014 if ((window->state () & MAXIMIZE_STATE))2963 if ((window->state () & MAXIMIZE_STATE))
3015 window->setWindowFrameExtents (&wd->decor->maxBorder,2964 window->setWindowFrameExtents (&wd->decor->maxBorder,
3016 &wd->decor->maxInput);2965 &wd->decor->maxInput);
@@ -3018,7 +2967,18 @@
3018 window->setWindowFrameExtents (&wd->decor->border,2967 window->setWindowFrameExtents (&wd->decor->border,
3019 &wd->decor->input);2968 &wd->decor->input);
30202969
3021 /* The shift will occurr in decorOffsetMove */2970 /* Since we immediately update the frame extents, we must
2971 * also update the stored saved window geometry in order
2972 * to prevent the window from shifting back too far once
2973 * unmaximized */
2974
2975 CompPoint movement = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity) - oldShift;
2976
2977 if (window->saveMask () & CWX)
2978 window->saveWc ().x += movement.x ();
2979
2980 if (window->saveMask () & CWY)
2981 window->saveWc ().y += movement.y ();
30222982
3023 updateFrame ();2983 updateFrame ();
3024 }2984 }
30252985
=== modified file 'plugins/decor/src/decor.h'
--- plugins/decor/src/decor.h 2013-04-17 23:41:09 +0000
+++ plugins/decor/src/decor.h 2013-06-07 06:12:28 +0000
@@ -293,8 +293,6 @@
293293
294 bool damageRect (bool, const CompRect &);294 bool damageRect (bool, const CompRect &);
295295
296 bool place (CompPoint &pos);
297
298 bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &,296 bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &,
299 const CompRegion &, unsigned int);297 const CompRegion &, unsigned int);
300 void glDecorate (const GLMatrix &, const GLWindowPaintAttrib &,298 void glDecorate (const GLMatrix &, const GLWindowPaintAttrib &,
@@ -382,16 +380,12 @@
382380
383 X11DecorPixmapRequestor mRequestor;381 X11DecorPixmapRequestor mRequestor;
384382
385 CompPoint lastShift;
386 CompSize lastSizeDelta;
387
388 private:383 private:
389384
390 bool bareDecorationOnly ();385 bool bareDecorationOnly ();
391 Decoration::Ptr findRealDecoration ();386 Decoration::Ptr findRealDecoration ();
392 Decoration::Ptr findBareDecoration ();387 Decoration::Ptr findBareDecoration ();
393 void moveDecoratedWindowBy (const CompPoint &movement,388 void moveDecoratedWindowBy (const CompPoint &movement,
394 const CompSize &sizeDelta,
395 bool instant);389 bool instant);
396};390};
397391
398392
=== modified file 'plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h'
--- plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h 2013-04-17 23:41:09 +0000
+++ plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h 2013-06-07 06:12:28 +0000
@@ -45,7 +45,8 @@
45CompPoint & constrainPositionToWorkArea (CompPoint &pos,45CompPoint & constrainPositionToWorkArea (CompPoint &pos,
46 const compiz::window::Geometry &serverGeometry,46 const compiz::window::Geometry &serverGeometry,
47 const CompWindowExtents &border,47 const CompWindowExtents &border,
48 const CompRect &workArea);48 const CompRect &workArea,
49 bool staticGravity);
4950
5051
51CompPoint getViewportRelativeCoordinates (const compiz::window::Geometry &geom,52CompPoint getViewportRelativeCoordinates (const compiz::window::Geometry &geom,
@@ -53,7 +54,8 @@
5354
54CompWindowExtents getWindowEdgePositions (const CompPoint &position,55CompWindowExtents getWindowEdgePositions (const CompPoint &position,
55 const compiz::window::Geometry &geom,56 const compiz::window::Geometry &geom,
56 const CompWindowExtents &border);57 const CompWindowExtents &border,
58 unsigned int gravity);
5759
58void clampHorizontalEdgePositionsToWorkArea (CompWindowExtents &edgePositions,60void clampHorizontalEdgePositionsToWorkArea (CompWindowExtents &edgePositions,
59 const CompRect &workArea);61 const CompRect &workArea);
@@ -62,7 +64,8 @@
6264
63void subtractBordersFromEdgePositions (CompWindowExtents &edgePositions,65void subtractBordersFromEdgePositions (CompWindowExtents &edgePositions,
64 const CompWindowExtents &border,66 const CompWindowExtents &border,
65 unsigned int legacyBorder);67 unsigned int legacyBorder,
68 unsigned int gravity);
6669
67bool onlySizeChanged (unsigned int mask);70bool onlySizeChanged (unsigned int mask);
68bool applyWidthChange (const CompWindowExtents &edgePositions,71bool applyWidthChange (const CompWindowExtents &edgePositions,
6972
=== modified file 'plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp'
--- plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp 2013-04-17 23:41:09 +0000
+++ plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp 2013-06-07 06:12:28 +0000
@@ -140,21 +140,35 @@
140140
141CompPoint &141CompPoint &
142cp::constrainPositionToWorkArea (CompPoint &pos,142cp::constrainPositionToWorkArea (CompPoint &pos,
143 const cw::Geometry &serverGeometry,143 const cw::Geometry &serverGeometry,
144 const CompWindowExtents &border,144 const CompWindowExtents &border,
145 const CompRect &workArea)145 const CompRect &workArea,
146 bool staticGravity)
146{147{
147 CompWindowExtents extents;148 CompWindowExtents extents;
148 int delta;149 int delta;
149150
150 extents.left = pos.x () - border.left;151 CompWindowExtents effectiveBorders = border;
151 extents.top = pos.y () - border.top;152
153 /* Ignore borders in the StaticGravity case for placement
154 * because the window intended to be placed as if it didn't
155 * have them */
156 if (staticGravity)
157 {
158 effectiveBorders.left = 0;
159 effectiveBorders.right = 0;
160 effectiveBorders.top = 0;
161 effectiveBorders.bottom = 0;
162 }
163
164 extents.left = pos.x () - effectiveBorders.left;
165 extents.top = pos.y () - effectiveBorders.top;
152 extents.right = extents.left + serverGeometry.widthIncBorders () +166 extents.right = extents.left + serverGeometry.widthIncBorders () +
153 (border.left +167 (effectiveBorders.left +
154 border.right);168 effectiveBorders.right);
155 extents.bottom = extents.top + serverGeometry.heightIncBorders () +169 extents.bottom = extents.top + serverGeometry.heightIncBorders () +
156 (border.top +170 (effectiveBorders.top +
157 border.bottom);171 effectiveBorders.bottom);
158172
159 delta = workArea.right () - extents.right;173 delta = workArea.right () - extents.right;
160 if (delta < 0)174 if (delta < 0)
@@ -172,8 +186,8 @@
172 if (delta > 0)186 if (delta > 0)
173 extents.top += delta;187 extents.top += delta;
174188
175 pos.setX (extents.left + border.left);189 pos.setX (extents.left + effectiveBorders.left);
176 pos.setY (extents.top + border.top);190 pos.setY (extents.top + effectiveBorders.top);
177191
178 return pos;192 return pos;
179}193}
@@ -199,18 +213,23 @@
199213
200CompWindowExtents cp::getWindowEdgePositions (const CompPoint &position,214CompWindowExtents cp::getWindowEdgePositions (const CompPoint &position,
201 const cw::Geometry &geom,215 const cw::Geometry &geom,
202 const CompWindowExtents &border)216 const CompWindowExtents &border,
217 unsigned int gravity)
203{218{
204 CompWindowExtents edgePositions;219 CompWindowExtents edgePositions;
205220 CompWindowExtents effectiveBorder (border);
206 edgePositions.left = position.x () - border.left;221
222 if (gravity & StaticGravity)
223 effectiveBorder = CompWindowExtents (0, 0, 0, 0);
224
225 edgePositions.left = position.x () - effectiveBorder.left;
207 edgePositions.right = edgePositions.left +226 edgePositions.right = edgePositions.left +
208 geom.widthIncBorders () + (border.left +227 geom.widthIncBorders () + (effectiveBorder.left +
209 border.right);228 effectiveBorder.right);
210 edgePositions.top = position.y () - border.top;229 edgePositions.top = position.y () - effectiveBorder.top;
211 edgePositions.bottom = edgePositions.top +230 edgePositions.bottom = edgePositions.top +
212 geom.heightIncBorders () + (border.top +231 geom.heightIncBorders () + (effectiveBorder.top +
213 border.bottom);232 effectiveBorder.bottom);
214233
215 return edgePositions;234 return edgePositions;
216}235}
@@ -266,14 +285,19 @@
266285
267void cp::subtractBordersFromEdgePositions (CompWindowExtents &edgePositions,286void cp::subtractBordersFromEdgePositions (CompWindowExtents &edgePositions,
268 const CompWindowExtents &border,287 const CompWindowExtents &border,
269 unsigned int legacyBorder)288 unsigned int legacyBorder,
289 unsigned int gravity)
270{290{
271 const unsigned int doubleBorder = 2 * legacyBorder;291 const unsigned int doubleBorder = 2 * legacyBorder;
272292 CompWindowExtents effectiveBorder = border;
273 edgePositions.left += border.left;293
274 edgePositions.right -= border.right + doubleBorder;294 if (gravity & StaticGravity)
275 edgePositions.top += border.top;295 effectiveBorder = CompWindowExtents (0, 0, 0, 0);
276 edgePositions.bottom -= border.bottom + doubleBorder;296
297 edgePositions.left += effectiveBorder.left;
298 edgePositions.right -= effectiveBorder.right + doubleBorder;
299 edgePositions.top += effectiveBorder.top;
300 edgePositions.bottom -= effectiveBorder.bottom + doubleBorder;
277}301}
278302
279bool cp::onlySizeChanged (unsigned int mask)303bool cp::onlySizeChanged (unsigned int mask)
280304
=== modified file 'plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp'
--- plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp 2013-04-17 23:41:09 +0000
+++ plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp 2013-06-07 06:12:28 +0000
@@ -226,7 +226,7 @@
226 extents = WindowExtents (GetParam ());226 extents = WindowExtents (GetParam ());
227227
228 CompPoint pos = InitialPosition (GetParam ());228 CompPoint pos = InitialPosition (GetParam ());
229 pos = cp::constrainPositionToWorkArea (pos, g, extents, WArea);229 pos = cp::constrainPositionToWorkArea (pos, g, extents, WArea, false);
230230
231 const CompPoint expectedAfterExtentsAdjustment = ExpectedPosition +231 const CompPoint expectedAfterExtentsAdjustment = ExpectedPosition +
232 CompPoint (extents.left,232 CompPoint (extents.left,
@@ -235,6 +235,19 @@
235 EXPECT_EQ (expectedAfterExtentsAdjustment, pos);235 EXPECT_EQ (expectedAfterExtentsAdjustment, pos);
236}236}
237237
238TEST_P (PlaceConstrainPositionToWorkArea, PositionConstrainedStaticGravity)
239{
240 g = WindowGeometry (GetParam ());
241 extents = WindowExtents (GetParam ());
242
243 CompPoint pos = InitialPosition (GetParam ());
244 pos = cp::constrainPositionToWorkArea (pos, g, extents, WArea, true);
245
246 /* Do not adjust residual position for extents with windows
247 * that have a static gravity */
248 EXPECT_EQ (ExpectedPosition, pos);
249}
250
238namespace251namespace
239{252{
240cwe::Extents PossibleExtents[] =253cwe::Extents PossibleExtents[] =
@@ -284,7 +297,7 @@
284 CompPoint pos;297 CompPoint pos;
285};298};
286299
287TEST_F (PlaceGetEdgePositions, GetEdgePositions)300TEST_F (PlaceGetEdgePositions, GetEdgePositionsNWGravity)
288{301{
289 int left = geom.x () - border.left;302 int left = geom.x () - border.left;
290 int right = left + (geom.widthIncBorders ()) +303 int right = left + (geom.widthIncBorders ()) +
@@ -296,7 +309,25 @@
296 const cwe::Extents ExpectedExtents (left, right, top, bottom);309 const cwe::Extents ExpectedExtents (left, right, top, bottom);
297 cwe::Extents actualExtents (cp::getWindowEdgePositions (pos,310 cwe::Extents actualExtents (cp::getWindowEdgePositions (pos,
298 geom,311 geom,
299 border));312 border,
313 NorthWestGravity));
314
315 EXPECT_EQ (ExpectedExtents, actualExtents);
316}
317
318TEST_F (PlaceGetEdgePositions, GetEdgePositionsStaticGravity)
319{
320 /* Don't count borders in validation */
321 int left = geom.x ();
322 int right = left + (geom.widthIncBorders ());
323 int top = geom.y ();
324 int bottom = top + (geom.heightIncBorders ());
325
326 const cwe::Extents ExpectedExtents (left, right, top, bottom);
327 cwe::Extents actualExtents (cp::getWindowEdgePositions (pos,
328 geom,
329 border,
330 StaticGravity));
300331
301 EXPECT_EQ (ExpectedExtents, actualExtents);332 EXPECT_EQ (ExpectedExtents, actualExtents);
302}333}
@@ -496,7 +527,29 @@
496527
497 cp::subtractBordersFromEdgePositions (modifiedEdgePositions,528 cp::subtractBordersFromEdgePositions (modifiedEdgePositions,
498 borders,529 borders,
499 legacyBorder);530 legacyBorder,
531 NorthWestGravity);
532
533 EXPECT_EQ (expectedEdgePositions, modifiedEdgePositions);
534}
535
536TEST (PlaceSubtractBordersFromEdgePositions, StaticGravityDefinition)
537{
538 const CompWindowExtents borders (1, 2, 3, 4);
539 const CompWindowExtents edgePositions (100, 200, 100, 200);
540 const unsigned int legacyBorder = 1;
541
542 CompWindowExtents expectedEdgePositions (edgePositions.left,
543 edgePositions.right - (2 * legacyBorder),
544 edgePositions.top,
545 edgePositions.bottom - (2 * legacyBorder));
546
547 CompWindowExtents modifiedEdgePositions (edgePositions);
548
549 cp::subtractBordersFromEdgePositions (modifiedEdgePositions,
550 borders,
551 legacyBorder,
552 StaticGravity);
500553
501 EXPECT_EQ (expectedEdgePositions, modifiedEdgePositions);554 EXPECT_EQ (expectedEdgePositions, modifiedEdgePositions);
502}555}
503556
=== modified file 'plugins/place/src/place.cpp'
--- plugins/place/src/place.cpp 2013-05-20 15:26:11 +0000
+++ plugins/place/src/place.cpp 2013-06-07 06:12:28 +0000
@@ -362,7 +362,8 @@
362362
363 CompWindowExtents edgePositions = cp::getWindowEdgePositions (pos,363 CompWindowExtents edgePositions = cp::getWindowEdgePositions (pos,
364 geom,364 geom,
365 window->border ());365 window->border (),
366 window->sizeHints ().win_gravity);
366367
367 int output = screen->outputDeviceForGeometry (geom);368 int output = screen->outputDeviceForGeometry (geom);
368 CompRect workArea = screen->getWorkareaForOutput (output);369 CompRect workArea = screen->getWorkareaForOutput (output);
@@ -385,7 +386,8 @@
385 /* bring left/right/top/bottom to actual window coordinates */386 /* bring left/right/top/bottom to actual window coordinates */
386 cp::subtractBordersFromEdgePositions (edgePositions,387 cp::subtractBordersFromEdgePositions (edgePositions,
387 window->border (),388 window->border (),
388 geom.border ());389 geom.border (),
390 window->sizeHints ().win_gravity);
389391
390 /* always validate position if the application changed only its size,392 /* always validate position if the application changed only its size,
391 * as it might become partially offscreen because of that */393 * as it might become partially offscreen because of that */
@@ -1141,10 +1143,13 @@
1141PlaceWindow::constrainToWorkarea (const CompRect &workArea,1143PlaceWindow::constrainToWorkarea (const CompRect &workArea,
1142 CompPoint &pos)1144 CompPoint &pos)
1143{1145{
1146 bool staticGravity = window->sizeHints ().win_gravity & StaticGravity;
1147
1144 pos = cp::constrainPositionToWorkArea (pos,1148 pos = cp::constrainPositionToWorkArea (pos,
1145 window->serverGeometry (),1149 window->serverGeometry (),
1146 window->border (),1150 window->border (),
1147 workArea);1151 workArea,
1152 staticGravity);
11481153
1149}1154}
11501155
11511156
=== modified file 'src/window/extents/src/windowextents.cpp'
--- src/window/extents/src/windowextents.cpp 2013-04-17 23:41:09 +0000
+++ src/window/extents/src/windowextents.cpp 2013-06-07 06:12:28 +0000
@@ -35,11 +35,6 @@
35 CompPoint rv = CompPoint ();35 CompPoint rv = CompPoint ();
3636
37 switch (gravity) {37 switch (gravity) {
38 /* We treat StaticGravity like NorthWestGravity here
39 * as when decorating / undecorating the window we
40 * really do need to move it in order to handle
41 * any cases where it goes offscreen */
42 case StaticGravity:
43 case NorthGravity:38 case NorthGravity:
44 case NorthWestGravity:39 case NorthWestGravity:
45 case NorthEastGravity:40 case NorthEastGravity:
@@ -55,11 +50,6 @@
55 }50 }
5651
57 switch (gravity) {52 switch (gravity) {
58 /* We treat StaticGravity like NorthWestGravity here
59 * as when decorating / undecorating the window we
60 * really do need to move it in order to handle
61 * any cases where it goes offscreen */
62 case StaticGravity:
63 case WestGravity:53 case WestGravity:
64 case NorthWestGravity:54 case NorthWestGravity:
65 case SouthWestGravity:55 case SouthWestGravity:
6656
=== removed file 'tests/manual/README.txt'
--- tests/manual/README.txt 2013-04-18 03:02:14 +0000
+++ tests/manual/README.txt 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1Compiz Manual Tests
2===================
3
4Avoid writing manual tests if you can. Acceptance tests that can be run
5on an automatic basis are always preferred.
6
7If getting some part of the code would be too difficult or invasive, then
8write a manual test in here so that we can remind ourselves to deploy test
9frameworks for the code in quesiton.
100
=== removed file 'tests/manual/plugins/decor.txt'
--- tests/manual/plugins/decor.txt 2013-05-20 15:26:11 +0000
+++ tests/manual/plugins/decor.txt 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
1COMPIZ DECOR PLUGIN
2===================
3Sam Spilsbury <smspillaz@gmail.com>
4
5Static Gravity Handling - no decorations
6----------------------------------------
7Setup:
8# Install guake
9
10Actions:
11# Start and launch guake
12
13Expected Result:
14 Guake should sit flush with the panels and work area
15
16Static Gravity Handling - decorations
17-------------------------------------
18Setup:
19# Install friends-app
20
21Actions:
22# Start and launch friends-app
23
24Expected Result:
25 The QML window should have its decorations visible and
26 be contained in the top left hand corner of the work area
27
28_NET_REQUEST_FRAME_EXTENTS handling
29-----------------------------------
30Setup:
31# Install any sun-awt application - examples:
32 1. netbeans
33 2. ecplise
34
35Actions:
36# Run the application
37
38Expected Result:
39 The application should not have its contents offset
40 by its decoration size

Subscribers

People subscribed via source and target branches

to all changes: