summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-02-02 15:36:10 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-02-02 15:36:10 +0800
commit57a26c35d3f61b2e83558194f0538c8b9e5feaa3 (patch)
tree65c152fadbd8141cb1fb3e8d5b0fb98f44a39e9e /src/window.cpp
parentf24a7d3d1bdb80d8dff975380d4c2677467b2abe (diff)
downloadunity-window-decorator-57a26c35d3f61b2e83558194f0538c8b9e5feaa3.tar.gz
unity-window-decorator-57a26c35d3f61b2e83558194f0538c8b9e5feaa3.tar.bz2
Fix gravity handling.
Forward port of 510c24577c47eb9d373a3817e0475187631a71e8
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 86e6f33..efc97ce 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2670,17 +2670,20 @@ PrivateWindow::adjustConfigureRequestForGravity (XWindowChanges *xwc,
case NorthGravity:
case CenterGravity:
case SouthGravity:
- if (!(xwcm & CWX))
- newX += (priv->serverGeometry.width () - xwc->width) / 2;
+ if (xwcm & CWX)
+ newX -= xwc->width / 2 - priv->input.left +
+ (priv->input.left + priv->input.right) / 2;
+ else
+ newX -= (xwc->width - priv->serverGeometry.width ());
break;
case NorthEastGravity:
case EastGravity:
case SouthEastGravity:
if (xwcm & CWX)
- newX -= priv->input.right;
+ newX -= xwc->width + priv->input.right;
else
- newX += priv->serverGeometry.width () - xwc->width;
+ newX -= xwc->width - priv->serverGeometry.width ();
break;
case StaticGravity:
@@ -2696,23 +2699,26 @@ PrivateWindow::adjustConfigureRequestForGravity (XWindowChanges *xwc,
case NorthGravity:
case NorthEastGravity:
if (xwcm & CWY)
- newY += priv->input.top;
+ newY = xwc->y + priv->input.top;
break;
case WestGravity:
case CenterGravity:
case EastGravity:
- if (!(xwcm & CWY))
- newY += (priv->serverGeometry.height () - xwc->height) / 2;
+ if (xwcm & CWY)
+ newY -= xwc->height / 2 - priv->input.top +
+ (priv->input.top + priv->input.bottom) / 2;
+ else
+ newY -= (xwc->height - priv->serverGeometry.height ()) / 2;
break;
case SouthWestGravity:
case SouthGravity:
case SouthEastGravity:
if (xwcm & CWY)
- newY -= priv->input.bottom;
+ newY -= xwc->height + priv->input.bottom;
else
- newY += priv->serverGeometry.height () - xwc->height;
+ newY -= xwc->height - priv->serverGeometry.height ();
break;
case StaticGravity:
@@ -2723,13 +2729,13 @@ PrivateWindow::adjustConfigureRequestForGravity (XWindowChanges *xwc,
if (newX != xwc->x)
{
- xwc->x = newX;
+ xwc->x += (newX - xwc->x);
mask |= CWX;
}
if (newY != xwc->y)
{
- xwc->y = newY;
+ xwc->y += (newY - xwc->y);
mask |= CWY;
}