- vinfo_return = XGetVisualInfo(OBDisplay::display,
- VisualScreenMask | VisualClassMask,
- &vinfo_template, &vinfo_nitems);
- if (vinfo_return) {
- int max_depth = 1;
- for (int i = 0; i < vinfo_nitems; ++i) {
- if (vinfo_return[i].depth > max_depth) {
- if (max_depth == 24 && vinfo_return[i].depth > 24)
- break; // prefer 24 bit over 32
- max_depth = vinfo_return[i].depth;
- best = i;
- }
- }
- if (max_depth < depth) best = -1;
- }
-
- if (best != -1) {
- depth = vinfo_return[best].depth;
- visual = vinfo_return[best].visual;
- colormap = XCreateColormap(OBDisplay::display, root_window, visual,
- AllocNone);
- }
-
- XFree(vinfo_return);
- }