diff options
| author | Gerd Moellmann | 2000-10-30 15:13:58 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-30 15:13:58 +0000 |
| commit | 35efe0a1169d72779aa63bbcab9250c2cbc9e014 (patch) | |
| tree | c6ab98995ca49d89a01f012f073b31346277a863 /src/xterm.c | |
| parent | f077c4622f84423de2b85876f5dddafbc8d49794 (diff) | |
| download | emacs-35efe0a1169d72779aa63bbcab9250c2cbc9e014.tar.gz emacs-35efe0a1169d72779aa63bbcab9250c2cbc9e014.zip | |
(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.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 17 |
1 files changed, 17 insertions, 0 deletions
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) | |||
| 3412 | color->blue = cells[nearest].blue; | 3412 | color->blue = cells[nearest].blue; |
| 3413 | rc = XAllocColor (display, cmap, color); | 3413 | rc = XAllocColor (display, cmap, color); |
| 3414 | } | 3414 | } |
| 3415 | else | ||
| 3416 | { | ||
| 3417 | /* If allocation succeeded, and the allocated pixel color is not | ||
| 3418 | equal to a cached pixel color recorded earlier, there was a | ||
| 3419 | change in the colormap, so clear the color cache. */ | ||
| 3420 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 3421 | XColor *cached_color; | ||
| 3422 | |||
| 3423 | if (dpyinfo->color_cells | ||
| 3424 | && (cached_color = &dpyinfo->color_cells[color->pixel], | ||
| 3425 | cached_color->pixel != color->pixel)) | ||
| 3426 | { | ||
| 3427 | xfree (dpyinfo->color_cells); | ||
| 3428 | dpyinfo->color_cells = NULL; | ||
| 3429 | dpyinfo->ncolor_cells = 0; | ||
| 3430 | } | ||
| 3431 | } | ||
| 3415 | 3432 | ||
| 3416 | #ifdef DEBUG_X_COLORS | 3433 | #ifdef DEBUG_X_COLORS |
| 3417 | if (rc) | 3434 | if (rc) |