add a RECT_ADD macro
authorDerek Foreman <foremande@gmail.com>
Thu, 20 May 2010 23:41:16 +0000 (19:41 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 26 Jun 2010 23:30:45 +0000 (01:30 +0200)
openbox/geom.h

index 003b0081dbe9f8221df8961db0eb4eeb02e5aae7..4a36cfc0189b2c32c1e3f4779f97d62a5a941575 100644 (file)
@@ -93,6 +93,12 @@ typedef struct _Rect {
     ((o).x < (r).x + (r).width && (o).x + (o).width > (r).x && \
      (o).y < (r).y + (r).height && (o).y + (o).height > (r).y)
 
+#define RECT_ADD(o, a, b) \
+    ((o).x = MIN((a).x, (b).x), \
+     (o).y = MIN((a).y, (b).y), \
+     (o).width = MAX((a).x + (a).width, (b).x + (b).width) - (o).x, \
+     (o).height = MAX((a).y + (a).height, (b).y + (b).height) - (o).y)
+
 /* Sets Rect r to be the intersection of Rect a and b. */
 #define RECT_SET_INTERSECTION(r, a, b) \
     ((r).x = MAX((a).x, (b).x), \