mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
x: add the x_get_visual_for_depth function
it returns the first found visual for the given depth
(cherry picked from commit 4401666cfb
)
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
e0aa6f9107
commit
d3a108b3db
2 changed files with 17 additions and 0 deletions
15
src/x.c
15
src/x.c
|
@ -321,6 +321,21 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return XCB_NONE;
|
||||
}
|
||||
|
||||
xcb_render_pictformat_t
|
||||
x_get_pictfmt_for_standard(struct x_connection *c, xcb_pict_standard_t std) {
|
||||
x_get_server_pictfmts(c);
|
||||
|
|
2
src/x.h
2
src/x.h
|
@ -411,6 +411,8 @@ 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_render_pictformat_t
|
||||
x_get_pictfmt_for_standard(struct x_connection *c, xcb_pict_standard_t std);
|
||||
|
||||
|
|
Loading…
Reference in a new issue