Convert usage of XCreatePixmap to xcb

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-09-29 12:00:18 +02:00
parent ea9942b87e
commit 529306e65f
3 changed files with 21 additions and 20 deletions

View File

@ -628,10 +628,10 @@ win_build_shadow(session_t *ps, win *w, double opacity) {
return None; return None;
} }
shadow_pixmap = XCreatePixmap(ps->dpy, ps->root, shadow_pixmap = xcb_generate_id(c);
shadow_image->width, shadow_image->height, 8); shadow_pixmap_argb = xcb_generate_id(c);
shadow_pixmap_argb = XCreatePixmap(ps->dpy, ps->root, xcb_create_pixmap(c, 8, shadow_pixmap, ps->root, shadow_image->width, shadow_image->height);
shadow_image->width, shadow_image->height, 32); xcb_create_pixmap(c, 32, shadow_pixmap_argb, ps->root, shadow_image->width, shadow_image->height);
if (!shadow_pixmap || !shadow_pixmap_argb) { if (!shadow_pixmap || !shadow_pixmap_argb) {
printf_errf("(): failed to create shadow pixmaps"); printf_errf("(): failed to create shadow pixmaps");
@ -701,9 +701,9 @@ solid_picture(session_t *ps, bool argb, double a,
xcb_rectangle_t rect; xcb_rectangle_t rect;
xcb_connection_t *c = XGetXCBConnection(ps->dpy); xcb_connection_t *c = XGetXCBConnection(ps->dpy);
pixmap = XCreatePixmap(ps->dpy, ps->root, 1, 1, argb ? 32 : 8); pixmap = xcb_generate_id(c);
if (!pixmap) return None; if (!pixmap) return None;
xcb_create_pixmap(c, argb ? 32 : 8, pixmap, ps->root, 1, 1);
pa.repeat = True; pa.repeat = True;
picture = x_create_picture_with_standard_and_pixmap(ps, picture = x_create_picture_with_standard_and_pixmap(ps,
@ -892,7 +892,8 @@ get_root_tile(session_t *ps) {
// Create a pixmap if there isn't any // Create a pixmap if there isn't any
if (!pixmap) { if (!pixmap) {
pixmap = XCreatePixmap(ps->dpy, ps->root, 1, 1, ps->depth); pixmap = xcb_generate_id(c);
xcb_create_pixmap(c, ps->depth, pixmap, ps->root, 1, 1);
fill = true; fill = true;
} }
@ -1709,8 +1710,9 @@ paint_all(session_t *ps, XserverRegion region, XserverRegion region_real, win *t
else { else {
if (!ps->tgt_buffer.pixmap) { if (!ps->tgt_buffer.pixmap) {
free_paint(ps, &ps->tgt_buffer); free_paint(ps, &ps->tgt_buffer);
ps->tgt_buffer.pixmap = XCreatePixmap(ps->dpy, ps->root, ps->tgt_buffer.pixmap = xcb_generate_id(c);
ps->root_width, ps->root_height, ps->depth); xcb_create_pixmap(c, ps->depth, ps->tgt_buffer.pixmap,
ps->root, ps->root_width, ps->root_height);
} }
if (BKEND_GLX != ps->o.backend) if (BKEND_GLX != ps->o.backend)

View File

@ -193,9 +193,11 @@ x_create_picture(session_t *ps, int wid, int hei,
int depth = pictfmt->depth; int depth = pictfmt->depth;
Pixmap tmp_pixmap = XCreatePixmap(ps->dpy, ps->root, wid, hei, depth); xcb_connection_t *c = XGetXCBConnection(ps->dpy);
Pixmap tmp_pixmap = xcb_generate_id(c);
if (!tmp_pixmap) if (!tmp_pixmap)
return None; return None;
xcb_create_pixmap(c, depth, tmp_pixmap, ps->root, wid, hei);
xcb_render_picture_t picture = xcb_render_picture_t picture =
x_create_picture_with_pictfmt_and_pixmap(ps, pictfmt, tmp_pixmap, valuemask, attr); x_create_picture_with_pictfmt_and_pixmap(ps, pictfmt, tmp_pixmap, valuemask, attr);

View File

@ -35,18 +35,15 @@ xrc_clear_xid(void);
// Pixmap // Pixmap
static inline Pixmap static inline void
XCreatePixmap_(Display *dpy, Drawable drawable, xcb_create_pixmap_(xcb_connection_t *c, uint8_t depth, xcb_pixmap_t pixmap,
unsigned int width, unsigned int height, unsigned int depth, xcb_drawable_t drawable, uint16_t width, uint16_t height, M_POS_DATA_PARAMS) {
M_POS_DATA_PARAMS) { xcb_create_pixmap(c, depth, pixmap, drawable, width, height);
Pixmap ret = XCreatePixmap(dpy, drawable, width, height, depth); xrc_add_xid_(pixmap, "Pixmap", M_POS_DATA_PASSTHROUGH);
if (ret)
xrc_add_xid_(ret, "Pixmap", M_POS_DATA_PASSTHROUGH);
return ret;
} }
#define XCreatePixmap(dpy, drawable, width, height, depth) \ #define xcb_create_pixmap(c, depth, pixmap, drawable, width, height) \
XCreatePixmap_(dpy, drawable, width, height, depth, M_POS_DATA) xcb_create_pixmap_(c, depth, pixmap, drawable, width, height, M_POS_DATA)
static inline xcb_pixmap_t static inline xcb_pixmap_t
xcb_composite_name_window_pixmap_(xcb_connection_t *c, xcb_window_t window, xcb_pixmap_t pixmap, M_POS_DATA_PARAMS) { xcb_composite_name_window_pixmap_(xcb_connection_t *c, xcb_window_t window, xcb_pixmap_t pixmap, M_POS_DATA_PARAMS) {