diff options
| -rw-r--r-- | src/xfns.c | 12 |
1 files 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; |
