From: Gerd Moellmann Date: Mon, 30 Oct 2000 15:13:58 +0000 (+0000) Subject: (x_alloc_nearest_color): If allocation succeeds, and X-Git-Tag: emacs-pretest-21.0.90~417 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=35efe0a1169d72779aa63bbcab9250c2cbc9e014;p=emacs.git (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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 484f1c50d56..0e880dbc0b6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2000-10-30 Gerd Moellmann + * xterm.c (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. + * window.c (displayed_window_lines): Change buffers if necessary. Fix computation of displayed lines. diff --git a/src/xterm.c b/src/xterm.c index a55117ba8dc..556611286bc 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3412,6 +3412,23 @@ x_alloc_nearest_color (f, cmap, color) 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)