| 1 |
#ifndef COMPTON_XRESCHECK_H |
| 2 |
#define COMPTON_XRESCHECK_H |
| 3 |
|
| 4 |
#include "common.h" |
| 5 |
#include <uthash.h> |
| 6 |
|
| 7 |
typedef struct { |
| 8 |
XID xid; |
| 9 |
const char *type; |
| 10 |
const char *file; |
| 11 |
const char *func; |
| 12 |
int line; |
| 13 |
UT_hash_handle hh; |
| 14 |
} xrc_xid_record_t; |
| 15 |
|
| 16 |
#define M_POS_DATA_PARAMS const char *file, int line, const char *func |
| 17 |
#define M_POS_DATA_PASSTHROUGH file, line, func |
| 18 |
#define M_POS_DATA __FILE__, __LINE__, __func__ |
| 19 |
|
| 20 |
void |
| 21 |
xrc_add_xid_(XID xid, const char *type, M_POS_DATA_PARAMS); |
| 22 |
|
| 23 |
#define xrc_add_xid(xid, type) xrc_add_xid_(xid, type, M_POS_DATA) |
| 24 |
|
| 25 |
void |
| 26 |
xrc_delete_xid_(XID xid, M_POS_DATA_PARAMS); |
| 27 |
|
| 28 |
#define xrc_delete_xid(xid) xrc_delete_xid_(xid, M_POS_DATA) |
| 29 |
|
| 30 |
void |
| 31 |
xrc_report_xid(void); |
| 32 |
|
| 33 |
void |
| 34 |
xrc_clear_xid(void); |
| 35 |
|
| 36 |
// Pixmap |
| 37 |
|
| 38 |
static inline Pixmap |
| 39 |
XCreatePixmap_(Display *dpy, Drawable drawable, |
| 40 |
unsigned int width, unsigned int height, unsigned int depth, |
| 41 |
M_POS_DATA_PARAMS) { |
| 42 |
Pixmap ret = XCreatePixmap(dpy, drawable, width, height, depth); |
| 43 |
if (ret) |
| 44 |
xrc_add_xid_(ret, "Pixmap", M_POS_DATA_PASSTHROUGH); |
| 45 |
return ret; |
| 46 |
} |
| 47 |
|
| 48 |
#define XCreatePixmap(dpy, drawable, width, height, depth) \ |
| 49 |
XCreatePixmap_(dpy, drawable, width, height, depth, M_POS_DATA) |
| 50 |
|
| 51 |
static inline Pixmap |
| 52 |
XCompositeNameWindowPixmap_(Display *dpy, Window window, M_POS_DATA_PARAMS) { |
| 53 |
Pixmap ret = XCompositeNameWindowPixmap(dpy, window); |
| 54 |
if (ret) |
| 55 |
xrc_add_xid_(ret, "PixmapC", M_POS_DATA_PASSTHROUGH); |
| 56 |
return ret; |
| 57 |
} |
| 58 |
|
| 59 |
#define XCompositeNameWindowPixmap(dpy, window) \ |
| 60 |
XCompositeNameWindowPixmap_(dpy, window, M_POS_DATA) |
| 61 |
|
| 62 |
static inline void |
| 63 |
XFreePixmap_(Display *dpy, Pixmap pixmap, M_POS_DATA_PARAMS) { |
| 64 |
XFreePixmap(dpy, pixmap); |
| 65 |
xrc_delete_xid_(pixmap, M_POS_DATA_PASSTHROUGH); |
| 66 |
} |
| 67 |
|
| 68 |
#define XFreePixmap(dpy, pixmap) XFreePixmap_(dpy, pixmap, M_POS_DATA); |
| 69 |
|
| 70 |
#endif |