Mercurial > emacs
changeset 28356:c94ec7e56746
(x_copy_color): New function.
(x_alloc_nearest_color) [DEBUG_X_COLORS]: Call register_color.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 27 Mar 2000 14:49:27 +0000 |
parents | 11d7a6fdad5f |
children | f68f2c1b83fa |
files | src/xterm.c |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Mon Mar 27 14:48:33 2000 +0000 +++ b/src/xterm.c Mon Mar 27 14:49:27 2000 +0000 @@ -3207,10 +3207,38 @@ rc = XAllocColor (display, cmap, color); } +#ifdef DEBUG_X_COLORS + if (rc) + register_color (color->pixel); +#endif /* DEBUG_X_COLORS */ + return rc; } +/* Allocate color PIXEL on frame F. PIXEL must already be allocated. + It's necessary to do this instead of just using PIXEL directly to + get color reference counts right. */ + +unsigned long +x_copy_color (f, pixel) + struct frame *f; + unsigned long pixel; +{ + XColor color; + + color.pixel = pixel; + BLOCK_INPUT; + XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); + XAllocColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); + UNBLOCK_INPUT; +#ifdef DEBUG_X_COLORS + register_color (pixel); +#endif + return color.pixel; +} + + /* Allocate a color which is lighter or darker than *PIXEL by FACTOR or DELTA. Try a color with RGB values multiplied by FACTOR first. If this produces the same color as PIXEL, try a color where all RGB