summaryrefslogtreecommitdiff
path: root/src/rect.cpp
diff options
context:
space:
mode:
authorEduardo Gurgel Pinho <eduardo@mad4.Chagas>2009-03-06 22:58:34 -0300
committerDennis Kasprzyk <onestone@compiz-fusion.org>2009-03-10 00:23:35 +0100
commit5041f18da51155345debabcbe8232591eb2220c8 (patch)
treec6955d97f752ade3ca6a7ff3a2ba51c0def602a1 /src/rect.cpp
parent2baea8f10ebd2d85d0298b40c5d1f40f86bb5b72 (diff)
downloadunity-window-decorator-5041f18da51155345debabcbe8232591eb2220c8.tar.gz
unity-window-decorator-5041f18da51155345debabcbe8232591eb2220c8.tar.bz2
Better definition to CompRect
Diffstat (limited to 'src/rect.cpp')
-rw-r--r--src/rect.cpp53
1 files changed, 34 insertions, 19 deletions
diff --git a/src/rect.cpp b/src/rect.cpp
index ee51ffd..2e5d82c 100644
--- a/src/rect.cpp
+++ b/src/rect.cpp
@@ -36,14 +36,14 @@ CompRect::CompRect ()
mRegion.extents.y2 = 0;
}
-CompRect::CompRect (int x1, int x2, int y1, int y2)
+CompRect::CompRect (int x, int y, unsigned int width, unsigned int height)
{
mRegion.rects = &mRegion.extents;
mRegion.numRects = 1;
- mRegion.extents.x1 = x1;
- mRegion.extents.x2 = x2;
- mRegion.extents.y1 = y1;
- mRegion.extents.y2 = y2;
+ mRegion.extents.x1 = x;
+ mRegion.extents.y1 = y;
+ mRegion.extents.x2 = x + width;
+ mRegion.extents.y2 = y + height;
}
CompRect::CompRect (const CompRect& r)
@@ -57,8 +57,8 @@ CompRect::CompRect (const XRectangle xr)
mRegion.rects = &mRegion.extents;
mRegion.numRects = 1;
mRegion.extents.x1 = xr.x;
- mRegion.extents.x2 = xr.x + xr.width;
mRegion.extents.y1 = xr.y;
+ mRegion.extents.x2 = xr.x + xr.width;
mRegion.extents.y2 = xr.y + xr.height;
}
@@ -68,21 +68,36 @@ CompRect::region () const
return const_cast<const Region> (&mRegion);
}
+
void
-CompRect::setGeometry (int x1, int x2, int y1, int y2)
+CompRect::setGeometry (int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
+{
+ mRegion.extents.x1 = x;
+ mRegion.extents.y1 = y;
+ mRegion.extents.x2 = x + width;
+ mRegion.extents.y2 = y + height;
+}
+
+void CompRect::setX (int x)
+{
+ mRegion.extents.x1 = x;
+}
+
+void CompRect::setY (int y)
+{
+ mRegion.extents.y1 = y;
+
+}
+void CompRect::setWidth (unsigned int width)
+{
+ mRegion.extents.x2 = mRegion.extents.x1 + width;
+}
+void CompRect::setHeight (unsigned int height)
{
- mRegion.extents.x1 = x1;
- mRegion.extents.y1 = y1;
-
- if (x2 < x1)
- mRegion.extents.x2 = x1;
- else
- mRegion.extents.x2 = x2;
-
- if (y2 < y1)
- mRegion.extents.y2 = y1;
- else
- mRegion.extents.y2 = y2;
+ mRegion.extents.y2 = mRegion.extents.y1 + height;
}
bool