X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fgeom.h;h=8ac0e550830980d4ea05f612389155278cb891ce;hb=d68116c9c9b2c9a9925d872141eff8e301ef3bb3;hp=67a82cded06ae4a984b5015f354f628c99f19557;hpb=8f87a8af62c092617e7b5f4733d18ed11109f2ac;p=chaz%2Fopenbox diff --git a/openbox/geom.h b/openbox/geom.h index 67a82cde..8ac0e550 100644 --- a/openbox/geom.h +++ b/openbox/geom.h @@ -20,6 +20,24 @@ #ifndef __geom_h #define __geom_h +#include + +typedef struct _GravityCoord { + gint pos; + gint denom; + gboolean center; + gboolean opposite; +} GravityCoord; + +typedef struct _GravityPoint { + GravityCoord x; + GravityCoord y; +} GravityPoint; + +#define GRAVITY_COORD_SET(c, p, cen, opp) \ + (c).pos = (p), (c).center = (cen), (c).opposite = (opp) + + typedef struct _Point { int x; int y; @@ -47,6 +65,8 @@ typedef struct _Rect { #define RECT_RIGHT(r) ((r).x + (r).width - 1) #define RECT_BOTTOM(r) ((r).y + (r).height - 1) +#define RECT_AREA(r) ((r).width * (r).height) + #define RECT_SET_POINT(r, nx, ny) \ (r).x = (nx), (r).y = (ny) #define RECT_SET_SIZE(r, w, h) \ @@ -142,4 +162,7 @@ typedef struct _StrutPartial { (s1).bottom_start == (s2).bottom_start && \ (s1).bottom_end == (s2).bottom_end) +#define RANGES_INTERSECT(r1x, r1w, r2x, r2w) \ + (r1w && r2w && r1x < r2x + r2w && r1x + r1w > r2x) + #endif