summaryrefslogtreecommitdiff
path: root/src/output.cpp
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2009-03-11 07:32:33 +0100
committerDanny Baumann <dannybaumann@web.de>2009-03-11 07:32:33 +0100
commitf12bc00800ab34441051df2492c620f70edb6bda (patch)
tree80a7fdd82d1363f38390b71fa203e602191fd4a3 /src/output.cpp
parenta4a78a11404ef2de948c8028a1ec47df42fd3c9b (diff)
downloadunity-window-decorator-f12bc00800ab34441051df2492c620f70edb6bda.tar.gz
unity-window-decorator-f12bc00800ab34441051df2492c620f70edb6bda.tar.bz2
Derive CompWindow::Geometry from CompRect and improve CompRect usage.
Diffstat (limited to 'src/output.cpp')
-rw-r--r--src/output.cpp47
1 files changed, 18 insertions, 29 deletions
diff --git a/src/output.cpp b/src/output.cpp
index e9f5920..58a66fa 100644
--- a/src/output.cpp
+++ b/src/output.cpp
@@ -32,11 +32,6 @@ CompOutput::CompOutput ()
{
mName = "";
mId = ~0;
-
- mWorkArea.x = 0;
- mWorkArea.y = 0;
- mWorkArea.width = 0;
- mWorkArea.height = 0;
}
CompString
@@ -51,45 +46,39 @@ CompOutput::id () const
return mId;
}
-XRectangle
+const CompRect&
CompOutput::workArea () const
{
return mWorkArea;
}
void
-CompOutput::setWorkArea (XRectangle workarea)
+CompOutput::setWorkArea (const CompRect& workarea)
{
- if (workarea.x < (int) x1 ())
- mWorkArea.x = x1 ();
- else
- mWorkArea.x = workarea.x;
+ mWorkArea = workarea;
- if (workarea.y < (int) y1 ())
- mWorkArea.y = y1 ();
- else
- mWorkArea.y = workarea.y;
+ if (workarea.x () < (int) x1 ())
+ mWorkArea.setX (x1 ());
- if (workarea.x + workarea.width > (int) x2 ())
- mWorkArea.width = x2 () - mWorkArea.x;
- else
- mWorkArea.width = workarea.width;
+ if (workarea.y () < (int) y1 ())
+ mWorkArea.setY (y1 ());
- if (workarea.y + workarea.height > (int) y2 ())
- mWorkArea.height = y2 () - mWorkArea.y;
- else
- mWorkArea.height = workarea.height;
+ if (workarea.x2 () > (int) x2 ())
+ mWorkArea.setWidth (x2 () - mWorkArea.x ());
+ if (workarea.y2 () > (int) y2 ())
+ mWorkArea.setHeight (y2 () - mWorkArea.y ());
}
+
void
-CompOutput::setGeometry (int x1, int y1, unsigned int width, unsigned int height)
+CompOutput::setGeometry (int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
{
- CompRect::setGeometry (x1, y1, width, height);
+ CompRect::setGeometry (x, y, width, height);
- mWorkArea.x = this->x1 ();
- mWorkArea.y = this->y1 ();
- mWorkArea.width = this->width ();
- mWorkArea.height = this->height ();
+ mWorkArea = *this;
}
void