(x_copy_color): New function.
authorGerd Moellmann <gerd@gnu.org>
Mon, 27 Mar 2000 14:50:47 +0000 (14:50 +0000)
committerGerd Moellmann <gerd@gnu.org>
Mon, 27 Mar 2000 14:50:47 +0000 (14:50 +0000)
(x_alloc_nearest_color) [DEBUG_X_COLORS]: Call register_color.

src/ChangeLog
src/xterm.c

index 5ec2cf0..285bbf2 100644 (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.
 
index a49171a..216c633 100644 (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