mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
x: don't require an entire struct x_connection in x_get_visual_for_depth
inspired by the xcb-util's xcb_aux_get_depth_of_visual function implementation
This commit is contained in:
parent
c7591982b6
commit
23b0c5a1d5
4 changed files with 8 additions and 12 deletions
|
@ -1188,7 +1188,7 @@ void root_damaged(session_t *ps) {
|
||||||
xcb_visualid_t visual =
|
xcb_visualid_t visual =
|
||||||
r->depth == ps->c.screen_info->root_depth
|
r->depth == ps->c.screen_info->root_depth
|
||||||
? ps->c.screen_info->root_visual
|
? 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);
|
free(r);
|
||||||
|
|
||||||
ps->root_image = ps->backend_data->ops->bind_pixmap(
|
ps->root_image = ps->backend_data->ops->bind_pixmap(
|
||||||
|
|
|
@ -624,7 +624,7 @@ static bool get_root_tile(session_t *ps) {
|
||||||
} else {
|
} else {
|
||||||
visual = r->depth == ps->c.screen_info->root_depth
|
visual = r->depth == ps->c.screen_info->root_depth
|
||||||
? ps->c.screen_info->root_visual
|
? 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);
|
free(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
14
src/x.c
14
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);
|
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_visualid_t x_get_visual_for_depth(xcb_screen_t *screen, uint8_t depth) {
|
||||||
xcb_screen_iterator_t screen_it = xcb_setup_roots_iterator(xcb_get_setup(c->c));
|
xcb_depth_iterator_t depth_it = xcb_screen_allowed_depths_iterator(screen);
|
||||||
for (; screen_it.rem; xcb_screen_next(&screen_it)) {
|
for (; depth_it.rem; xcb_depth_next(&depth_it)) {
|
||||||
xcb_depth_iterator_t depth_it =
|
if (depth_it.data->depth == depth) {
|
||||||
xcb_screen_allowed_depths_iterator(screen_it.data);
|
return xcb_depth_visuals_iterator(depth_it.data).data->visual_id;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
src/x.h
2
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_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
|
xcb_render_pictformat_t
|
||||||
x_get_pictfmt_for_standard(struct x_connection *c, xcb_pict_standard_t std);
|
x_get_pictfmt_for_standard(struct x_connection *c, xcb_pict_standard_t std);
|
||||||
|
|
Loading…
Reference in a new issue