diff -Naurb compiz-plugins-main-0.8.4.orig/src/put/put.c compiz-plugins-main-0.8.4/src/put/put.c --- compiz-plugins-main-0.8.4.orig/src/put/put.c 2009-10-13 22:01:42.000000000 -0300 +++ compiz-plugins-main-0.8.4/src/put/put.c 2010-01-26 11:58:23.000000000 -0200 @@ -345,7 +345,7 @@ int *distY) { CompScreen *s = w->screen; - int x, y, dx, dy, posX, posY; + int x, y, dx, dy, posX, posY, width, height; int viewport, output; XRectangle workArea; @@ -388,20 +388,24 @@ pd->lastType = type; } - /* the windows location */ + /* the window location */ x = w->attrib.x + pw->tx; y = w->attrib.y + pw->ty; + /* the window dimensions*/ + width = w->attrib.width + 2 * w->attrib.border_width; + height = w->attrib.height + 2 * w->attrib.border_width; + switch (type) { case PutCenter: /* center of the screen */ - dx = (workArea.width / 2) - (w->serverWidth / 2) - (x - workArea.x); - dy = (workArea.height / 2) - (w->serverHeight / 2) - (y - workArea.y); + dx = (workArea.width / 2) - (width / 2) - (x - workArea.x); + dy = (workArea.height / 2) - (height / 2) - (y - workArea.y); break; case PutLeft: /* center of the left edge */ dx = -(x - workArea.x) + w->input.left + putGetPadLeft (s); - dy = (workArea.height / 2) - (w->serverHeight / 2) - (y - workArea.y); + dy = (workArea.height / 2) - (height / 2) - (y - workArea.y); break; case PutTopLeft: /* top left corner */ @@ -410,38 +414,38 @@ break; case PutTop: /* center of top edge */ - dx = (workArea.width / 2) - (w->serverWidth / 2) - (x - workArea.x); + dx = (workArea.width / 2) - (width / 2) - (x - workArea.x); dy = -(y - workArea.y) + w->input.top + putGetPadTop (s); break; case PutTopRight: /* top right corner */ - dx = workArea.width - w->serverWidth - (x - workArea.x) - + dx = workArea.width - width - (x - workArea.x) - w->input.right - putGetPadRight (s); dy = -(y - workArea.y) + w->input.top + putGetPadTop (s); break; case PutRight: /* center of right edge */ - dx = workArea.width - w->serverWidth - (x - workArea.x) - + dx = workArea.width - width - (x - workArea.x) - w->input.right - putGetPadRight (s); - dy = (workArea.height / 2) - (w->serverHeight / 2) - (y - workArea.y); + dy = (workArea.height / 2) - (height / 2) - (y - workArea.y); break; case PutBottomRight: /* bottom right corner */ - dx = workArea.width - w->serverWidth - (x - workArea.x) - + dx = workArea.width - width - (x - workArea.x) - w->input.right - putGetPadRight (s); - dy = workArea.height - w->serverHeight - (y - workArea.y) - + dy = workArea.height - height - (y - workArea.y) - w->input.bottom - putGetPadBottom (s); break; case PutBottom: /* center of bottom edge */ - dx = (workArea.width / 2) - (w->serverWidth / 2) - (x - workArea.x); - dy = workArea.height - w->serverHeight - (y - workArea.y) - + dx = (workArea.width / 2) - (width / 2) - (x - workArea.x); + dy = workArea.height - height - (y - workArea.y) - w->input.bottom - putGetPadBottom (s); break; case PutBottomLeft: /* bottom left corner */ dx = -(x - workArea.x) + w->input.left + putGetPadLeft (s); - dy = workArea.height - w->serverHeight - (y - workArea.y) - + dy = workArea.height - height - (y - workArea.y) - w->input.bottom - putGetPadBottom (s); break; case PutRestore: @@ -538,14 +542,14 @@ if (posX < 0) /* account for a specified negative position, like geometry without (-0) */ - dx = posX + s->width - w->serverWidth - x - w->input.right; + dx = posX + s->width - width - x - w->input.right; else dx = posX - x + w->input.left; if (posY < 0) /* account for a specified negative position, like geometry without (-0) */ - dy = posY + s->height - w->height - y - w->input.bottom; + dy = posY + s->height - height - y - w->input.bottom; else dy = posY - y + w->input.top; break; @@ -572,8 +576,8 @@ if (putGetWindowCenter (s)) { /* window center */ - dx = rx - (w->serverWidth / 2) - x; - dy = ry - (w->serverHeight / 2) - y; + dx = rx - (width / 2) - x; + dy = ry - (height / 2) - y; } else if (rx < s->workArea.width / 2 && ry < s->workArea.height / 2) @@ -587,20 +591,20 @@ { /* bottom left quad */ dx = rx - x + w->input.left; - dy = ry - w->height - y - w->input.bottom; + dy = ry - height - y - w->input.bottom; } else if (rx >= s->workArea.width / 2 && ry < s->workArea.height / 2) { /* top right quad */ - dx = rx - w->width - x - w->input.right; + dx = rx - width - x - w->input.right; dy = ry - y + w->input.top; } else { /* bottom right quad */ - dx = rx - w->width - x - w->input.right; - dy = ry - w->height - y - w->input.bottom; + dx = rx - width - x - w->input.right; + dy = ry - height - y - w->input.bottom; } } else @@ -629,8 +633,8 @@ extents.left = x + inDx - w->input.left; extents.top = y + inDy - w->input.top; - extents.right = x + inDx + w->serverWidth + w->input.right; - extents.bottom = y + inDy + w->serverHeight + w->input.bottom; + extents.right = x + inDx + width + w->input.right; + extents.bottom = y + inDy + height + w->input.bottom; area.left = workArea.x + putGetPadLeft (s); area.top = workArea.y + putGetPadTop (s); @@ -639,12 +643,12 @@ if (extents.left < area.left) inDx += area.left - extents.left; - else if (w->serverWidth <= workArea.width && extents.right > area.right) + else if (width <= workArea.width && extents.right > area.right) inDx += area.right - extents.right; if (extents.top < area.top) inDy += area.top - extents.top; - else if (w->serverHeight <= workArea.height && + else if (height <= workArea.height && extents.bottom > area.bottom) inDy += area.bottom - extents.bottom;