summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1996-02-21 21:10:28 +0000
committerKarl Heuer <kwzh@gnu.org>1996-02-21 21:10:28 +0000
commitffb16417b9c51711ae9c2defb64f562c673a9e7a (patch)
tree3bcfc5f75e423aa65c257ba382674b76e907bae6
parent3dcd07e339a53b32ad61e6c7ac8c25b020c7d795 (diff)
downloademacs-ffb16417b9c51711ae9c2defb64f562c673a9e7a.tar.gz
(defined_color): When we find a "near" color in the map,
make sure it is really available as a read-only color.
-rw-r--r--src/xfns.c12
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;