# HG changeset patch # User Karl Heuer # Date 824937028 0 # Node ID 1bbe2716bcea6959217cb7b86f43ee5bf7510651 # Parent 8fda783ead436aca35479472907a2c15e61d8e67 (defined_color): When we find a "near" color in the map, make sure it is really available as a read-only color. diff -r 8fda783ead43 -r 1bbe2716bcea src/xfns.c --- a/src/xfns.c Wed Feb 21 21:09:52 1996 +0000 +++ b/src/xfns.c Wed Feb 21 21:10:28 1996 +0000 @@ -1111,8 +1111,16 @@ * ((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;