changeset 3299:6fab7c7bb1f1

* xfaces.c (init_frame_faces): We have to make sure that face ID's are valid on all frames or no frames; make sure F has allocated faces for any face valid on the selected frame.
author Jim Blandy <jimb@redhat.com>
date Sun, 30 May 1993 18:12:11 +0000
parents 0b96c67ca1c5
children 3ac8efebf586
files src/xfaces.c
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfaces.c	Sun May 30 17:28:33 1993 +0000
+++ b/src/xfaces.c	Sun May 30 18:12:11 1993 +0000
@@ -90,7 +90,10 @@
    vector).  These are called "frame faces".
       Element 0 is the default face --- the one used for normal text.
       Element 1 is the modeline face.
-   These faces have their GC's set; the rest do not.  (See src/xterm.h.)
+   These faces have their GC's set; the rest do not.
+   If faces[i] is filled in (i.e. non-zero) on one frame, then it must
+   be filled in on all frames.  Code assumes that face ID's can be
+   used on any frame.  (See src/xterm.h.)
 
    The global variables `face_vector' and `nfaces' define another
    array of struct face pointers, with their GC's set.  This array
@@ -457,6 +460,22 @@
   ensure_face_ready (f, 1);
 
   recompute_basic_faces (f);
+
+  /* Supposedly, we only apply this function to newly-created frames.  */
+  if (selected_frame == f)
+    abort ();
+
+  /* Make sure that all faces valid on the selected frame are also valid
+     on this new frame.  */
+  {
+    int i;
+    int n_faces = selected_frame->display.x->n_faces;
+    struct face **faces = selected_frame->display.x->faces;
+
+    for (i = 2; i < n_faces; i++)
+      if (faces[i])
+	ensure_face_ready (f, i);
+  }
 }