From ffb16417b9c51711ae9c2defb64f562c673a9e7a Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Wed, 21 Feb 1996 21:10:28 +0000 Subject: [PATCH] (defined_color): When we find a "near" color in the map, make sure it is really available as a read-only color. --- src/xfns.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/xfns.c b/src/xfns.c index fbb2c05aff6..bade5b56765 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1111,8 +1111,16 @@ defined_color (f, color, color_def, alloc) * ((color_def->blue >> 8) - (cells[x].blue >> 8)))); if (trial_delta < nearest_delta) { - nearest = x; - nearest_delta = trial_delta; + XColor temp; + temp.red = cells[x].red; + temp.green = cells[x].green; + temp.blue = cells[x].blue; + status = XAllocColor (display, screen_colormap, &temp); + if (status) + { + nearest = x; + nearest_delta = trial_delta; + } } } color_def->red = cells[nearest].red; -- 2.39.2