Mercurial > emacs
changeset 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 | a0b9347a3973 |
children | 19b4e1fef348 |
files | src/dispextern.h src/xterm.c src/xterm.h |
diffstat | 3 files changed, 38 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dispextern.h Tue Jun 22 07:25:42 1993 +0000 +++ b/src/dispextern.h Tue Jun 22 07:26:44 1993 +0000 @@ -54,15 +54,6 @@ /* Whether or not to underline text in this face. */ char underline; - - /* Does this face own its resources? (color, font, etcetera) - If this is a face which we computed by combining other faces, - then this is true, and we shouldn't free any of the resources - it refers to; the faces from which it was constructed own it. - On the other hand, if this is a face the user created and - filled in directly, then this is false, and we should free the - resources when we free it. */ - char copy; }; /* Let's stop using this and get rid of it. */
--- a/src/xterm.c Tue Jun 22 07:25:42 1993 +0000 +++ b/src/xterm.c Tue Jun 22 07:26:44 1993 +0000 @@ -389,8 +389,8 @@ Since the display generation code is responsible for calling compute_char_face and compute_glyph_face on everything it puts in the display structure, we can assume that the face code on each - glyph is a valid index into FRAME_FACES (f), and the one to which - we can actually apply intern_face. */ + glyph is a valid index into FRAME_COMPUTED_FACES (f), and the one + to which we can actually apply intern_face. */ #if 1 /* This is the multi-face code. */ @@ -451,13 +451,14 @@ { /* The face codes on the glyphs must be valid indices into the frame's face table. */ - if (cf < 0 || cf >= FRAME_N_FACES (f)) + if (cf < 0 || cf >= FRAME_N_COMPUTED_FACES (f) + || FRAME_COMPUTED_FACES (f) [cf] == 0) abort (); if (cf == 1) face = FRAME_MODE_LINE_FACE (f); else - face = intern_face (f, FRAME_FACES (f) [cf]); + face = intern_face (f, FRAME_COMPUTED_FACES (f) [cf]); font = FACE_FONT (face); gc = FACE_GC (face); defaulted = 0;
--- 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,