Revert "Use an ARGB visual if one is available (FS#829)"

This reverts commit 643ec85117.
This commit is contained in:
Uli Schlachter 2010-09-30 20:56:45 +02:00
parent 643ec85117
commit 2452747e04
1 changed files with 3 additions and 43 deletions

View File

@ -157,7 +157,7 @@ scan(void)
} }
static xcb_visualtype_t * static xcb_visualtype_t *
a_default_visual(xcb_screen_t *s) screen_default_visual(xcb_screen_t *s)
{ {
xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(s); xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(s);
@ -171,36 +171,6 @@ a_default_visual(xcb_screen_t *s)
return NULL; return NULL;
} }
static xcb_visualtype_t *
a_argb_visual(xcb_screen_t *s)
{
xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(s);
if(depth_iter.data)
for(; depth_iter.rem; xcb_depth_next (&depth_iter))
if(depth_iter.data->depth == 32)
for(xcb_visualtype_iterator_t visual_iter = xcb_depth_visuals_iterator(depth_iter.data);
visual_iter.rem; xcb_visualtype_next (&visual_iter))
return visual_iter.data;
return NULL;
}
static uint8_t
a_visual_depth(xcb_screen_t *s, xcb_visualid_t vis)
{
xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(s);
if(depth_iter.data)
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(vis == visual_iter.data->visual_id)
return depth_iter.data->depth;
fatal("Could not find a visual's depth");
}
static void static void
a_refresh_cb(EV_P_ ev_prepare *w, int revents) a_refresh_cb(EV_P_ ev_prepare *w, int revents)
{ {
@ -404,19 +374,9 @@ main(int argc, char **argv)
fatal("cannot open display"); fatal("cannot open display");
globalconf.screen = xcb_aux_get_screen(globalconf.connection, globalconf.default_screen); globalconf.screen = xcb_aux_get_screen(globalconf.connection, globalconf.default_screen);
globalconf.visual = a_argb_visual(globalconf.screen); globalconf.visual = screen_default_visual(globalconf.screen);
if(!globalconf.visual) globalconf.default_depth = globalconf.screen->root_depth;
globalconf.visual = a_default_visual(globalconf.screen);
globalconf.default_depth = a_visual_depth(globalconf.screen, globalconf.visual->visual_id);
globalconf.default_cmap = globalconf.screen->default_colormap; globalconf.default_cmap = globalconf.screen->default_colormap;
if(globalconf.default_depth != globalconf.screen->root_depth)
{
// We need our own color map if we aren't using the default depth
globalconf.default_cmap = xcb_generate_id(globalconf.connection);
xcb_create_colormap(globalconf.connection, XCB_COLORMAP_ALLOC_NONE,
globalconf.default_cmap, globalconf.screen->root,
globalconf.visual->visual_id);
}
/* Prefetch all the extensions we might need */ /* Prefetch all the extensions we might need */
xcb_prefetch_extension_data(globalconf.connection, &xcb_big_requests_id); xcb_prefetch_extension_data(globalconf.connection, &xcb_big_requests_id);