summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-03-15 00:12:45 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-03-15 00:12:45 +0800
commitddaf0d1937be49ea613111eed03a806b9261ce65 (patch)
treec48e4d80a157a367b5c558c25d84353ae2158686
parent25f360543041bdbf1321e7b36871d0ee854f7d4b (diff)
downloadmobileperf-ddaf0d1937be49ea613111eed03a806b9261ce65.tar.gz
mobileperf-ddaf0d1937be49ea613111eed03a806b9261ce65.tar.bz2
Reflect difference between actual input frame geometry and border extents
in the core API
-rw-r--r--include/core/window.h8
-rw-r--r--plugins/compiztoolbox/src/compiztoolbox.cpp8
-rw-r--r--plugins/decor/src/decor.cpp28
-rw-r--r--plugins/move/src/move.cpp26
-rw-r--r--plugins/place/src/place.cpp124
-rw-r--r--plugins/resize/src/resize.cpp78
-rw-r--r--plugins/scale/src/scale.cpp3
-rw-r--r--plugins/water/src/water.cpp6
-rw-r--r--plugins/wobbly/src/wobbly.cpp50
-rw-r--r--src/window.cpp21
-rw-r--r--src/windowgeometry.cpp22
11 files changed, 207 insertions, 167 deletions
diff --git a/include/core/window.h b/include/core/window.h
index a6e4b4a..30ffa79 100644
--- a/include/core/window.h
+++ b/include/core/window.h
@@ -325,7 +325,11 @@ class CompWindow :
int serverHeight () const;
const CompSize serverSize () const;
- /* includes decorations */
+ /* effective decoration extents */
+ CompRect borderRect () const;
+ CompRect serverBorderRect () const;
+
+ /* frame window geometry */
CompRect inputRect () const;
CompRect serverInputRect () const;
@@ -474,8 +478,8 @@ class CompWindow :
bool shaded ();
+ CompWindowExtents & border () const;
CompWindowExtents & input () const;
-
CompWindowExtents & output () const;
XSizeHints & sizeHints () const;
diff --git a/plugins/compiztoolbox/src/compiztoolbox.cpp b/plugins/compiztoolbox/src/compiztoolbox.cpp
index 385453d..69fa3b5 100644
--- a/plugins/compiztoolbox/src/compiztoolbox.cpp
+++ b/plugins/compiztoolbox/src/compiztoolbox.cpp
@@ -431,8 +431,8 @@ BaseSwitchWindow::paintThumb (const GLWindowPaintAttrib &attrib,
width = width1;
height = height1;
- ww = window->inputRect ().width ();
- wh = window->inputRect ().height ();
+ ww = window->borderRect ().width ();
+ wh = window->borderRect ().height ();
if (ww > width)
sAttrib.xScale = width / ww;
@@ -455,9 +455,9 @@ BaseSwitchWindow::paintThumb (const GLWindowPaintAttrib &attrib,
updateIconPos (wx, wy, x, y, width, height);
sAttrib.xTranslate = wx - g.x () +
- window->input ().left * sAttrib.xScale;
+ window->border ().left * sAttrib.xScale;
sAttrib.yTranslate = wy - g.y () +
- window->input ().top * sAttrib.yScale;
+ window->border ().top * sAttrib.yScale;
GLFragment::Attrib fragment (sAttrib);
diff --git a/plugins/decor/src/decor.cpp b/plugins/decor/src/decor.cpp
index 774ec84..48fff29 100644
--- a/plugins/decor/src/decor.cpp
+++ b/plugins/decor/src/decor.cpp
@@ -98,7 +98,7 @@ DecorWindow::computeShadowRegion ()
if ((*it)->type () & CompWindowTypeDesktopMask)
continue;
- inter = shadowRegion.intersected ((*it)->inputRect ());
+ inter = shadowRegion.intersected ((*it)->borderRect ());
if (!inter.isEmpty ())
shadowRegion = shadowRegion.subtracted (inter);
@@ -133,7 +133,7 @@ DecorWindow::computeShadowRegion ()
if (!isAncestorTo (window, (*it)))
continue;
- inter = shadowRegion.intersected ((*it)->inputRect ());
+ inter = shadowRegion.intersected ((*it)->borderRect ());
if (!inter.isEmpty ())
shadowRegion = shadowRegion.subtracted (inter);
@@ -157,7 +157,7 @@ DecorWindow::computeShadowRegion ()
CompRect area (window->outputRect ().x1 (),
window->outputRect ().y1 (),
window->outputRect ().width (),
- window->inputRect ().y1 () -
+ window->inputRect ().y1 () -
window->outputRect ().y1 ());
shadowRegion = shadowRegion.subtracted (area);
@@ -763,11 +763,11 @@ DecorWindow::shiftX ()
case WestGravity:
case NorthWestGravity:
case SouthWestGravity:
- return window->input ().left;
+ return window->border ().left;
case EastGravity:
case NorthEastGravity:
case SouthEastGravity:
- return -window->input ().right;
+ return -window->border ().right;
}
return 0;
@@ -780,11 +780,11 @@ DecorWindow::shiftY ()
case NorthGravity:
case NorthWestGravity:
case NorthEastGravity:
- return window->input ().top;
+ return window->border ().top;
case SouthGravity:
case SouthWestGravity:
case SouthEastGravity:
- return -window->input ().bottom;
+ return -window->border ().bottom;
}
return 0;
@@ -996,8 +996,8 @@ DecorWindow::update (bool allowDecoration)
void
DecorWindow::updateFrame ()
{
- if (!wd || !(window->input ().left || window->input ().right ||
- window->input ().top || window->input ().bottom) ||
+ if (!wd || !(window->border ().left || window->border ().right ||
+ window->border ().top || window->border ().bottom) ||
(wd->decor->type == WINDOW_DECORATION_TYPE_PIXMAP && outputFrame) ||
(wd->decor->type == WINDOW_DECORATION_TYPE_WINDOW && inputFrame))
{
@@ -1036,8 +1036,8 @@ DecorWindow::updateFrame ()
oldHeight = 0;
}
}
- if (wd && (window->input ().left || window->input ().right ||
- window->input ().top || window->input ().bottom))
+ if (wd && (window->border ().left || window->border ().right ||
+ window->border ().top || window->border ().bottom))
{
if (wd->decor->type == WINDOW_DECORATION_TYPE_PIXMAP)
updateInputFrame ();
@@ -1073,8 +1073,8 @@ DecorWindow::updateInputFrame ()
input = wd->decor->input;
}
- x = window->input ().left - border.left;
- y = window->input ().top - border.top;
+ x = window->border ().left - border.left;
+ y = window->border ().top - border.top;
width = server.width () + input.left + input.right + bw;
height = server.height ()+ input.top + input.bottom + bw;
@@ -1422,7 +1422,7 @@ DecorWindow::updateFrameRegion (CompRegion &region)
void
DecorWindow::updateWindowRegions ()
{
- CompRect input (window->inputRect ());
+ const CompRect &input (window->inputRect ());
if (regions.size () != gWindow->textures ().size ())
regions.resize (gWindow->textures ().size ());
diff --git a/plugins/move/src/move.cpp b/plugins/move/src/move.cpp
index 351ef7e..8d4ea57 100644
--- a/plugins/move/src/move.cpp
+++ b/plugins/move/src/move.cpp
@@ -339,7 +339,7 @@ moveHandleMotionEvent (CompScreen *s,
if (!ms->region)
ms->region = moveGetYConstrainRegion (s);
- /* make sure that the top frame extents or the top row of
+ /* make sure that the top border extents or the top row of
pixels are within what is currently our valid screen
region */
if (ms->region)
@@ -347,10 +347,10 @@ moveHandleMotionEvent (CompScreen *s,
int x, y, width, height;
int status;
- x = wX + dx - w->input ().left;
- y = wY + dy - w->input ().top;
- width = wWidth + w->input ().left + w->input ().right;
- height = w->input ().top ? w->input ().top : 1;
+ x = wX + dx - w->border ().left;
+ y = wY + dy - w->border ().top;
+ width = wWidth + w->border ().left + w->border ().right;
+ height = w->border ().top ? w->border ().top : 1;
status = XRectInRegion (ms->region, x, y,
(unsigned int) width,
@@ -371,7 +371,7 @@ moveHandleMotionEvent (CompScreen *s,
if (xStatus != RectangleIn)
dx += (dx < 0) ? 1 : -1;
- x = wX + dx - w->input ().left;
+ x = wX + dx - w->border ().left;
}
while (dy && status != RectangleIn)
@@ -384,7 +384,7 @@ moveHandleMotionEvent (CompScreen *s,
if (status != RectangleIn)
dy += (dy < 0) ? 1 : -1;
- y = wY + dy - w->input ().top;
+ y = wY + dy - w->border ().top;
}
}
else
@@ -410,7 +410,7 @@ moveHandleMotionEvent (CompScreen *s,
width = w->saveWc ().width;
w->saveWc ().x = xRoot - (width >> 1);
- w->saveWc ().y = yRoot + (w->input ().top >> 1);
+ w->saveWc ().y = yRoot + (w->border ().top >> 1);
ms->x = ms->y = 0;
@@ -437,7 +437,7 @@ moveHandleMotionEvent (CompScreen *s,
w->maximize (ms->origState);
- wy = workArea.y () + (w->input ().top >> 1);
+ wy = workArea.y () + (w->border ().top >> 1);
wy += w->sizeHints ().height_inc >> 1;
s->warpPointer (0, wy - pointerY);
@@ -450,8 +450,8 @@ moveHandleMotionEvent (CompScreen *s,
if (w->state () & CompWindowStateMaximizedVertMask)
{
- min = workArea.y () + w->input ().top;
- max = workArea.bottom () - w->input ().bottom - wHeight;
+ min = workArea.y () + w->border ().top;
+ max = workArea.bottom () - w->border ().bottom - wHeight;
if (wY + dy < min)
dy = min - wY;
@@ -468,8 +468,8 @@ moveHandleMotionEvent (CompScreen *s,
if (wX + wWidth < 0)
return;
- min = workArea.x () + w->input ().left;
- max = workArea.right () - w->input ().right - wWidth;
+ min = workArea.x () + w->border ().left;
+ max = workArea.right () - w->border ().right - wWidth;
if (wX + dx < min)
dx = min - wX;
diff --git a/plugins/place/src/place.cpp b/plugins/place/src/place.cpp
index 9f1b2c6..dbd4413 100644
--- a/plugins/place/src/place.cpp
+++ b/plugins/place/src/place.cpp
@@ -276,18 +276,18 @@ PlaceScreen::doHandleScreenSizeChange (bool firstPass,
if (w->state () & CompWindowStateMaximizedHorzMask)
{
mask |= CWX | CWWidth;
- xwc.x = vpX * screen->width () + workArea.x () + w->input ().left;
+ xwc.x = vpX * screen->width () + workArea.x () + w->border ().left;
xwc.width = workArea.width () -
(2 * w->serverGeometry ().border () +
- w->input ().left + w->input ().right);
+ w->border ().left + w->border ().right);
}
if (w->state () & CompWindowStateMaximizedVertMask)
{
mask |= CWY | CWHeight;
- xwc.y = vpY * screen->height () + workArea.y () + w->input ().top;
+ xwc.y = vpY * screen->height () + workArea.y () + w->border ().top;
xwc.height = workArea.height () -
(2 * w->serverGeometry ().border () +
- w->input ().top + w->input ().bottom);
+ w->border ().top + w->border ().bottom);
}
}
}
@@ -400,8 +400,8 @@ compareLeftmost (CompWindow *a,
{
int ax, bx;
- ax = a->serverX () - a->input ().left;
- bx = b->serverX () - b->input ().left;
+ ax = a->serverX () - a->border ().left;
+ bx = b->serverX () - b->border ().left;
return (ax <= bx);
}
@@ -412,8 +412,8 @@ compareTopmost (CompWindow *a,
{
int ay, by;
- ay = a->serverY () - a->input ().top;
- by = b->serverY () - b->input ().top;
+ ay = a->serverY () - a->border ().top;
+ by = b->serverY () - b->border ().top;
return (ay <= by);
}
@@ -426,11 +426,11 @@ compareNorthWestCorner (CompWindow *a,
int fromOriginB;
int ax, ay, bx, by;
- ax = a->serverX () - a->input ().left;
- ay = a->serverY () - a->input ().top;
+ ax = a->serverX () - a->border ().left;
+ ay = a->serverY () - a->border ().top;
- bx = b->serverX () - b->input ().left;
- by = b->serverY () - b->input ().top;
+ bx = b->serverX () - b->border ().left;
+ by = b->serverY () - b->border ().top;
/* probably there's a fast good-enough-guess we could use here. */
fromOriginA = sqrt (ax * ax + ay * ay);
@@ -517,14 +517,14 @@ PlaceWindow::doValidateResizeRequest (unsigned int &mask,
y = xwc->y;
}
- left = x - window->input ().left;
- right = left + xwc->width + (window->input ().left +
- window->input ().right +
- 2 * window->serverGeometry ().border ());;
- top = y - window->input ().top;
- bottom = top + xwc->height + (window->input ().top +
- window->input ().bottom +
- 2 * window->serverGeometry ().border ());;
+ left = x - window->border ().left;
+ right = left + xwc->width + (window->border ().left +
+ window->border ().right +
+ 2 * window->serverGeometry ().border ());
+ top = y - window->border ().top;
+ bottom = top + xwc->height + (window->border ().top +
+ window->border ().bottom +
+ 2 * window->serverGeometry ().border ());
geom.set (xwc->x, xwc->y, xwc->width, xwc->height,
window->serverGeometry ().border ());
@@ -584,10 +584,10 @@ PlaceWindow::doValidateResizeRequest (unsigned int &mask,
}
/* bring left/right/top/bottom to actual window coordinates */
- left += window->input ().left;
- right -= window->input ().right + 2 * window->serverGeometry ().border ();
- top += window->input ().top;
- bottom -= window->input ().bottom + 2 * window->serverGeometry ().border ();
+ left += window->border ().left;
+ right -= window->border ().right + 2 * window->serverGeometry ().border ();
+ top += window->border ().top;
+ bottom -= window->border ().bottom + 2 * window->serverGeometry ().border ();
/* always validate position if the applicaiton changed only its size,
* as it might become partially offscreen because of that */
@@ -964,13 +964,13 @@ PlaceWindow::placeSmart (const CompRect &workArea,
if (!windowIsPlaceRelevant (w))
continue;
- xl = w->serverX () - w->input ().left;
- yt = w->serverY () - w->input ().top;
+ xl = w->serverX () - w->border ().left;
+ yt = w->serverY () - w->border ().top;
xr = w->serverX () + w->serverWidth () +
- w->input ().right +
+ w->border ().right +
w->serverGeometry ().border () * 2;
yb = w->serverY () + w->serverHeight () +
- w->input ().bottom +
+ w->border ().bottom +
w->serverGeometry ().border () * 2;
/* if windows overlap, calc the overall overlapping */
@@ -1026,13 +1026,13 @@ PlaceWindow::placeSmart (const CompRect &workArea,
if (!windowIsPlaceRelevant (w))
continue;
- xl = w->serverX () - w->input ().left;
- yt = w->serverY () - w->input ().top;
+ xl = w->serverX () - w->border ().left;
+ yt = w->serverY () - w->border ().top;
xr = w->serverX () + w->serverWidth () +
- w->input ().right +
+ w->border ().right +
w->serverGeometry ().border () * 2;
yb = w->serverY () + w->serverHeight () +
- w->input ().bottom +
+ w->border ().bottom +
w->serverGeometry ().border () * 2;
/* if not enough room above or under the current
@@ -1065,13 +1065,13 @@ PlaceWindow::placeSmart (const CompRect &workArea,
if (!windowIsPlaceRelevant (w))
continue;
- xl = w->serverX () - w->input ().left;
- yt = w->serverY () - w->input ().top;
+ xl = w->serverX () - w->border ().left;
+ yt = w->serverY () - w->border ().top;
xr = w->serverX () + w->serverWidth () +
- w->input ().right +
+ w->border ().right +
w->serverGeometry ().border () * 2;
yb = w->serverY () + w->serverHeight () +
- w->input ().bottom +
+ w->border ().bottom +
w->serverGeometry ().border () * 2;
/* if not enough room to the left or right of the current
@@ -1092,8 +1092,8 @@ PlaceWindow::placeSmart (const CompRect &workArea,
if (ch >= workArea.height ())
yOptimal = workArea.y ();
- pos.setX (xOptimal + window->input ().left);
- pos.setY (yOptimal + window->input ().top);
+ pos.setX (xOptimal + window->border ().left);
+ pos.setY (yOptimal + window->border ().top);
}
static void
@@ -1138,7 +1138,7 @@ rectOverlapsWindow (const CompRect &rect,
case CompWindowTypeUtilMask:
case CompWindowTypeToolbarMask:
case CompWindowTypeMenuMask:
- intersect = rect & other->serverInputRect ();
+ intersect = rect & other->serverBorderRect ();
if (!intersect.isEmpty ())
return true;
break;
@@ -1182,13 +1182,13 @@ PlaceWindow::cascadeFindFirstFit (const CompWindowList &windows,
rightSorted.sort (compareTopmost);
rightSorted.sort (compareLeftmost);
- rect = window->serverInputRect ();
+ rect = window->serverBorderRect ();
centerTileRectInArea (rect, workArea);
if (workArea.contains (rect) && !rectOverlapsWindow (rect, windows))
{
- pos.setX (rect.x () + window->input ().left);
- pos.setY (rect.y () + window->input ().top);
+ pos.setX (rect.x () + window->border ().left);
+ pos.setY (rect.y () + window->border ().top);
retval = true;
}
@@ -1202,7 +1202,7 @@ PlaceWindow::cascadeFindFirstFit (const CompWindowList &windows,
if (retval)
break;
- outerRect = w->serverInputRect ();
+ outerRect = w->serverBorderRect ();
rect.setX (outerRect.x ());
rect.setY (outerRect.bottom ());
@@ -1210,8 +1210,8 @@ PlaceWindow::cascadeFindFirstFit (const CompWindowList &windows,
if (workArea.contains (rect) &&
!rectOverlapsWindow (rect, belowSorted))
{
- pos.setX (rect.x () + window->input ().left);
- pos.setY (rect.y () + window->input ().top);
+ pos.setX (rect.x () + window->border ().left);
+ pos.setY (rect.y () + window->border ().top);
retval = true;
}
}
@@ -1227,7 +1227,7 @@ PlaceWindow::cascadeFindFirstFit (const CompWindowList &windows,
if (retval)
break;
- outerRect = w->serverInputRect ();
+ outerRect = w->serverBorderRect ();
rect.setX (outerRect.right ());
rect.setY (outerRect.y ());
@@ -1235,8 +1235,8 @@ PlaceWindow::cascadeFindFirstFit (const CompWindowList &windows,
if (workArea.contains (rect) &&
!rectOverlapsWindow (rect, rightSorted))
{
- pos.setX (rect.x () + w->input ().left);
- pos.setY (rect.y () + w->input ().top);
+ pos.setX (rect.x () + w->border ().left);
+ pos.setY (rect.y () + w->border ().top);
retval = true;
}
}
@@ -1271,8 +1271,8 @@ PlaceWindow::cascadeFindNext (const CompWindowList &windows,
*/
#define CASCADE_FUZZ 15
- xThreshold = MAX (window->input ().left, CASCADE_FUZZ);
- yThreshold = MAX (window->input ().top, CASCADE_FUZZ);
+ xThreshold = MAX (window->border ().left, CASCADE_FUZZ);
+ yThreshold = MAX (window->border ().top, CASCADE_FUZZ);
/* Find furthest-SE origin of all workspaces.
* cascade_x, cascade_y are the target position
@@ -1294,8 +1294,8 @@ PlaceWindow::cascadeFindNext (const CompWindowList &windows,
int wx, wy;
/* we want frame position, not window position */
- wx = w->serverX () - w->input ().left;
- wy = w->serverY () - w->input ().top;
+ wx = w->serverX () - w->border ().left;
+ wy = w->serverY () - w->border ().top;
if (abs (wx - cascadeX) < xThreshold &&
abs (wy - cascadeY) < yThreshold)
@@ -1346,8 +1346,8 @@ PlaceWindow::cascadeFindNext (const CompWindowList &windows,
*/
/* Convert coords to position of window, not position of frame. */
- pos.setX (cascadeX + window->input ().left);
- pos.setY (cascadeY + window->input ().top);
+ pos.setX (cascadeX + window->border ().left);
+ pos.setY (cascadeY + window->border ().top);
}
bool
@@ -1524,15 +1524,15 @@ PlaceWindow::constrainToWorkarea (const CompRect &workArea,
CompWindowExtents extents;
int delta;
- extents.left = pos.x () - window->input ().left;
- extents.top = pos.y () - window->input ().top;
+ extents.left = pos.x () - window->border ().left;
+ extents.top = pos.y () - window->border ().top;
extents.right = extents.left + window->serverWidth () +
- (window->input ().left +
- window->input ().right +
+ (window->border ().left +
+ window->border ().right +
2 * window->serverGeometry ().border ());
extents.bottom = extents.top + window->serverHeight () +
- (window->input ().top +
- window->input ().bottom +
+ (window->border ().top +
+ window->border ().bottom +
2 * window->serverGeometry ().border ());
delta = workArea.right () - extents.right;
@@ -1551,8 +1551,8 @@ PlaceWindow::constrainToWorkarea (const CompRect &workArea,
if (delta > 0)
extents.top += delta;
- pos.setX (extents.left + window->input ().left);
- pos.setY (extents.top + window->input ().top);
+ pos.setX (extents.left + window->border ().left);
+ pos.setY (extents.top + window->border ().top);
}
diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp
index 265ae45..ac4aaa9 100644
--- a/plugins/resize/src/resize.cpp
+++ b/plugins/resize/src/resize.cpp
@@ -40,22 +40,22 @@ COMPIZ_PLUGIN_20090315 (resize, ResizePluginVTable)
void
ResizeScreen::getPaintRectangle (BoxPtr pBox)
{
- pBox->x1 = geometry.x - w->input ().left;
- pBox->y1 = geometry.y - w->input ().top;
+ pBox->x1 = geometry.x - w->border ().left;
+ pBox->y1 = geometry.y - w->border ().top;
pBox->x2 = geometry.x + geometry.width +
- w->serverGeometry ().border () * 2 + w->input ().right;
+ w->serverGeometry ().border () * 2 + w->border ().right;
if (w->shaded ())
- pBox->y2 = geometry.y + w->size ().height () + w->input ().bottom;
+ pBox->y2 = geometry.y + w->size ().height () + w->border ().bottom;
else
pBox->y2 = geometry.y + geometry.height +
- w->serverGeometry ().border () * 2 + w->input ().bottom;
+ w->serverGeometry ().border () * 2 + w->border ().bottom;
}
void
ResizeWindow::getStretchScale (BoxPtr pBox, float *xScale, float *yScale)
{
- CompRect rect (window->inputRect ());
+ CompRect rect (window->borderRect ());
*xScale = (rect.width ()) ? (pBox->x2 - pBox->x1) /
(float) rect.width () : 1.0f;
@@ -72,8 +72,8 @@ ResizeScreen::getStretchRectangle (BoxPtr pBox)
getPaintRectangle (&box);
ResizeWindow::get (w)->getStretchScale (&box, &xScale, &yScale);
- pBox->x1 = (int) (box.x1 - (w->output ().left - w->input ().left) * xScale);
- pBox->y1 = (int) (box.y1 - (w->output ().top - w->input ().top) * yScale);
+ pBox->x1 = (int) (box.x1 - (w->output ().left - w->border ().left) * xScale);
+ pBox->y1 = (int) (box.y1 - (w->output ().top - w->border ().top) * yScale);
pBox->x2 = (int) (box.x2 + w->output ().right * xScale);
pBox->y2 = (int) (box.y2 + w->output ().bottom * yScale);
}
@@ -712,12 +712,12 @@ ResizeScreen::handleKeyEvent (KeyCode keycode)
int x, y, left, top, width, height;
CompWindow::Geometry server = w->serverGeometry ();
- CompWindowExtents input = w->input ();
+ const CompWindowExtents &border = w->border ();
- left = server.x () - input.left;
- top = server.y () - input.top;
- width = input.left + server.width () + input.right;
- height = input.top + server.height () + input.bottom;
+ left = server.x () - border.left;
+ top = server.y () - border.top;
+ width = border.left + server.width () + border.right;
+ height = border.top + server.height () + border.bottom;
x = left + width * (rKeys[i].dx + 1) / 2;
y = top + height * (rKeys[i].dy + 1) / 2;
@@ -801,16 +801,16 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
if (mask & ResizeRightMask)
pointerAdjustX = server.x () + server.width () +
- w->input ().right - xRoot;
+ w->border ().right - xRoot;
else if (mask & ResizeLeftMask)
- pointerAdjustX = server.x () - w->input ().left -
+ pointerAdjustX = server.x () - w->border ().left -
xRoot;
if (mask & ResizeDownMask)
pointerAdjustY = server.y () + server.height () +
- w->input ().bottom - yRoot;
+ w->border ().bottom - yRoot;
else if (mask & ResizeUpMask)
- pointerAdjustY = server.y () - w->input ().top - yRoot;
+ pointerAdjustY = server.y () - w->border ().top - yRoot;
screen->warpPointer (pointerAdjustX, pointerAdjustY);
@@ -847,25 +847,25 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
if (mask == ResizeLeftMask)
{
if (xRoot == 0 &&
- geometry.x - w->input ().left > grabWindowWorkArea->left ())
+ geometry.x - w->border ().left > grabWindowWorkArea->left ())
pointerDx += abs (yRoot - lastPointerY) * -1;
}
else if (mask == ResizeRightMask)
{
if (xRoot == screen->width () -1 &&
- geometry.x + geometry.width + w->input ().right < grabWindowWorkArea->right ())
+ geometry.x + geometry.width + w->border ().right < grabWindowWorkArea->right ())
pointerDx += abs (yRoot - lastPointerY);
}
if (mask == ResizeUpMask)
{
if (yRoot == 0 &&
- geometry.y - w->input ().top > grabWindowWorkArea->top ())
+ geometry.y - w->border ().top > grabWindowWorkArea->top ())
pointerDy += abs (xRoot - lastPointerX) * -1;
}
else if (mask == ResizeDownMask)
{
if (yRoot == screen->height () -1 &&
- geometry.y + geometry.height + w->input ().bottom < grabWindowWorkArea->bottom ())
+ geometry.y + geometry.height + w->border ().bottom < grabWindowWorkArea->bottom ())
pointerDx += abs (yRoot - lastPointerY);
}
}
@@ -910,14 +910,14 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
if (mask & ResizeUpMask)
{
int decorTop = savedGeometry.y + savedGeometry.height -
- (che + w->input ().top);
+ (che + w->border ().top);
if (grabWindowWorkArea->y () > decorTop)
che -= grabWindowWorkArea->y () - decorTop;
}
if (mask & ResizeDownMask)
{
- int decorBottom = savedGeometry.y + che + w->input ().bottom;
+ int decorBottom = savedGeometry.y + che + w->border ().bottom;
if (decorBottom >
grabWindowWorkArea->y () + grabWindowWorkArea->height ())
@@ -927,14 +927,14 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
if (mask & ResizeLeftMask)
{
int decorLeft = savedGeometry.x + savedGeometry.width -
- (cwi + w->input ().left);
+ (cwi + w->border ().left);
if (grabWindowWorkArea->x () > decorLeft)
cwi -= grabWindowWorkArea->x () - decorLeft;
}
if (mask & ResizeRightMask)
{
- int decorRight = savedGeometry.x + cwi + w->input ().right;
+ int decorRight = savedGeometry.x + cwi + w->border ().right;
if (decorRight >
grabWindowWorkArea->x () + grabWindowWorkArea->width ())
@@ -947,36 +947,36 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
he = che;
/* compute rect. for window + borders */
- wWidth = wi + w->input ().left + w->input ().right;
- wHeight = he + w->input ().top + w->input ().bottom;
+ wWidth = wi + w->border ().left + w->border ().right;
+ wHeight = he + w->border ().top + w->border ().bottom;
if (centered)
{
if (mask & ResizeLeftMask)
wX = geometry.x + geometry.width -
- (wi + w->input ().left);
+ (wi + w->border ().left);
else
- wX = geometry.x - w->input ().left;
+ wX = geometry.x - w->border ().left;
if (mask & ResizeUpMask)
wY = geometry.y + geometry.height -
- (he + w->input ().top);
+ (he + w->border ().top);
else
- wY = geometry.y - w->input ().top;
+ wY = geometry.y - w->border ().top;
}
else
{
if (mask & ResizeLeftMask)
wX = savedGeometry.x + savedGeometry.width -
- (wi + w->input ().left);
+ (wi + w->border ().left);
else
- wX = savedGeometry.x - w->input ().left;
+ wX = savedGeometry.x - w->border ().left;
if (mask & ResizeUpMask)
wY = savedGeometry.y + savedGeometry.height -
- (he + w->input ().top);
+ (he + w->border ().top);
else
- wY = savedGeometry.y - w->input ().top;
+ wY = savedGeometry.y - w->border ().top;
}
/* Check if resized edge(s) are near output work-area boundaries */
@@ -1047,12 +1047,12 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
/* rect. for a minimal height window + borders
(used for the constraining in X axis) */
int minimalInputHeight = minHeight +
- w->input ().top + w->input ().bottom;
+ w->border ().top + w->border ().bottom;
/* small hot-spot square (on window's corner or edge) that is to be
constrained to the combined output work-area region */
int x, y;
- int width = w->input ().top; /* square size = title bar height */
+ int width = w->border ().top; /* square size = title bar height */
int height = width;
bool status; /* whether or not hot-spot is in the region */
@@ -1592,8 +1592,8 @@ ResizeWindow::glPaint (const GLWindowPaintAttrib &attrib,
x = window->geometry (). x ();
y = window->geometry (). y ();
- xOrigin = x - window->input ().left;
- yOrigin = y - window->input ().top;
+ xOrigin = x - window->border ().left;
+ yOrigin = y - window->border ().top;
wTransform.translate (xOrigin, yOrigin, 0.0f);
wTransform.scale (xScale, yScale, 1.0f);
diff --git a/plugins/scale/src/scale.cpp b/plugins/scale/src/scale.cpp
index f257135..5ada86c 100644
--- a/plugins/scale/src/scale.cpp
+++ b/plugins/scale/src/scale.cpp
@@ -572,6 +572,9 @@ PrivateScaleScreen::fillInWindows ()
sw->priv->slot = &slots[sw->priv->sid];
+ /* Auxilary items reparented into windows are clickable so we want to care about
+ * them when calculating the slot size */
+
width = w->width () + w->input ().left + w->input ().right;
height = w->height () + w->input ().top + w->input ().bottom;
diff --git a/plugins/water/src/water.cpp b/plugins/water/src/water.cpp
index 435bcf7..b3a0c78 100644
--- a/plugins/water/src/water.cpp
+++ b/plugins/water/src/water.cpp
@@ -1148,10 +1148,10 @@ waterTitleWave (CompAction *action,
CompWindow::Geometry &g = w->geometry ();
XPoint p[2];
- p[0].x = g.x () - w->input ().left;
- p[0].y = g.y () - w->input ().top / 2;
+ p[0].x = g.x () - w->border ().left;
+ p[0].y = g.y () - w->border ().top / 2;
- p[1].x = g.x () + g.width () + w->input ().right;
+ p[1].x = g.x () + g.width () + w->border ().right;
p[1].y = p[0].y;
ws->waterVertices (GL_LINES, p, 2, 0.15f);
diff --git a/plugins/wobbly/src/wobbly.cpp b/plugins/wobbly/src/wobbly.cpp
index c85e706..1929dda 100644
--- a/plugins/wobbly/src/wobbly.cpp
+++ b/plugins/wobbly/src/wobbly.cpp
@@ -47,7 +47,7 @@ WobblyWindow::findNextWestEdge (Object *object)
v1 = -65535.0f;
v2 = 65535.0f;
- x = object->position.x + window->output ().left - window->input ().left;
+ x = object->position.x + window->output ().left - window->border ().left;
output = ::screen->outputDeviceForPoint (x, object->position.y);
const CompRect &workArea =
@@ -71,9 +71,9 @@ WobblyWindow::findNextWestEdge (Object *object)
}
else if (!p->invisible () && (p->type () & SNAP_WINDOW_TYPE))
{
- s = p->geometry ().y () - p->input ().top -
+ s = p->geometry ().y () - p->border ().top -
window->output ().top;
- e = p->geometry ().y () + p->height () + p->input ().bottom +
+ e = p->geometry ().y () + p->height () + p->border ().bottom +
window->output ().bottom;
}
else
@@ -103,7 +103,7 @@ WobblyWindow::findNextWestEdge (Object *object)
v = p->struts ()->left.x + p->struts ()->left.width;
else
v = p->geometry ().x () + p->width () +
- p->input ().right;
+ p->border ().right;
if (v <= x)
{
@@ -123,8 +123,8 @@ WobblyWindow::findNextWestEdge (Object *object)
v2 = workAreaEdge;
}
- v1 = v1 - window->output ().left + window->input ().left;
- v2 = v2 - window->output ().left + window->input ().left;
+ v1 = v1 - window->output ().left + window->border ().left;
+ v2 = v2 - window->output ().left + window->border ().left;
if (v1 != (int) object->vertEdge.next)
object->vertEdge.snapped = false;
@@ -155,7 +155,7 @@ WobblyWindow::findNextEastEdge (Object *object)
v1 = 65535.0f;
v2 = -65535.0f;
- x = object->position.x - window->output ().right + window->input ().right;
+ x = object->position.x - window->output ().right + window->border ().right;
output = ::screen->outputDeviceForPoint (x, object->position.y);
const CompRect &workArea =
@@ -179,9 +179,9 @@ WobblyWindow::findNextEastEdge (Object *object)
}
else if (!p->invisible () && (p->type () & SNAP_WINDOW_TYPE))
{
- s = p->geometry ().y () - p->input ().top -
+ s = p->geometry ().y () - p->border ().top -
window->output ().top;
- e = p->geometry ().y () + p->height () + p->input ().bottom +
+ e = p->geometry ().y () + p->height () + p->border ().bottom +
window->output ().bottom;
}
else
@@ -210,7 +210,7 @@ WobblyWindow::findNextEastEdge (Object *object)
if (p->mapNum () && p->struts ())
v = p->struts ()->right.x;
else
- v = p->geometry ().x () - p->input ().left;
+ v = p->geometry ().x () - p->border ().left;
if (v >= x)
{
@@ -230,8 +230,8 @@ WobblyWindow::findNextEastEdge (Object *object)
v2 = workAreaEdge;
}
- v1 = v1 + window->output ().right - window->input ().right;
- v2 = v2 + window->output ().right - window->input ().right;
+ v1 = v1 + window->output ().right - window->border ().right;
+ v2 = v2 + window->output ().right - window->border ().right;
if (v1 != (int) object->vertEdge.next)
object->vertEdge.snapped = false;
@@ -262,7 +262,7 @@ WobblyWindow::findNextNorthEdge (Object *object)
v1 = -65535.0f;
v2 = 65535.0f;
- y = object->position.y + window->output ().top - window->input ().top;
+ y = object->position.y + window->output ().top - window->border ().top;
output = ::screen->outputDeviceForPoint (object->position.x, y);
const CompRect &workArea =
@@ -286,9 +286,9 @@ WobblyWindow::findNextNorthEdge (Object *object)
}
else if (!p->invisible () && (p->type () & SNAP_WINDOW_TYPE))
{
- s = p->geometry ().x () - p->input ().left -
+ s = p->geometry ().x () - p->border ().left -
window->output ().left;
- e = p->geometry ().x () + p->width () + p->input ().right +
+ e = p->geometry ().x () + p->width () + p->border ().right +
window->output ().right;
}
else
@@ -317,7 +317,7 @@ WobblyWindow::findNextNorthEdge (Object *object)
if (p->mapNum () && p->struts ())
v = p->struts ()->top.y + p->struts ()->top.height;
else
- v = p->geometry ().y () + p->height () + p->input ().bottom;
+ v = p->geometry ().y () + p->height () + p->border ().bottom;
if (v <= y)
{
@@ -337,8 +337,8 @@ WobblyWindow::findNextNorthEdge (Object *object)
v2 = workAreaEdge;
}
- v1 = v1 - window->output ().top + window->input ().top;
- v2 = v2 - window->output ().top + window->input ().top;
+ v1 = v1 - window->output ().top + window->border ().top;
+ v2 = v2 - window->output ().top + window->border ().top;
if (v1 != (int) object->horzEdge.next)
object->horzEdge.snapped = false;
@@ -369,7 +369,7 @@ WobblyWindow::findNextSouthEdge (Object *object)
v1 = 65535.0f;
v2 = -65535.0f;
- y = object->position.y - window->output ().bottom + window->input ().bottom;
+ y = object->position.y - window->output ().bottom + window->border ().bottom;
output = ::screen->outputDeviceForPoint (object->position.x, y);
const CompRect &workArea =
@@ -393,9 +393,9 @@ WobblyWindow::findNextSouthEdge (Object *object)
}
else if (!p->invisible () && (p->type () & SNAP_WINDOW_TYPE))
{
- s = p->geometry ().x () - p->input ().left -
+ s = p->geometry ().x () - p->border ().left -
window->output ().left;
- e = p->geometry ().x () + p->width () + p->input ().right +
+ e = p->geometry ().x () + p->width () + p->border ().right +
window->output ().right;
}
else
@@ -424,7 +424,7 @@ WobblyWindow::findNextSouthEdge (Object *object)
if (p->mapNum () && p->struts ())
v = p->struts ()->bottom.y;
else
- v = p->geometry ().y () - p->input ().top;
+ v = p->geometry ().y () - p->border ().top;
if (v >= y)
{
@@ -444,8 +444,8 @@ WobblyWindow::findNextSouthEdge (Object *object)
v2 = workAreaEdge;
}
- v1 = v1 + window->output ().bottom - window->input ().bottom;
- v2 = v2 + window->output ().bottom - window->input ().bottom;
+ v1 = v1 + window->output ().bottom - window->border ().bottom;
+ v2 = v2 + window->output ().bottom - window->border ().bottom;
if (v1 != (int) object->horzEdge.next)
object->horzEdge.snapped = false;
@@ -1388,7 +1388,7 @@ WobblyScreen::preparePaint (int msSinceLastPaint)
}
decorTop = bottommostYPos +
- w->output ().top - w->input ().top;
+ w->output ().top - w->border ().top;
decorTitleBottom = topmostYPos + w->output ().top;
if (constraintBox->y () > decorTop)
diff --git a/src/window.cpp b/src/window.cpp
index 817dc58..53fe4d8 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -4999,12 +4999,18 @@ CompWindow::shaded ()
}
CompWindowExtents &
-CompWindow::input () const
+CompWindow::border () const
{
return priv->border;
}
CompWindowExtents &
+CompWindow::input () const
+{
+ return priv->input;
+}
+
+CompWindowExtents &
CompWindow::output () const
{
return priv->output;
@@ -5631,10 +5637,15 @@ CompWindow::setWindowFrameExtents (CompWindowExtents *b,
recalcActions ();
- data[0] = i->left;
- data[1] = i->right;
- data[2] = i->top;
- data[3] = i->bottom;
+ /* Use b for _NET_WM_FRAME_EXTENTS here because
+ * that is the representation of the actual decoration
+ * around the window that the user sees and should
+ * be used for placement and such */
+
+ data[0] = b->left;
+ data[1] = b->right;
+ data[2] = b->top;
+ data[3] = b->bottom;
XChangeProperty (screen->dpy (), priv->id,
Atoms::frameExtents,
diff --git a/src/windowgeometry.cpp b/src/windowgeometry.cpp
index 1bbefd6..6d51fa5 100644
--- a/src/windowgeometry.cpp
+++ b/src/windowgeometry.cpp
@@ -162,6 +162,28 @@ CompWindow::serverSize () const
}
CompRect
+CompWindow::borderRect () const
+{
+ return CompRect (priv->geometry.x () - priv->border.left,
+ priv->geometry.y () - priv->border.top,
+ priv->geometry.width () +
+ priv->border.left + priv->border.right,
+ priv->geometry.height () +
+ priv->border.top + priv->border.bottom);
+}
+
+CompRect
+CompWindow::serverBorderRect () const
+{
+ return CompRect (priv->serverGeometry.x () - priv->border.left,
+ priv->serverGeometry.y () - priv->border.top,
+ priv->serverGeometry.width () +
+ priv->border.left + priv->border.right,
+ priv->serverGeometry.height () +
+ priv->border.top + priv->border.bottom);
+}
+
+CompRect
CompWindow::inputRect () const
{
return CompRect (priv->geometry.x () - priv->input.left,