]> Dogcows Code - chaz/openbox/blob - c/geom.h
merge the C branch into HEAD
[chaz/openbox] / c / geom.h
1 #ifndef __geom_h
2 #define __geom_h
3
4 #ifdef HAVE_ASSERT_H
5 # include <assert.h>
6 #endif
7
8 typedef struct Point {
9 int x;
10 int y;
11 } Point;
12
13 #define POINT_SET(pt, nx, ny) {pt.x = nx; pt.y = ny;}
14
15 typedef struct Size {
16 int width;
17 int height;
18 } Size;
19
20 #define SIZE_SET(sz, w, h) {sz.width = w; sz.height = h;}
21
22 typedef struct Rect {
23 int x;
24 int y;
25 int width;
26 int height;
27 } Rect;
28
29 #define RECT_SET_POINT(r, nx, ny) \
30 {r.x = ny; r.y = ny;}
31 #define RECT_SET_SIZE(r, w, h) \
32 {r.width = w; r.height = h;}
33 #define RECT_SET(r, nx, ny, w, h) \
34 {r.x = nx; r.y = ny; r.width = w; r.height = h;}
35
36 #define RECT_EQUAL(r1, r2) (r1.x == r2.x && r1.y == r2.y && \
37 r1.width == r2.width && r1.height == r2.height)
38
39 typedef struct Strut {
40 int left;
41 int top;
42 int right;
43 int bottom;
44 } Strut;
45
46 #define STRUT_SET(s, l, t, r, b) \
47 {s.left = l; s.top = t; s.right = r; s.bottom = b; }
48
49 #define STRUT_ADD(s1, s2) \
50 {s1.left = MAX(s1.left, s2.left); s1.right = MAX(s1.right, s2.right); \
51 s1.top = MAX(s1.top, s2.top); s1.bottom = MAX(s1.bottom, s2.bottom); }
52
53 #endif
This page took 0.0363 seconds and 5 git commands to generate.