# HG changeset patch # User reimar # Date 1088369108 0 # Node ID bd90b887fb132fa48f4ab48270a7c08646dbfd76 # Parent a7e80ffdd89e8bcdf17be91dfad802145cf47e58 avoid visuals with low color-depth. Based on idea from Timo Kanera (timo (at) kanera (dot) de). diff -r a7e80ffdd89e -r bd90b887fb13 libvo/vo_gl2.c --- a/libvo/vo_gl2.c Sun Jun 27 19:53:30 2004 +0000 +++ b/libvo/vo_gl2.c Sun Jun 27 20:45:08 2004 +0000 @@ -640,6 +640,18 @@ w += val; /* and finally, prefer DirectColor-ed visuals to allow color corrections */ if (vi_list[i].class != DirectColor) w += 100; + + // avoid bad-looking visual with less that 8bit per color + res = glXGetConfig(dpy, vi_list + i, GLX_RED_SIZE, &val); + if (res) continue; + if (val < 8) w += 50; + res = glXGetConfig(dpy, vi_list + i, GLX_GREEN_SIZE, &val); + if (res) continue; + if (val < 8) w += 70; + res = glXGetConfig(dpy, vi_list + i, GLX_BLUE_SIZE, &val); + if (res) continue; + if (val < 8) w += 50; + if (w < best_weight) { best_weight = w; best_i = i;