draw: Add function for finding a visual by id
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
3edd216560
commit
bb304c80a3
9
draw.c
9
draw.c
|
@ -239,7 +239,7 @@ draw_load_image(lua_State *L, const char *path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xcb_visualtype_t *draw_default_visual(const xcb_screen_t *s)
|
||||
xcb_visualtype_t *draw_find_visual(const xcb_screen_t *s, xcb_visualid_t visual)
|
||||
{
|
||||
xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(s);
|
||||
|
||||
|
@ -247,12 +247,17 @@ xcb_visualtype_t *draw_default_visual(const xcb_screen_t *s)
|
|||
for(; depth_iter.rem; xcb_depth_next (&depth_iter))
|
||||
for(xcb_visualtype_iterator_t visual_iter = xcb_depth_visuals_iterator(depth_iter.data);
|
||||
visual_iter.rem; xcb_visualtype_next (&visual_iter))
|
||||
if(s->root_visual == visual_iter.data->visual_id)
|
||||
if(visual == visual_iter.data->visual_id)
|
||||
return visual_iter.data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xcb_visualtype_t *draw_default_visual(const xcb_screen_t *s)
|
||||
{
|
||||
return draw_find_visual(s, s->root_visual);
|
||||
}
|
||||
|
||||
xcb_visualtype_t *draw_argb_visual(const xcb_screen_t *s)
|
||||
{
|
||||
xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(s);
|
||||
|
|
1
draw.h
1
draw.h
|
@ -70,6 +70,7 @@ cairo_surface_t *draw_surface_from_data(int width, int height, uint32_t *data);
|
|||
cairo_surface_t *draw_dup_image_surface(cairo_surface_t *surface);
|
||||
cairo_surface_t *draw_load_image(lua_State *L, const char *path);
|
||||
|
||||
xcb_visualtype_t *draw_find_visual(const xcb_screen_t *s, xcb_visualid_t visual);
|
||||
xcb_visualtype_t *draw_default_visual(const xcb_screen_t *s);
|
||||
xcb_visualtype_t *draw_argb_visual(const xcb_screen_t *s);
|
||||
uint8_t draw_visual_depth(const xcb_screen_t *s, xcb_visualid_t vis);
|
||||
|
|
Loading…
Reference in New Issue