Mercurial > emacs
comparison src/xfaces.c @ 9184:d50d31da6c8d
(Fset_face_attribute_internal): Mark frame garbaged whenever
any face's font or color is changed.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 29 Sep 1994 20:25:45 +0000 |
parents | a7947f88d558 |
children | 45bac5feb065 |
comparison
equal
deleted
inserted
replaced
9183:f49aca34b7ae | 9184:d50d31da6c8d |
---|---|
993 { | 993 { |
994 struct face *face; | 994 struct face *face; |
995 struct frame *f; | 995 struct frame *f; |
996 int magic_p; | 996 int magic_p; |
997 int id; | 997 int id; |
998 int garbaged = 0; | |
998 | 999 |
999 CHECK_FRAME (frame, 0); | 1000 CHECK_FRAME (frame, 0); |
1000 CHECK_NUMBER (face_id, 0); | 1001 CHECK_NUMBER (face_id, 0); |
1001 CHECK_SYMBOL (attr_name, 0); | 1002 CHECK_SYMBOL (attr_name, 0); |
1002 | 1003 |
1017 if (face->font != f->display.x->font) | 1018 if (face->font != f->display.x->font) |
1018 unload_font (f, face->font); | 1019 unload_font (f, face->font); |
1019 face->font = font; | 1020 face->font = font; |
1020 if (frame_update_line_height (f)) | 1021 if (frame_update_line_height (f)) |
1021 x_set_window_size (f, 0, f->width, f->height); | 1022 x_set_window_size (f, 0, f->width, f->height); |
1023 /* Must clear cache, since it might contain the font | |
1024 we just got rid of. */ | |
1025 garbaged = 1; | |
1022 } | 1026 } |
1023 else if (EQ (attr_name, intern ("foreground"))) | 1027 else if (EQ (attr_name, intern ("foreground"))) |
1024 { | 1028 { |
1025 unsigned long new_color = load_color (f, attr_value); | 1029 unsigned long new_color = load_color (f, attr_value); |
1026 unload_color (f, face->foreground); | 1030 unload_color (f, face->foreground); |
1027 face->foreground = new_color; | 1031 face->foreground = new_color; |
1032 garbaged = 1; | |
1028 } | 1033 } |
1029 else if (EQ (attr_name, intern ("background"))) | 1034 else if (EQ (attr_name, intern ("background"))) |
1030 { | 1035 { |
1031 unsigned long new_color = load_color (f, attr_value); | 1036 unsigned long new_color = load_color (f, attr_value); |
1032 unload_color (f, face->background); | 1037 unload_color (f, face->background); |
1033 face->background = new_color; | 1038 face->background = new_color; |
1039 garbaged = 1; | |
1034 } | 1040 } |
1035 #if 0 | 1041 #if 0 |
1036 else if (EQ (attr_name, intern ("background-pixmap"))) | 1042 else if (EQ (attr_name, intern ("background-pixmap"))) |
1037 { | 1043 { |
1038 unsigned int w, h, d; | 1044 unsigned int w, h, d; |
1055 error ("unknown face attribute"); | 1061 error ("unknown face attribute"); |
1056 | 1062 |
1057 if (id == 0 || id == 1) | 1063 if (id == 0 || id == 1) |
1058 recompute_basic_faces (f); | 1064 recompute_basic_faces (f); |
1059 | 1065 |
1060 /* If we're modifying either of the frame's display faces, that | 1066 /* We must redraw the frame whenever any face font or color changes, |
1061 means that we're changing the parameters of a fixed face code; | 1067 because it's possible that a merged (display) face |
1062 since the color/font/whatever is changed but the face ID hasn't, | 1068 contains the font or color we just replaced. |
1063 redisplay won't know to redraw the affected sections. Give it a | 1069 And we must inhibit any Expose events until the redraw is done, |
1064 kick. */ | 1070 since they would try to use the invalid display faces. */ |
1065 if (id == 0 || id == 1) | 1071 if (garbaged) |
1066 SET_FRAME_GARBAGED (f); | 1072 SET_FRAME_GARBAGED (f); |
1067 else | |
1068 /* Otherwise, it's enough to tell it to redisplay the text. */ | |
1069 windows_or_buffers_changed = 1; | |
1070 | 1073 |
1071 return Qnil; | 1074 return Qnil; |
1072 } | 1075 } |
1073 | 1076 |
1074 DEFUN ("internal-next-face-id", Finternal_next_face_id, Sinternal_next_face_id, | 1077 DEFUN ("internal-next-face-id", Finternal_next_face_id, Sinternal_next_face_id, |