From d9c545daed804dea4c79782e5249ef79269f4517 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Mon, 27 Mar 2000 14:50:47 +0000 Subject: [PATCH] (x_copy_color): New function. (x_alloc_nearest_color) [DEBUG_X_COLORS]: Call register_color. --- src/ChangeLog | 31 +++++++++++++++++++++++++++++++ src/xterm.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 5ec2cf03895..285bbf211a0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,36 @@ 2000-03-27 Gerd Moellmann + * xterm.h (x_specified_cursor_type, x_copy_color): Add prototypes. + + * xfaces.c (register_color, unregister_colors, unregister_colors) + [DEBUG_X_COLORS]: New functions. + (x_free_colors) [DEBUG_X_COLORS]: Unregister colors. + + * xfns.c (x_set_cursor_color): Get color reference counts right. + + * xterm.c (x_copy_color): New function. + (x_alloc_nearest_color) [DEBUG_X_COLORS]: Call register_color. + + * buffer.h (MAX_PER_BUFFER_VARS): Renamed from MAX_BUFFER_LOCAL_VARS. + (PER_BUFFER_VAR_OFFSET): Renamed from BUFFER_LOCAL_VAR_OFFSET. + (PER_BUFFER_VAR_IDX): Renamed from BUFFER_LOCAL_VAR_IDX. + (PER_BUFFER_VALUE_P): Renamed from BUFFER_HAS_LOCAL_VALUE_P. + (SET_PER_BUFFER_VALUE_P): Renamed from SET_BUFFER_HAS_LOCAL_VALUE_P. + (PER_BUFFER_IDX): Renamed from BUFFER_LOCAL_IDX. + (PER_BUFFER_DEFAULT): Renamed from BUFFER_LOCAL_DEFAULT_VALUE. + (PER_BUFFER_VALUE): Renamed from BUFFER_LOCAL_VALUE. + (PER_BUFFER_SYMBOL): Renamed from BUFFER_LOCAL_SYMBOL. + (PER_BUFFER_TYPE): Renamed from BUFFER_LOCAL_TYPE. + + * category.c, data.c, syntax.c, print.c: Use new macro names + for handling per-buffer variables. + + * buffer.c (buffer_permanent_local_flags): Use MAX_PER_BUFFER_VARS + instead of MAX_BUFFER_LOCAL_VARS. + (last_per_buffer_idx): Renamed from max_buffer_local_idx. + + * xfaces.c (lookup_face): Don't assert FACE_SUITABLE_FOR_CHAR_P. + * xfns.c (x_specified_cursor_type): New function. (x_set_cursor_type): Use it. diff --git a/src/xterm.c b/src/xterm.c index a49171aab6d..216c633a584 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3207,10 +3207,38 @@ x_alloc_nearest_color (f, cmap, color) 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 -- 2.39.5