diff options
author | Bart Massey <bart@cs.pdx.edu> | 2007-12-07 00:14:29 -0800 |
---|---|---|
committer | Arnaud Fontaine <arnau@debian.org> | 2010-11-14 19:49:48 +0900 |
commit | 71f52d1a1807c471b713064adf249c90d73f3b3f (patch) | |
tree | 52f7c209971db568ef99a359495d45353b602e8c | |
parent | 1e170eafd033687165d4c4c0b77358c35d6c30de (diff) | |
download | xcb-util-71f52d1a1807c471b713064adf249c90d73f3b3f.tar.gz |
added xcb_aux_find_visual functions
-rw-r--r-- | aux/xcb_aux.c | 34 | ||||
-rw-r--r-- | aux/xcb_aux.h | 9 |
2 files changed, 43 insertions, 0 deletions
diff --git a/aux/xcb_aux.c b/aux/xcb_aux.c index 276c4de..d9a6295 100644 --- a/aux/xcb_aux.c +++ b/aux/xcb_aux.c @@ -78,6 +78,40 @@ xcb_aux_get_visualtype (xcb_connection_t *c, return NULL; } +xcb_visualtype_t * +xcb_aux_find_visual_by_id (xcb_screen_t *screen, + xcb_visualid_t id) +{ + xcb_depth_iterator_t i; + xcb_visualtype_iterator_t j; + for (i = xcb_screen_allowed_depths_iterator(screen); + i.rem; xcb_depth_next(&i)) + for (j = xcb_depth_visuals_iterator(i.data); + j.rem; xcb_visualtype_next(&j)) + if (j.data->visual_id == id) + return j.data; + return 0; +} + +xcb_visualtype_t * +xcb_aux_find_visual_by_attrs (xcb_screen_t *screen, + int8_t class, + int8_t depth) +{ + xcb_depth_iterator_t i; + xcb_visualtype_iterator_t j; + for (i = xcb_screen_allowed_depths_iterator(screen); + i.rem; xcb_depth_next(&i)) { + if (depth != -1 && i.data->depth != depth) + continue; + for (j = xcb_depth_visuals_iterator(i.data); + j.rem; xcb_visualtype_next(&j)) + if (class == -1 || j.data->visual_class == class) + return j.data; + } + return 0; +} + void xcb_aux_sync (xcb_connection_t *c) { diff --git a/aux/xcb_aux.h b/aux/xcb_aux.h index 9cc5448..e07a90f 100644 --- a/aux/xcb_aux.h +++ b/aux/xcb_aux.h @@ -20,6 +20,15 @@ xcb_visualtype_t *xcb_aux_get_visualtype (xcb_connection_t *c, int screen, xcb_visualid_t vid); +xcb_visualtype_t * +xcb_aux_find_visual_by_id (xcb_screen_t *screen, + xcb_visualid_t id); + +xcb_visualtype_t * +xcb_aux_find_visual_by_attrs (xcb_screen_t *screen, + int8_t class, + int8_t depth); + void xcb_aux_sync (xcb_connection_t *c); /* less error prone to use structs instead of value lists */ |