diff options
| author | Karl Heuer | 1996-02-21 21:10:28 +0000 |
|---|---|---|
| committer | Karl Heuer | 1996-02-21 21:10:28 +0000 |
| commit | ffb16417b9c51711ae9c2defb64f562c673a9e7a (patch) | |
| tree | 3bcfc5f75e423aa65c257ba382674b76e907bae6 /src | |
| parent | 3dcd07e339a53b32ad61e6c7ac8c25b020c7d795 (diff) | |
| download | emacs-ffb16417b9c51711ae9c2defb64f562c673a9e7a.tar.gz emacs-ffb16417b9c51711ae9c2defb64f562c673a9e7a.zip | |
(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')
| -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) | |||
| 1111 | * ((color_def->blue >> 8) - (cells[x].blue >> 8)))); | 1111 | * ((color_def->blue >> 8) - (cells[x].blue >> 8)))); |
| 1112 | if (trial_delta < nearest_delta) | 1112 | if (trial_delta < nearest_delta) |
| 1113 | { | 1113 | { |
| 1114 | nearest = x; | 1114 | XColor temp; |
| 1115 | nearest_delta = trial_delta; | 1115 | temp.red = cells[x].red; |
| 1116 | temp.green = cells[x].green; | ||
| 1117 | temp.blue = cells[x].blue; | ||
| 1118 | status = XAllocColor (display, screen_colormap, &temp); | ||
| 1119 | if (status) | ||
| 1120 | { | ||
| 1121 | nearest = x; | ||
| 1122 | nearest_delta = trial_delta; | ||
| 1123 | } | ||
| 1116 | } | 1124 | } |
| 1117 | } | 1125 | } |
| 1118 | color_def->red = cells[nearest].red; | 1126 | color_def->red = cells[nearest].red; |