diff src/xterm.h @ 3883:b9e5a869b33e

Separate parameter faces (those created and modified by the user) from the computed faces (the combinations created by compute_char_face), so that we don't waste global face id's. * xterm.h (struct x_display): Replace the fields faces and n_faces with fields param_faces, n_param_faces, computed_faces, n_computed_faces, and size_computed_faces. (FRAME_FACES, FRAME_N_FACES): Replaced by... (FRAME_COMPUTED_FACES, FRAME_N_COMPUTED_FACES, FRAME_PARAM_FACES, FRAME_N_PARAM_FACES): New macros. * xfaces.c: Doc fixes. (init_frame_faces): Call new_computed_face to create entries for the default and mode line faces. Use the FRAME...PARAM_FACES macros. (free_frame_faces): Use the FRAME...PARAM_FACES and FRAME...COMPUTED_FACES macros. Don't use the copy flag; all parameter faces have real X resources, and all computed faces just have copies. Free both the parameter and computed face arrays. (new_computed_face): New function. (intern_computed_face): Renamed from intern_frame_face; callers changed. Call new_computed_face. (ensure_face_ready, compute_char_face, compute_glyph_face): Use the FRAME...PARAM_FACES macros. (recompute_basic_faces): Use the FRAME...PARAM_FACES and FRAME...COMPUTED_FACES macros. Produce the computed faces by starting with the base faces and merging in the parameter faces. (Fset_face_attribute_internal): Use the FRAME...PARAM_FACES macros. Just call recompute_basic_faces if the default or mode line faces have changed. * xfns.c (Fx_list_fonts): Use the FRAME...PARAM_FACES macros. * xterm.c (dumpglyphs): Use the FRAME...COMPUTED_FACES macros. * dispextern.h (struct face): Remove the copy member. This is no longer necessary; all computed faces are copies, and no parameter faces are.
author Jim Blandy <jimb@redhat.com>
date Tue, 22 Jun 1993 07:26:44 +0000
parents 507f64624555
children 94fe4e71f7fc
line wrap: on
line diff
--- a/src/xterm.h	Tue Jun 22 07:25:42 1993 +0000
+++ b/src/xterm.h	Tue Jun 22 07:26:44 1993 +0000
@@ -324,17 +324,33 @@
      scroll bars, in pixels.  */
   int vertical_scroll_bar_extra;
 
-  /* Table of faces for this frame.  */
-  struct face **faces;
-  /* Length of that table.  */
-  int n_faces;
+  /* Table of parameter faces for this frame.  Any X resources (pixel
+     values, fonts) referred to here have been allocated explicitly
+     for this face, and should be freed if we change the face.  */
+  struct face **param_faces;
+  int n_param_faces;
+
+  /* Table of computed faces for this frame.  These are the faces
+     whose indexes go into the upper bits of a glyph, computed by
+     combining the parameter faces specified by overlays, text
+     properties, and what have you.  The X resources mentioned here
+     are all shared with parameter faces.  */
+  struct face **computed_faces;
+  int n_computed_faces;		/* How many are valid */
+  int size_computed_faces;	/* How many are allocated */
 };
 
-/* Get at the faces of an X window frame.  */
-#define FRAME_FACES(f) ((f)->display.x->faces)
-#define FRAME_N_FACES(f) ((f)->display.x->n_faces)
-#define FRAME_DEFAULT_FACE(f) ((f)->display.x->faces[0])
-#define FRAME_MODE_LINE_FACE(f) ((f)->display.x->faces[1])
+/* Get at the computed faces of an X window frame.  */
+#define FRAME_PARAM_FACES(f) ((f)->display.x->param_faces)
+#define FRAME_N_PARAM_FACES(f) ((f)->display.x->n_param_faces)
+#define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
+#define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])
+
+#define FRAME_COMPUTED_FACES(f) ((f)->display.x->computed_faces)
+#define FRAME_N_COMPUTED_FACES(f) ((f)->display.x->n_computed_faces)
+#define FRAME_SIZE_COMPUTED_FACES(f) ((f)->display.x->size_computed_faces)
+#define FRAME_DEFAULT_FACE(f) ((f)->display.x->computed_faces[0])
+#define FRAME_MODE_LINE_FACE(f) ((f)->display.x->computed_faces[1])
 
 /* Return the window associated with the frame F.  */
 #define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
@@ -574,13 +590,14 @@
 
 /* Interface to the face code functions.  */
 
-/* Create the first two faces for a frame -- the ones that have GC's.  */
+/* Create the first two computed faces for a frame -- the ones that
+   have GC's.  */
 extern void init_frame_faces (/* FRAME_PTR */);
 
 /* Free the resources for the faces associated with a frame.  */
 extern void free_frame_faces (/* FRAME_PTR */);
 
-/* Given a non-display face, find or make an equivalent display face
+/* Given a computed face, find or make an equivalent display face
    in face_vector, and return a pointer to it.  */
 extern struct face *intern_face (/* FRAME_PTR, struct face * */);
 
@@ -597,11 +614,11 @@
    depend.  */
 extern void recompute_basic_faces (/* FRAME_PTR */);
 
-/* Return the face ID associated with a buffer position POS.
-   Store into *ENDPTR the position at which a different face is needed.
-   This does not take account of glyphs that specify their own face codes.
-   F is the frame in use for display, and W is a window displaying
-   the current buffer.
+/* Return the face ID associated with a buffer position POS.  Store
+   into *ENDPTR the next position at which a different face is
+   needed.  This does not take account of glyphs that specify their
+   own face codes.  F is the frame in use for display, and W is a
+   window displaying the current buffer.
 
    REGION_BEG, REGION_END delimit the region, so it can be highlighted.  */
 extern int compute_char_face (/* FRAME_PTR frame,