From: Karl Heuer Date: Wed, 21 Feb 1996 21:10:28 +0000 (+0000) Subject: (defined_color): When we find a "near" color in the map, X-Git-Tag: emacs-19.34~1245 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ffb16417b9c51711ae9c2defb64f562c673a9e7a;p=emacs.git (defined_color): When we find a "near" color in the map, make sure it is really available as a read-only color. --- 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;