]> git.lizzy.rs Git - bspwm.git/blob - helpers.h
e89fa09f6dae94a965fe595c0e169bfb5c5451dc
[bspwm.git] / helpers.h
1 #ifndef _HELPERS_H
2 #define _HELPERS_H
3
4 #include <stdarg.h>
5 #include <stdio.h>
6 #include <stdint.h>
7
8 #define LENGTH(x)         (sizeof(x) / sizeof(*x))
9 #define MAX(A, B)         ((A) > (B) ? (A) : (B))
10 #define MIN(A, B)         ((A) < (B) ? (A) : (B))
11 #define BOOLSTR(A)        ((A) ? "true" : "false")
12
13 #define MAXLEN  256
14 #define XCB_CONFIG_WINDOW_X_Y_WIDTH_HEIGHT XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT
15 #define XCB_CONFIG_WINDOW_X_Y XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
16
17 #if 1
18 #  define PUTS(x)            puts(x);
19 #  define PRINTF(x,...)      printf(x, ##__VA_ARGS__);
20 #else
21 #  define PUTS(x)            ;
22 #  define PRINTF(x)          ;
23 #endif
24
25 void logmsg(FILE *, char *, va_list);
26 void warn(char *, ...);
27 __attribute__((noreturn))
28 void die(char *, ...);
29 uint32_t get_color(char *);
30
31 #endif