- // Construct an attribute list matching the visual
- int a_list[32];
- n = 0;
- if(vi->c_class==TrueColor || vi->c_class==DirectColor) { // RGBA visual
- a_list[n++] = GLX_RGBA;
- a_list[n++] = GLX_RED_SIZE;
- a_list[n++] = bitcount(vi->red_mask);
- a_list[n++] = GLX_GREEN_SIZE;
- a_list[n++] = bitcount(vi->green_mask);
- a_list[n++] = GLX_BLUE_SIZE;
- a_list[n++] = bitcount(vi->blue_mask);
- glXGetConfig(display, vi, GLX_ALPHA_SIZE, &val);
- a_list[n++] = GLX_ALPHA_SIZE;
- a_list[n++] = val;
- } else { // Color index visual
- glXGetConfig(display, vi, GLX_BUFFER_SIZE, &val);
- a_list[n++] = GLX_BUFFER_SIZE;
- a_list[n++] = val;
- }
- a_list[n] = None;
- // XFree(vi);
- vi = glXChooseVisual(display, DefaultScreen(display), a_list);
- if(!vi) return false;
+ // Construct an attribute list matching the visual
+ int a_list[32];
+ n = 0;
+ if(vi->c_class==TrueColor || vi->c_class==DirectColor) { // RGBA visual
+ a_list[n++] = GLX_RGBA;
+ a_list[n++] = GLX_RED_SIZE;
+ a_list[n++] = bitcount(vi->red_mask);
+ a_list[n++] = GLX_GREEN_SIZE;
+ a_list[n++] = bitcount(vi->green_mask);
+ a_list[n++] = GLX_BLUE_SIZE;
+ a_list[n++] = bitcount(vi->blue_mask);
+ glXGetConfig(display, vi, GLX_ALPHA_SIZE, &val);
+ a_list[n++] = GLX_ALPHA_SIZE;
+ a_list[n++] = val;
+ } else { // Color index visual
+ glXGetConfig(display, vi, GLX_BUFFER_SIZE, &val);
+ a_list[n++] = GLX_BUFFER_SIZE;
+ a_list[n++] = val;
+ }
+ a_list[n] = None;
+ // XFree(vi);
+ vi = glXChooseVisual(display, DefaultScreen(display), a_list);
+ if(!vi) return false;