From ea9942b87eab63623c0219bed082c2cdcc83576e Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 29 Sep 2018 11:53:30 +0200 Subject: [PATCH] Replace use of XFreePixmap with XCB Signed-off-by: Uli Schlachter --- src/common.h | 3 ++- src/compton.c | 10 +++++----- src/xrescheck.h | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/common.h b/src/common.h index dad6a7e..04c2279 100644 --- a/src/common.h +++ b/src/common.h @@ -2525,7 +2525,8 @@ wintype_arr_enable(bool arr[]) { static inline void free_pixmap(session_t *ps, Pixmap *p) { if (*p) { - XFreePixmap(ps->dpy, *p); + xcb_connection_t *c = XGetXCBConnection(ps->dpy); + xcb_free_pixmap(c, *p); *p = None; } } diff --git a/src/compton.c b/src/compton.c index 5ffaba0..a1af16c 100644 --- a/src/compton.c +++ b/src/compton.c @@ -666,7 +666,7 @@ win_build_shadow(session_t *ps, win *w, double opacity) { XFreeGC(ps->dpy, gc); xcb_image_destroy(shadow_image); - XFreePixmap(ps->dpy, shadow_pixmap); + xcb_free_pixmap(c, shadow_pixmap); xcb_render_free_picture(c, shadow_picture); return true; @@ -675,9 +675,9 @@ shadow_picture_err: if (shadow_image) xcb_image_destroy(shadow_image); if (shadow_pixmap) - XFreePixmap(ps->dpy, shadow_pixmap); + xcb_free_pixmap(c, shadow_pixmap); if (shadow_pixmap_argb) - XFreePixmap(ps->dpy, shadow_pixmap_argb); + xcb_free_pixmap(c, shadow_pixmap_argb); if (shadow_picture) xcb_render_free_picture(c, shadow_picture); if (shadow_picture_argb) @@ -711,7 +711,7 @@ solid_picture(session_t *ps, bool argb, double a, XCB_RENDER_CP_REPEAT, &pa); if (!picture) { - XFreePixmap(ps->dpy, pixmap); + xcb_free_pixmap(c, pixmap); return None; } @@ -726,7 +726,7 @@ solid_picture(session_t *ps, bool argb, double a, rect.height = 1; xcb_render_fill_rectangles(c, XCB_RENDER_PICT_OP_SRC, picture, col, 1, &rect); - XFreePixmap(ps->dpy, pixmap); + xcb_free_pixmap(c, pixmap); return picture; } diff --git a/src/xrescheck.h b/src/xrescheck.h index 67aea3f..ce4bd60 100644 --- a/src/xrescheck.h +++ b/src/xrescheck.h @@ -60,11 +60,11 @@ xcb_composite_name_window_pixmap_(xcb_connection_t *c, xcb_window_t window, xcb_ xcb_composite_name_window_pixmap_(dpy, window, pixmap, M_POS_DATA) static inline void -XFreePixmap_(Display *dpy, Pixmap pixmap, M_POS_DATA_PARAMS) { - XFreePixmap(dpy, pixmap); +xcb_free_pixmap_(xcb_connection_t *c, Pixmap pixmap, M_POS_DATA_PARAMS) { + xcb_free_pixmap(c, pixmap); xrc_delete_xid_(pixmap, M_POS_DATA_PASSTHROUGH); } -#define XFreePixmap(dpy, pixmap) XFreePixmap_(dpy, pixmap, M_POS_DATA); +#define xcb_free_pixmap(c, pixmap) xcb_free_pixmap_(c, pixmap, M_POS_DATA); #endif