]> git.lizzy.rs Git - bspwm.git/blob - helpers.h
New message: 'mouse'
[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 <stdint.h>
8
9 #define LENGTH(x)         (sizeof(x) / sizeof(*x))
10 #define MAX(A, B)         ((A) > (B) ? (A) : (B))
11 #define MIN(A, B)         ((A) < (B) ? (A) : (B))
12 #define BOOLSTR(A)        ((A) ? "true" : "false")
13
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 #define MAXLEN 256
17
18 #define REMLEN(x)         (BUFSIZ - strlen(x) - 1)
19
20 #ifdef DEBUG
21 #  define PUTS(x)         puts(x)
22 #  define PRINTF(x,...)   printf(x, __VA_ARGS__)
23 #else
24 #  define PUTS(x)         ((void)0)
25 #  define PRINTF(x,...)   ((void)0)
26 #endif
27
28 void warn(char *, ...);
29 __attribute__((noreturn))
30 void err(char *, ...);
31 uint32_t get_color(char *);
32 void update_pointer_position(xcb_point_t *);
33
34 #endif