tdebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xrescheck.h 1.7KB

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