diff options
author | Karl Heuer <kwzh@gnu.org> | 1996-02-21 21:10:28 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1996-02-21 21:10:28 +0000 |
commit | 49f29faeeba195feef167ec6207f74c8a17f031b (patch) | |
tree | c3f18b838f73147f8276e042551f4586162fd34b /src/xfns.c | |
parent | 476d39ff5e51c6cc369b11763fc4eebff49fef05 (diff) | |
download | emacs-49f29faeeba195feef167ec6207f74c8a17f031b.tar.gz |
(defined_color): When we find a "near" color in the map,
make sure it is really available as a read-only color.
Diffstat (limited to 'src/xfns.c')
-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; |