1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00

(x_copy_color): New function.

(x_alloc_nearest_color) [DEBUG_X_COLORS]: Call register_color.
This commit is contained in:
Gerd Moellmann 2000-03-27 14:50:47 +00:00
parent 10168ebbc5
commit d9c545daed
2 changed files with 59 additions and 0 deletions

View File

@ -1,5 +1,36 @@
2000-03-27 Gerd Moellmann <gerd@gnu.org>
* 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.

View File

@ -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