summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorWilliam Casarin <jb55@jb55.com>2018-07-09 10:19:59 -0700
committerWilliam Casarin <jb55@jb55.com>2018-07-09 10:19:59 -0700
commit55ae285ef587942dc34c5f95b7f97037deb791a2 (patch)
treeb9d1ce96f5ca0b43c207e88360cd6dff20b836d6 /util.h
parentd1dea11d1091b4eacefb8be73a0740f87444fe29 (diff)
getting there
Diffstat (limited to 'util.h')
-rw-r--r--util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/util.h b/util.h
index 1654832..597dd70 100644
--- a/util.h
+++ b/util.h
@@ -8,6 +8,12 @@
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
+#define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \
+ * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
+#define LENGTH(X) (sizeof X / sizeof X[0])
+#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+
+
void die(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size);