Mercurial > emacs
changeset 33062:c236bd0d44c3
(x_alloc_nearest_color): If allocation succeeds, and
we have a color cache, check that the cached color equals the
allocated color. If not, clear the color cache.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 30 Oct 2000 15:13:28 +0000 |
parents | 3cbd3cc4cc8b |
children | 0a3da2a92f53 |
files | src/xterm.c |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Mon Oct 30 14:28:30 2000 +0000 +++ b/src/xterm.c Mon Oct 30 15:13:28 2000 +0000 @@ -3412,6 +3412,23 @@ color->blue = cells[nearest].blue; rc = XAllocColor (display, cmap, color); } + else + { + /* If allocation succeeded, and the allocated pixel color is not + equal to a cached pixel color recorded earlier, there was a + change in the colormap, so clear the color cache. */ + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + XColor *cached_color; + + if (dpyinfo->color_cells + && (cached_color = &dpyinfo->color_cells[color->pixel], + cached_color->pixel != color->pixel)) + { + xfree (dpyinfo->color_cells); + dpyinfo->color_cells = NULL; + dpyinfo->ncolor_cells = 0; + } + } #ifdef DEBUG_X_COLORS if (rc)