Remove support for 32-bit visuals and RGBA colors.

fixes #1984
This commit is contained in:
Ingo Bürk
2015-10-10 21:27:23 +02:00
parent 73289a7394
commit 21c0c20843
5 changed files with 8 additions and 45 deletions

View File

@ -15,7 +15,6 @@ typedef struct color_t {
double red;
double green;
double blue;
double alpha;
/* For compatibility, we also store the colorpixel for now. */
uint32_t colorpixel;

View File

@ -51,25 +51,15 @@ void cairo_surface_free(surface_t *surface) {
*
*/
color_t cairo_hex_to_color(const char *color) {
char alpha[2];
if (strlen(color) == strlen("#rrggbbaa")) {
alpha[0] = color[7];
alpha[1] = color[8];
} else {
alpha[0] = alpha[1] = 'F';
}
char groups[4][3] = {
char groups[3][3] = {
{color[1], color[2], '\0'},
{color[3], color[4], '\0'},
{color[5], color[6], '\0'},
{alpha[0], alpha[1], '\0'}};
{color[5], color[6], '\0'}};
return (color_t){
.red = strtol(groups[0], NULL, 16) / 255.0,
.green = strtol(groups[1], NULL, 16) / 255.0,
.blue = strtol(groups[2], NULL, 16) / 255.0,
.alpha = strtol(groups[3], NULL, 16) / 255.0,
.colorpixel = get_colorpixel(color)};
}
@ -78,7 +68,7 @@ color_t cairo_hex_to_color(const char *color) {
*
*/
void cairo_set_source_color(surface_t *surface, color_t color) {
cairo_set_source_rgba(surface->cr, color.red, color.green, color.blue, color.alpha);
cairo_set_source_rgb(surface->cr, color.red, color.green, color.blue);
}
/**

View File

@ -1122,21 +1122,7 @@ char *init_xcb_early() {
depth = root_screen->root_depth;
colormap = root_screen->default_colormap;
visual_type = xcb_aux_find_visual_by_attrs(root_screen, -1, 32);
if (visual_type) {
depth = xcb_aux_get_depth_of_visual(root_screen, visual_type->visual_id);
colormap = xcb_generate_id(xcb_connection);
xcb_void_cookie_t cm_cookie = xcb_create_colormap_checked(xcb_connection,
XCB_COLORMAP_ALLOC_NONE,
colormap,
xcb_root,
visual_type->visual_id);
if (xcb_request_failed(cm_cookie, "Could not allocate colormap")) {
exit(EXIT_FAILURE);
}
} else {
visual_type = get_visualtype(root_screen);
}
visual_type = get_visualtype(root_screen);
/* We draw the statusline to a seperate pixmap, because it looks the same on all bars and
* this way, we can choose to crop it */