gdkrgb: choose visuals by their color bits, 30-bit ones included

This commit is contained in:
Daemonratte 2026-10-15 11:30:51 +02:00
commit 7fb43ac250
No known key found for this signature in database

View file

@ -390,17 +390,25 @@ gdk_rgb_score_visual (GdkVisual *visual)
if (visual->type == GDK_VISUAL_TRUE_COLOR ||
visual->type == GDK_VISUAL_DIRECT_COLOR)
{
if (visual->depth == 24)
{
quality = 9;
/* Should test for MSB visual here, and set speed if so. */
}
else if (visual->depth == 16)
/* Visuals with alpha (depth 32 with 24 color bits) are skipped */
gint bits = visual->red_prec + visual->green_prec + visual->blue_prec;
if (bits != visual->depth)
quality = 0;
else if (bits > 24)
quality = 10;
else if (bits == 24)
quality = 9;
else if (bits == 16)
quality = 8;
else if (visual->depth == 15)
else if (bits == 15)
quality = 7;
else if (visual->depth == 8)
else if (bits > 8)
quality = 5;
else if (bits == 8)
quality = 4;
else if (bits >= 3)
quality = 2;
}
else if (visual->type == GDK_VISUAL_PSEUDO_COLOR ||
visual->type == GDK_VISUAL_STATIC_COLOR)