aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-06-22 07:26:44 +0000
committerJim Blandy1993-06-22 07:26:44 +0000
commit28f7279833b8593f936a87fac417b77160d3a9b6 (patch)
tree2e9e3d68e1e571c7d0f3dd74feb827c4765f38d1 /src
parent7b00de84fddc2fb043dff9be613b34401a23f952 (diff)
downloademacs-28f7279833b8593f936a87fac417b77160d3a9b6.tar.gz
emacs-28f7279833b8593f936a87fac417b77160d3a9b6.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/dispextern.h9
-rw-r--r--src/xterm.c9
-rw-r--r--src/xterm.h49
3 files changed, 38 insertions, 29 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index dfdae70b3d0..d793abe9cd4 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -54,15 +54,6 @@ struct face
54 54
55 /* Whether or not to underline text in this face. */ 55 /* Whether or not to underline text in this face. */
56 char underline; 56 char underline;
57
58 /* Does this face own its resources? (color, font, etcetera)
59 If this is a face which we computed by combining other faces,
60 then this is true, and we shouldn't free any of the resources
61 it refers to; the faces from which it was constructed own it.
62 On the other hand, if this is a face the user created and
63 filled in directly, then this is false, and we should free the
64 resources when we free it. */
65 char copy;
66 }; 57 };
67 58
68/* Let's stop using this and get rid of it. */ 59/* Let's stop using this and get rid of it. */
diff --git a/src/xterm.c b/src/xterm.c
index f64b2fa83de..ca199762527 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -389,8 +389,8 @@ XTcursor_to (row, col)
389 Since the display generation code is responsible for calling 389 Since the display generation code is responsible for calling
390 compute_char_face and compute_glyph_face on everything it puts in 390 compute_char_face and compute_glyph_face on everything it puts in
391 the display structure, we can assume that the face code on each 391 the display structure, we can assume that the face code on each
392 glyph is a valid index into FRAME_FACES (f), and the one to which 392 glyph is a valid index into FRAME_COMPUTED_FACES (f), and the one
393 we can actually apply intern_face. */ 393 to which we can actually apply intern_face. */
394 394
395#if 1 395#if 1
396/* This is the multi-face code. */ 396/* This is the multi-face code. */
@@ -451,13 +451,14 @@ dumpglyphs (f, left, top, gp, n, hl)
451 { 451 {
452 /* The face codes on the glyphs must be valid indices into the 452 /* The face codes on the glyphs must be valid indices into the
453 frame's face table. */ 453 frame's face table. */
454 if (cf < 0 || cf >= FRAME_N_FACES (f)) 454 if (cf < 0 || cf >= FRAME_N_COMPUTED_FACES (f)
455 || FRAME_COMPUTED_FACES (f) [cf] == 0)
455 abort (); 456 abort ();
456 457
457 if (cf == 1) 458 if (cf == 1)
458 face = FRAME_MODE_LINE_FACE (f); 459 face = FRAME_MODE_LINE_FACE (f);
459 else 460 else
460 face = intern_face (f, FRAME_FACES (f) [cf]); 461 face = intern_face (f, FRAME_COMPUTED_FACES (f) [cf]);
461 font = FACE_FONT (face); 462 font = FACE_FONT (face);
462 gc = FACE_GC (face); 463 gc = FACE_GC (face);
463 defaulted = 0; 464 defaulted = 0;
diff --git a/src/xterm.h b/src/xterm.h
index 2e3247d61d9..ebff567f1e7 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -324,17 +324,33 @@ struct x_display
324 scroll bars, in pixels. */ 324 scroll bars, in pixels. */
325 int vertical_scroll_bar_extra; 325 int vertical_scroll_bar_extra;
326 326
327 /* Table of faces for this frame. */ 327 /* Table of parameter faces for this frame. Any X resources (pixel
328 struct face **faces; 328 values, fonts) referred to here have been allocated explicitly
329 /* Length of that table. */ 329 for this face, and should be freed if we change the face. */
330 int n_faces; 330 struct face **param_faces;
331 int n_param_faces;
332
333 /* Table of computed faces for this frame. These are the faces
334 whose indexes go into the upper bits of a glyph, computed by
335 combining the parameter faces specified by overlays, text
336 properties, and what have you. The X resources mentioned here
337 are all shared with parameter faces. */
338 struct face **computed_faces;
339 int n_computed_faces; /* How many are valid */
340 int size_computed_faces; /* How many are allocated */
331}; 341};
332 342
333/* Get at the faces of an X window frame. */ 343/* Get at the computed faces of an X window frame. */
334#define FRAME_FACES(f) ((f)->display.x->faces) 344#define FRAME_PARAM_FACES(f) ((f)->display.x->param_faces)
335#define FRAME_N_FACES(f) ((f)->display.x->n_faces) 345#define FRAME_N_PARAM_FACES(f) ((f)->display.x->n_param_faces)
336#define FRAME_DEFAULT_FACE(f) ((f)->display.x->faces[0]) 346#define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
337#define FRAME_MODE_LINE_FACE(f) ((f)->display.x->faces[1]) 347#define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])
348
349#define FRAME_COMPUTED_FACES(f) ((f)->display.x->computed_faces)
350#define FRAME_N_COMPUTED_FACES(f) ((f)->display.x->n_computed_faces)
351#define FRAME_SIZE_COMPUTED_FACES(f) ((f)->display.x->size_computed_faces)
352#define FRAME_DEFAULT_FACE(f) ((f)->display.x->computed_faces[0])
353#define FRAME_MODE_LINE_FACE(f) ((f)->display.x->computed_faces[1])
338 354
339/* Return the window associated with the frame F. */ 355/* Return the window associated with the frame F. */
340#define FRAME_X_WINDOW(f) ((f)->display.x->window_desc) 356#define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
@@ -574,13 +590,14 @@ struct selection_input_event
574 590
575/* Interface to the face code functions. */ 591/* Interface to the face code functions. */
576 592
577/* Create the first two faces for a frame -- the ones that have GC's. */ 593/* Create the first two computed faces for a frame -- the ones that
594 have GC's. */
578extern void init_frame_faces (/* FRAME_PTR */); 595extern void init_frame_faces (/* FRAME_PTR */);
579 596
580/* Free the resources for the faces associated with a frame. */ 597/* Free the resources for the faces associated with a frame. */
581extern void free_frame_faces (/* FRAME_PTR */); 598extern void free_frame_faces (/* FRAME_PTR */);
582 599
583/* Given a non-display face, find or make an equivalent display face 600/* Given a computed face, find or make an equivalent display face
584 in face_vector, and return a pointer to it. */ 601 in face_vector, and return a pointer to it. */
585extern struct face *intern_face (/* FRAME_PTR, struct face * */); 602extern struct face *intern_face (/* FRAME_PTR, struct face * */);
586 603
@@ -597,11 +614,11 @@ extern int same_size_fonts (/* XFontStruct *, XFontStruct * */);
597 depend. */ 614 depend. */
598extern void recompute_basic_faces (/* FRAME_PTR */); 615extern void recompute_basic_faces (/* FRAME_PTR */);
599 616
600/* Return the face ID associated with a buffer position POS. 617/* Return the face ID associated with a buffer position POS. Store
601 Store into *ENDPTR the position at which a different face is needed. 618 into *ENDPTR the next position at which a different face is
602 This does not take account of glyphs that specify their own face codes. 619 needed. This does not take account of glyphs that specify their
603 F is the frame in use for display, and W is a window displaying 620 own face codes. F is the frame in use for display, and W is a
604 the current buffer. 621 window displaying the current buffer.
605 622
606 REGION_BEG, REGION_END delimit the region, so it can be highlighted. */ 623 REGION_BEG, REGION_END delimit the region, so it can be highlighted. */
607extern int compute_char_face (/* FRAME_PTR frame, 624extern int compute_char_face (/* FRAME_PTR frame,