]> icculus.org git repositories - dana/openbox.git/blob - openbox/geom.h
dont toggle when no client was passed to teh action
[dana/openbox.git] / openbox / geom.h
1 #ifndef __geom_h
2 #define __geom_h
3
4 typedef struct Point {
5     int x;
6     int y;
7 } Point;
8
9 #define POINT_SET(pt, nx, ny) (pt).x = (nx), (pt).y = (ny)
10
11 typedef struct Size {
12     int width;
13     int height;
14 } Size;
15
16 #define SIZE_SET(sz, w, h) (sz).width = (w), (sz).height = (h)
17
18 typedef struct Rect {
19     int x;
20     int y;
21     int width;
22     int height;
23 } Rect;
24
25 #define RECT_SET_POINT(r, nx, ny) \
26     (r).x = (ny), (r).y = (ny)
27 #define RECT_SET_SIZE(r, w, h) \
28     (r).width = (w), (r).height = (h)
29 #define RECT_SET(r, nx, ny, w, h) \
30     (r).x = (nx), (r).y = (ny), (r).width = (w), (r).height = (h)
31
32 #define RECT_EQUAL(r1, r2) ((r1).x == (r2).x && (r1).y == (r2).y && \
33                             (r1).width == (r2).width && \
34                             (r1).height == (r2).height)
35
36 #define RECT_CONTAINS(r, x, y) \
37     (x >= (r).x && x < (r).x + (r).width && \
38      y >= (r).y && y < (r).y + (r).height)
39
40 typedef struct Strut {
41     int left;
42     int top;
43     int right;
44     int bottom;
45 } Strut;
46
47 #define STRUT_SET(s, l, t, r, b) \
48     (s).left = (l), (s).top = (t), (s).right = (r), (s).bottom = (b)
49
50 #define STRUT_ADD(s1, s2) \
51     (s1).left = MAX((s1).left, (s2).left), \
52     (s1).right = MAX((s1).right, (s2).right), \
53     (s1).top = MAX((s1).top, (s2).top), \
54     (s1).bottom = MAX((s1).bottom, (s2).bottom)
55
56 #endif