# HG changeset patch # User Gerd Moellmann # Date 954168567 0 # Node ID c94ec7e56746210c60c557b515666e6d341158bc # Parent 11d7a6fdad5f85d2f52fe0b8790e4ba4aa11f34e (x_copy_color): New function. (x_alloc_nearest_color) [DEBUG_X_COLORS]: Call register_color. diff -r 11d7a6fdad5f -r c94ec7e56746 src/xterm.c --- 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