]> Dogcows Code - chaz/openbox/blobdiff - openbox/geom.h
very cool struts. partial struts actually are partial struts now. possibly way broken...
[chaz/openbox] / openbox / geom.h
index e77228c15545f2dcace0f27209a4f4d368abb58c..c71dbc239a79d2af83b21793d63e85ff612526a6 100644 (file)
@@ -2,7 +2,7 @@
 
    geom.h for the Openbox window manager
    Copyright (c) 2006        Mikael Magnusson
-   Copyright (c) 2003        Ben Jansens
+   Copyright (c) 2003-2007   Dana Jansens
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@ typedef struct _Point {
 } Point;
 
 #define POINT_SET(pt, nx, ny) (pt).x = (nx), (pt).y = (ny)
+#define POINT_EQUAL(p1, p2) ((p1).x == (p2).x && (p1).y == (p2).y)
 
 typedef struct _Size {
     int width;
@@ -56,6 +57,11 @@ typedef struct _Rect {
 #define RECT_EQUAL(r1, r2) ((r1).x == (r2).x && (r1).y == (r2).y && \
                             (r1).width == (r2).width && \
                             (r1).height == (r2).height)
+#define RECT_EQUAL_DIMS(r, x, y, w, h) \
+    ((r).x == (x) && (r).y == (y) && (r).width == (w) && (r).height == (h))
+
+#define RECT_TO_DIMS(r, x, y, w, h) \
+    (x) = (r).x, (y) = (r).y, (w) = (r).width, (h) = (r).height
 
 #define RECT_CONTAINS(r, px, py) \
     ((px) >= (r).x && (px) < (r).x + (r).width && \
@@ -136,4 +142,7 @@ typedef struct _StrutPartial {
      (s1).bottom_start == (s2).bottom_start && \
      (s1).bottom_end == (s2).bottom_end)
 
+#define RANGE_INTERSECT(r1x, r1w, r2x, r2w) \
+    (r1x < r2x + r2w && r1x + r1w > r2x)
+
 #endif
This page took 0.021289 seconds and 4 git commands to generate.