diff --git a/src/picom.c b/src/picom.c index c2cac46a..e968c656 100644 --- a/src/picom.c +++ b/src/picom.c @@ -1188,7 +1188,7 @@ void root_damaged(session_t *ps) { xcb_visualid_t visual = r->depth == ps->c.screen_info->root_depth ? ps->c.screen_info->root_visual - : x_get_visual_for_depth(&ps->c, r->depth); + : x_get_visual_for_depth(ps->c.screen_info, r->depth); free(r); ps->root_image = ps->backend_data->ops->bind_pixmap( diff --git a/src/render.c b/src/render.c index 9712974c..9321a8e7 100644 --- a/src/render.c +++ b/src/render.c @@ -624,7 +624,7 @@ static bool get_root_tile(session_t *ps) { } else { visual = r->depth == ps->c.screen_info->root_depth ? ps->c.screen_info->root_visual - : x_get_visual_for_depth(&ps->c, r->depth); + : x_get_visual_for_depth(ps->c.screen_info, r->depth); free(r); } diff --git a/src/x.c b/src/x.c index 84cf50e7..f33142b2 100644 --- a/src/x.c +++ b/src/x.c @@ -322,15 +322,11 @@ xcb_visualid_t x_get_visual_for_standard(struct x_connection *c, xcb_pict_standa return x_get_visual_for_pictfmt(g_pictfmts, pictfmt->id); } -xcb_visualid_t x_get_visual_for_depth(struct x_connection *c, uint8_t depth) { - xcb_screen_iterator_t screen_it = xcb_setup_roots_iterator(xcb_get_setup(c->c)); - for (; screen_it.rem; xcb_screen_next(&screen_it)) { - xcb_depth_iterator_t depth_it = - xcb_screen_allowed_depths_iterator(screen_it.data); - for (; depth_it.rem; xcb_depth_next(&depth_it)) { - if (depth_it.data->depth == depth) { - return xcb_depth_visuals_iterator(depth_it.data).data->visual_id; - } +xcb_visualid_t x_get_visual_for_depth(xcb_screen_t *screen, uint8_t depth) { + xcb_depth_iterator_t depth_it = xcb_screen_allowed_depths_iterator(screen); + for (; depth_it.rem; xcb_depth_next(&depth_it)) { + if (depth_it.data->depth == depth) { + return xcb_depth_visuals_iterator(depth_it.data).data->visual_id; } } diff --git a/src/x.h b/src/x.h index 38238395..cd4805db 100644 --- a/src/x.h +++ b/src/x.h @@ -397,7 +397,7 @@ struct xvisual_info x_get_visual_info(struct x_connection *c, xcb_visualid_t vis xcb_visualid_t x_get_visual_for_standard(struct x_connection *c, xcb_pict_standard_t std); -xcb_visualid_t x_get_visual_for_depth(struct x_connection *c, uint8_t depth); +xcb_visualid_t x_get_visual_for_depth(xcb_screen_t *screen, uint8_t depth); xcb_render_pictformat_t x_get_pictfmt_for_standard(struct x_connection *c, xcb_pict_standard_t std);