swim.git

util.h

espurr
/* swim - window manager
 * Copyright (C) 2022-2023 ArcNyxx
 * see LICENCE file for licensing information */

#ifndef UTIL_H
#define UTIL_H

#include <stddef.h>

#define MAX(num1, num2) ((num1) > (num2) ? (num1) : (num2))
#define MIN(num1, num2) ((num1) < (num2) ? (num1) : (num2))
#define LENGTH(array) (sizeof(array) / sizeof(array[0]))

#define VIS(cli) (cli->tags & cli->mon->tags)

#define DEF(what) Default ## what(dpy, DefaultScreen(dpy))
#define ROOT DefaultRootWindow(dpy)

#define ID xcb_generate_id

#define IGMASK (LockMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod5Mask)

void die(const char *fmt, ...);
void *srealloc(void *ptr, size_t size);

#endif /* UTIL_H */