]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fset_face_attribute_internal): Mark frame garbaged whenever
authorRichard M. Stallman <rms@gnu.org>
Thu, 29 Sep 1994 20:25:45 +0000 (20:25 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 29 Sep 1994 20:25:45 +0000 (20:25 +0000)
any face's font or color is changed.

src/xfaces.c

index 265c67bcaad9027c3cad863da0b56474b9e89e4e..3ddc6e5f78d28462be22743ff7ca271eb33b4dc4 100644 (file)
@@ -995,6 +995,7 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
   struct frame *f;
   int magic_p;
   int id;
+  int garbaged = 0;
 
   CHECK_FRAME (frame, 0);
   CHECK_NUMBER (face_id, 0);
@@ -1019,18 +1020,23 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
       face->font = font;
       if (frame_update_line_height (f))
        x_set_window_size (f, 0, f->width, f->height);
+      /* Must clear cache, since it might contain the font
+        we just got rid of.  */
+      garbaged = 1;
     }
   else if (EQ (attr_name, intern ("foreground")))
     {
       unsigned long new_color = load_color (f, attr_value);
       unload_color (f, face->foreground);
       face->foreground = new_color;
+      garbaged = 1;
     }
   else if (EQ (attr_name, intern ("background")))
     {
       unsigned long new_color = load_color (f, attr_value);
       unload_color (f, face->background);
       face->background = new_color;
+      garbaged = 1;
     }
 #if 0
   else if (EQ (attr_name, intern ("background-pixmap")))
@@ -1057,16 +1063,13 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
   if (id == 0 || id == 1)
     recompute_basic_faces (f);
 
-  /* If we're modifying either of the frame's display faces, that
-     means that we're changing the parameters of a fixed face code;
-     since the color/font/whatever is changed but the face ID hasn't,
-     redisplay won't know to redraw the affected sections.  Give it a
-     kick.  */
-  if (id == 0 || id == 1)
+  /* We must redraw the frame whenever any face font or color changes,
+     because it's possible that a merged (display) face
+     contains the font or color we just replaced.
+     And we must inhibit any Expose events until the redraw is done,
+     since they would try to use the invalid display faces.  */
+  if (garbaged)
     SET_FRAME_GARBAGED (f);
-  else
-    /* Otherwise, it's enough to tell it to redisplay the text.  */
-    windows_or_buffers_changed = 1;
 
   return Qnil;
 }