Replace use of XFreePixmap with XCB

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-09-29 11:53:30 +02:00
parent 9dff55540f
commit ea9942b87e
3 changed files with 10 additions and 9 deletions

View File

@ -2525,7 +2525,8 @@ wintype_arr_enable(bool arr[]) {
static inline void static inline void
free_pixmap(session_t *ps, Pixmap *p) { free_pixmap(session_t *ps, Pixmap *p) {
if (*p) { if (*p) {
XFreePixmap(ps->dpy, *p); xcb_connection_t *c = XGetXCBConnection(ps->dpy);
xcb_free_pixmap(c, *p);
*p = None; *p = None;
} }
} }

View File

@ -666,7 +666,7 @@ win_build_shadow(session_t *ps, win *w, double opacity) {
XFreeGC(ps->dpy, gc); XFreeGC(ps->dpy, gc);
xcb_image_destroy(shadow_image); xcb_image_destroy(shadow_image);
XFreePixmap(ps->dpy, shadow_pixmap); xcb_free_pixmap(c, shadow_pixmap);
xcb_render_free_picture(c, shadow_picture); xcb_render_free_picture(c, shadow_picture);
return true; return true;
@ -675,9 +675,9 @@ shadow_picture_err:
if (shadow_image) if (shadow_image)
xcb_image_destroy(shadow_image); xcb_image_destroy(shadow_image);
if (shadow_pixmap) if (shadow_pixmap)
XFreePixmap(ps->dpy, shadow_pixmap); xcb_free_pixmap(c, shadow_pixmap);
if (shadow_pixmap_argb) if (shadow_pixmap_argb)
XFreePixmap(ps->dpy, shadow_pixmap_argb); xcb_free_pixmap(c, shadow_pixmap_argb);
if (shadow_picture) if (shadow_picture)
xcb_render_free_picture(c, shadow_picture); xcb_render_free_picture(c, shadow_picture);
if (shadow_picture_argb) if (shadow_picture_argb)
@ -711,7 +711,7 @@ solid_picture(session_t *ps, bool argb, double a,
XCB_RENDER_CP_REPEAT, &pa); XCB_RENDER_CP_REPEAT, &pa);
if (!picture) { if (!picture) {
XFreePixmap(ps->dpy, pixmap); xcb_free_pixmap(c, pixmap);
return None; return None;
} }
@ -726,7 +726,7 @@ solid_picture(session_t *ps, bool argb, double a,
rect.height = 1; rect.height = 1;
xcb_render_fill_rectangles(c, XCB_RENDER_PICT_OP_SRC, picture, col, 1, &rect); 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; return picture;
} }

View File

@ -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) xcb_composite_name_window_pixmap_(dpy, window, pixmap, M_POS_DATA)
static inline void static inline void
XFreePixmap_(Display *dpy, Pixmap pixmap, M_POS_DATA_PARAMS) { xcb_free_pixmap_(xcb_connection_t *c, Pixmap pixmap, M_POS_DATA_PARAMS) {
XFreePixmap(dpy, pixmap); xcb_free_pixmap(c, pixmap);
xrc_delete_xid_(pixmap, M_POS_DATA_PASSTHROUGH); 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 #endif