]> git.lizzy.rs Git - bspwm.git/blob - helpers.h
Remove logo directory
[bspwm.git] / helpers.h
1 #ifndef _HELPERS_H
2 #define _HELPERS_H
3
4 #include <xcb/xcb.h>
5 #include <stdarg.h>
6 #include <stdio.h>
7 #include <stdbool.h>
8 #include <stdint.h>
9
10 #define LENGTH(x)         (sizeof(x) / sizeof(*x))
11 #define MAX(A, B)         ((A) > (B) ? (A) : (B))
12 #define MIN(A, B)         ((A) < (B) ? (A) : (B))
13 #define BOOLSTR(A)        ((A) ? "true" : "false")
14
15 #define XCB_CONFIG_WINDOW_X_Y               XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
16 #define XCB_CONFIG_WINDOW_WIDTH_HEIGHT      XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT
17 #define XCB_CONFIG_WINDOW_X_Y_WIDTH_HEIGHT  XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT
18
19 #define MAXLEN    256
20 #define INIT_CAP    8
21
22 #define REMLEN(x)         (BUFSIZ - strlen(x) - 1)
23 #define streq(s1, s2)     (strcmp((s1), (s2)) == 0)
24
25 #ifdef DEBUG
26 #  define PUTS(x)         puts(x)
27 #  define PRINTF(x,...)   printf(x, __VA_ARGS__)
28 #else
29 #  define PUTS(x)         ((void)0)
30 #  define PRINTF(x,...)   ((void)0)
31 #endif
32
33 void warn(char *, ...);
34 __attribute__((noreturn))
35 void err(char *, ...);
36 bool get_color(char *, xcb_window_t, uint32_t *);
37 double distance(xcb_point_t, xcb_point_t);
38
39 #endif