comparison src/faces.c @ 5617:b0d712bbc2a6

The "flush" face property. -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2011-12-23 Didier Verna <didier@xemacs.org> * faces.h (struct Lisp_Face): New 'flush slot. * faces.h (struct face_cachel): New 'flush and 'flush_specified flags. * faces.h (WINDOW_FACE_CACHEL_FLUSH_P): * faces.h (FACE_FLUSH_P): New macros. * faces.c: Declare Qflush. * lisp.h: Externalize it. * faces.c (syms_of_faces): Define it. * faces.c (vars_of_faces): Update built-in face specifiers. * faces.c (complex_vars_of_faces): Update specifier fallbacks. * faces.c (mark_face): * faces.c (face_equal): * faces.c (face_getprop): * faces.c (face_putprop): * faces.c (face_remprop): * faces.c (face_plist): * faces.c (reset_face): * faces.c (update_face_inheritance_mapper): * faces.c (Fmake_face): * faces.c (update_face_cachel_data): * faces.c (merge_face_cachel_data): * faces.c (Fcopy_face): * fontcolor.c (face_boolean_validate): Handle the flush property. * redisplay.h (struct display_line): Rename 'default_findex slot to clearer name 'clear_findex. * redisplay.h (DISPLAY_LINE_INIT): Update accordingly. * redisplay-output.c (compare_display_blocks): * redisplay-output.c (output_display_line): * redisplay-output.c (redisplay_output_window): * redisplay.c (regenerate_window_extents_only_changed): * redisplay.c (regenerate_window_incrementally): Update the comparison tests between the current and desired display lines to cope for different 'clear_findex values. * redisplay.c (create_text_block): Initialize the display line's 'clear_findex slot to DEFAULT_INDEX. Record a new 'clear_findex value when we encounter a newline character displayed in a flushed face. * redisplay.c (create_string_text_block): Record a new 'clear_findex value when we encounter a newline character displayed in a flushed face. lisp/ChangeLog addition: 2011-12-23 Didier Verna <didier@xemacs.org> * cl-macs.el (face-flush-p): New defsetf. * faces.el (set-face-property): Document the flush property. * faces.el (face-flush-p): New function. * faces.el (set-face-flush-p): New function. * faces.el (face-equal): * cus-face.el (custom-face-attributes): * x-faces.el (x-init-face-from-resources): * x-faces.el (make-face-x-resource-internal): Handle the flush property.
author Didier Verna <didier@xemacs.org>
date Fri, 23 Dec 2011 10:56:16 +0100
parents 248176c74e6b
children 75ad4969a16d
comparison
equal deleted inserted replaced
5616:79e9934779c1 5617:b0d712bbc2a6
40 #include "window.h" 40 #include "window.h"
41 41
42 Lisp_Object Qfacep; 42 Lisp_Object Qfacep;
43 Lisp_Object Qforeground, Qbackground, Qdisplay_table; 43 Lisp_Object Qforeground, Qbackground, Qdisplay_table;
44 Lisp_Object Qbackground_pixmap, Qbackground_placement, Qunderline, Qdim; 44 Lisp_Object Qbackground_pixmap, Qbackground_placement, Qunderline, Qdim;
45 Lisp_Object Qblinking, Qstrikethru, Q_name; 45 Lisp_Object Qblinking, Qstrikethru, Qflush, Q_name;
46 46
47 Lisp_Object Qinit_face_from_resources; 47 Lisp_Object Qinit_face_from_resources;
48 Lisp_Object Qinit_frame_faces; 48 Lisp_Object Qinit_frame_faces;
49 Lisp_Object Qinit_device_faces; 49 Lisp_Object Qinit_device_faces;
50 Lisp_Object Qinit_global_faces; 50 Lisp_Object Qinit_global_faces;
115 mark_object (face->strikethru); 115 mark_object (face->strikethru);
116 mark_object (face->highlight); 116 mark_object (face->highlight);
117 mark_object (face->dim); 117 mark_object (face->dim);
118 mark_object (face->blinking); 118 mark_object (face->blinking);
119 mark_object (face->reverse); 119 mark_object (face->reverse);
120 mark_object (face->flush);
120 121
121 mark_object (face->charsets_warned_about); 122 mark_object (face->charsets_warned_about);
122 123
123 return face->plist; 124 return face->plist;
124 } 125 }
169 internal_equal (f1->strikethru, f2->strikethru, depth) && 170 internal_equal (f1->strikethru, f2->strikethru, depth) &&
170 internal_equal (f1->highlight, f2->highlight, depth) && 171 internal_equal (f1->highlight, f2->highlight, depth) &&
171 internal_equal (f1->dim, f2->dim, depth) && 172 internal_equal (f1->dim, f2->dim, depth) &&
172 internal_equal (f1->blinking, f2->blinking, depth) && 173 internal_equal (f1->blinking, f2->blinking, depth) &&
173 internal_equal (f1->reverse, f2->reverse, depth) && 174 internal_equal (f1->reverse, f2->reverse, depth) &&
175 internal_equal (f1->flush, f2->flush, depth) &&
174 176
175 ! plists_differ (f1->plist, f2->plist, 0, 0, depth + 1, 0)); 177 ! plists_differ (f1->plist, f2->plist, 0, 0, depth + 1, 0));
176 } 178 }
177 179
178 static Hashcode 180 static Hashcode
205 EQ (prop, Qstrikethru) ? f->strikethru : 207 EQ (prop, Qstrikethru) ? f->strikethru :
206 EQ (prop, Qhighlight) ? f->highlight : 208 EQ (prop, Qhighlight) ? f->highlight :
207 EQ (prop, Qdim) ? f->dim : 209 EQ (prop, Qdim) ? f->dim :
208 EQ (prop, Qblinking) ? f->blinking : 210 EQ (prop, Qblinking) ? f->blinking :
209 EQ (prop, Qreverse) ? f->reverse : 211 EQ (prop, Qreverse) ? f->reverse :
212 EQ (prop, Qflush) ? f->flush :
210 EQ (prop, Qdoc_string) ? f->doc_string : 213 EQ (prop, Qdoc_string) ? f->doc_string :
211 external_plist_get (&f->plist, prop, 0, ERROR_ME)); 214 external_plist_get (&f->plist, prop, 0, ERROR_ME));
212 } 215 }
213 216
214 static int 217 static int
225 EQ (prop, Qunderline) || 228 EQ (prop, Qunderline) ||
226 EQ (prop, Qstrikethru) || 229 EQ (prop, Qstrikethru) ||
227 EQ (prop, Qhighlight) || 230 EQ (prop, Qhighlight) ||
228 EQ (prop, Qdim) || 231 EQ (prop, Qdim) ||
229 EQ (prop, Qblinking) || 232 EQ (prop, Qblinking) ||
230 EQ (prop, Qreverse)) 233 EQ (prop, Qreverse) ||
234 EQ (prop, Qflush))
231 return 0; 235 return 0;
232 236
233 if (EQ (prop, Qdoc_string)) 237 if (EQ (prop, Qdoc_string))
234 { 238 {
235 if (!NILP (value)) 239 if (!NILP (value))
256 EQ (prop, Qunderline) || 260 EQ (prop, Qunderline) ||
257 EQ (prop, Qstrikethru) || 261 EQ (prop, Qstrikethru) ||
258 EQ (prop, Qhighlight) || 262 EQ (prop, Qhighlight) ||
259 EQ (prop, Qdim) || 263 EQ (prop, Qdim) ||
260 EQ (prop, Qblinking) || 264 EQ (prop, Qblinking) ||
261 EQ (prop, Qreverse)) 265 EQ (prop, Qreverse) ||
266 EQ (prop, Qflush))
262 return -1; 267 return -1;
263 268
264 if (EQ (prop, Qdoc_string)) 269 if (EQ (prop, Qdoc_string))
265 { 270 {
266 f->doc_string = Qnil; 271 f->doc_string = Qnil;
274 face_plist (Lisp_Object obj) 279 face_plist (Lisp_Object obj)
275 { 280 {
276 Lisp_Face *face = XFACE (obj); 281 Lisp_Face *face = XFACE (obj);
277 Lisp_Object result = face->plist; 282 Lisp_Object result = face->plist;
278 283
284 result = cons3 (Qflush, face->flush, result);
279 result = cons3 (Qreverse, face->reverse, result); 285 result = cons3 (Qreverse, face->reverse, result);
280 result = cons3 (Qblinking, face->blinking, result); 286 result = cons3 (Qblinking, face->blinking, result);
281 result = cons3 (Qdim, face->dim, result); 287 result = cons3 (Qdim, face->dim, result);
282 result = cons3 (Qhighlight, face->highlight, result); 288 result = cons3 (Qhighlight, face->highlight, result);
283 result = cons3 (Qstrikethru, face->strikethru, result); 289 result = cons3 (Qstrikethru, face->strikethru, result);
305 { XD_LISP_OBJECT, offsetof (Lisp_Face, strikethru) }, 311 { XD_LISP_OBJECT, offsetof (Lisp_Face, strikethru) },
306 { XD_LISP_OBJECT, offsetof (Lisp_Face, highlight) }, 312 { XD_LISP_OBJECT, offsetof (Lisp_Face, highlight) },
307 { XD_LISP_OBJECT, offsetof (Lisp_Face, dim) }, 313 { XD_LISP_OBJECT, offsetof (Lisp_Face, dim) },
308 { XD_LISP_OBJECT, offsetof (Lisp_Face, blinking) }, 314 { XD_LISP_OBJECT, offsetof (Lisp_Face, blinking) },
309 { XD_LISP_OBJECT, offsetof (Lisp_Face, reverse) }, 315 { XD_LISP_OBJECT, offsetof (Lisp_Face, reverse) },
316 { XD_LISP_OBJECT, offsetof (Lisp_Face, flush) },
310 { XD_LISP_OBJECT, offsetof (Lisp_Face, plist) }, 317 { XD_LISP_OBJECT, offsetof (Lisp_Face, plist) },
311 { XD_LISP_OBJECT, offsetof (Lisp_Face, charsets_warned_about) }, 318 { XD_LISP_OBJECT, offsetof (Lisp_Face, charsets_warned_about) },
312 { XD_END } 319 { XD_END }
313 }; 320 };
314 321
398 f->strikethru = Qnil; 405 f->strikethru = Qnil;
399 f->highlight = Qnil; 406 f->highlight = Qnil;
400 f->dim = Qnil; 407 f->dim = Qnil;
401 f->blinking = Qnil; 408 f->blinking = Qnil;
402 f->reverse = Qnil; 409 f->reverse = Qnil;
410 f->flush = Qnil;
403 f->plist = Qnil; 411 f->plist = Qnil;
404 f->charsets_warned_about = Qnil; 412 f->charsets_warned_about = Qnil;
405 } 413 }
406 414
407 static Lisp_Face * 415 static Lisp_Face *
552 else if (EQ (fcl->property, Qunderline) || 560 else if (EQ (fcl->property, Qunderline) ||
553 EQ (fcl->property, Qstrikethru) || 561 EQ (fcl->property, Qstrikethru) ||
554 EQ (fcl->property, Qhighlight) || 562 EQ (fcl->property, Qhighlight) ||
555 EQ (fcl->property, Qdim) || 563 EQ (fcl->property, Qdim) ||
556 EQ (fcl->property, Qblinking) || 564 EQ (fcl->property, Qblinking) ||
557 EQ (fcl->property, Qreverse)) 565 EQ (fcl->property, Qreverse) ||
566 EQ (fcl->property, Qflush))
558 { 567 {
559 update_inheritance_mapper_internal (contents, fcl->face, Qunderline); 568 update_inheritance_mapper_internal (contents, fcl->face, Qunderline);
560 update_inheritance_mapper_internal (contents, fcl->face, Qstrikethru); 569 update_inheritance_mapper_internal (contents, fcl->face, Qstrikethru);
561 update_inheritance_mapper_internal (contents, fcl->face, Qhighlight); 570 update_inheritance_mapper_internal (contents, fcl->face, Qhighlight);
562 update_inheritance_mapper_internal (contents, fcl->face, Qdim); 571 update_inheritance_mapper_internal (contents, fcl->face, Qdim);
563 update_inheritance_mapper_internal (contents, fcl->face, Qblinking); 572 update_inheritance_mapper_internal (contents, fcl->face, Qblinking);
564 update_inheritance_mapper_internal (contents, fcl->face, Qreverse); 573 update_inheritance_mapper_internal (contents, fcl->face, Qreverse);
574 update_inheritance_mapper_internal (contents, fcl->face, Qflush);
565 } 575 }
566 return 0; 576 return 0;
567 } 577 }
568 578
569 static void 579 static void
867 set_face_boolean_attached_to (f->dim, face, Qdim); 877 set_face_boolean_attached_to (f->dim, face, Qdim);
868 f->blinking = Fmake_specifier (Qface_boolean); 878 f->blinking = Fmake_specifier (Qface_boolean);
869 set_face_boolean_attached_to (f->blinking, face, Qblinking); 879 set_face_boolean_attached_to (f->blinking, face, Qblinking);
870 f->reverse = Fmake_specifier (Qface_boolean); 880 f->reverse = Fmake_specifier (Qface_boolean);
871 set_face_boolean_attached_to (f->reverse, face, Qreverse); 881 set_face_boolean_attached_to (f->reverse, face, Qreverse);
882 f->flush = Fmake_specifier (Qface_boolean);
883 set_face_boolean_attached_to (f->flush, face, Qflush);
872 if (!NILP (Vdefault_face)) 884 if (!NILP (Vdefault_face))
873 { 885 {
874 /* If the default face has already been created, set it as 886 /* If the default face has already been created, set it as
875 the default fallback specifier for all the specifiers we 887 the default fallback specifier for all the specifiers we
876 just created. This implements the standard "all faces 888 just created. This implements the standard "all faces
899 Fget (Vdefault_face, Qdim, Qunbound)); 911 Fget (Vdefault_face, Qdim, Qunbound));
900 set_specifier_fallback (f->blinking, 912 set_specifier_fallback (f->blinking,
901 Fget (Vdefault_face, Qblinking, Qunbound)); 913 Fget (Vdefault_face, Qblinking, Qunbound));
902 set_specifier_fallback (f->reverse, 914 set_specifier_fallback (f->reverse,
903 Fget (Vdefault_face, Qreverse, Qunbound)); 915 Fget (Vdefault_face, Qreverse, Qunbound));
916 set_specifier_fallback (f->flush,
917 Fget (Vdefault_face, Qflush, Qunbound));
904 } 918 }
905 919
906 /* Add the face to the appropriate list. */ 920 /* Add the face to the appropriate list. */
907 if (NILP (temporary)) 921 if (NILP (temporary))
908 Fputhash (name, face, Vpermanent_faces_cache); 922 Fputhash (name, face, Vpermanent_faces_cache);
1469 FROB (underline); 1483 FROB (underline);
1470 FROB (strikethru); 1484 FROB (strikethru);
1471 FROB (highlight); 1485 FROB (highlight);
1472 FROB (dim); 1486 FROB (dim);
1473 FROB (reverse); 1487 FROB (reverse);
1488 FROB (flush);
1474 FROB (blinking); 1489 FROB (blinking);
1475 #undef FROB 1490 #undef FROB
1476 } 1491 }
1477 1492
1478 cachel->updated = 1; 1493 cachel->updated = 1;
1508 FROB (underline); 1523 FROB (underline);
1509 FROB (strikethru); 1524 FROB (strikethru);
1510 FROB (highlight); 1525 FROB (highlight);
1511 FROB (dim); 1526 FROB (dim);
1512 FROB (reverse); 1527 FROB (reverse);
1528 FROB (flush);
1513 FROB (blinking); 1529 FROB (blinking);
1514 1530
1515 for (offs = 0; offs < NUM_LEADING_BYTES; ++offs) 1531 for (offs = 0; offs < NUM_LEADING_BYTES; ++offs)
1516 { 1532 {
1517 if (!(bit_vector_bit(FACE_CACHEL_FONT_SPECIFIED(cachel), offs)) 1533 if (!(bit_vector_bit(FACE_CACHEL_FONT_SPECIFIED(cachel), offs))
2021 COPY_PROPERTY (strikethru); 2037 COPY_PROPERTY (strikethru);
2022 COPY_PROPERTY (highlight); 2038 COPY_PROPERTY (highlight);
2023 COPY_PROPERTY (dim); 2039 COPY_PROPERTY (dim);
2024 COPY_PROPERTY (blinking); 2040 COPY_PROPERTY (blinking);
2025 COPY_PROPERTY (reverse); 2041 COPY_PROPERTY (reverse);
2042 COPY_PROPERTY (flush);
2026 #undef COPY_PROPERTY 2043 #undef COPY_PROPERTY
2027 /* #### should it copy the individual specifiers, if they exist? */ 2044 /* #### should it copy the individual specifiers, if they exist? */
2028 fnew->plist = Fcopy_sequence (fold->plist); 2045 fnew->plist = Fcopy_sequence (fold->plist);
2029 2046
2030 UNGCPRO; 2047 UNGCPRO;
2160 DEFSYMBOL (Qunderline); 2177 DEFSYMBOL (Qunderline);
2161 DEFSYMBOL (Qstrikethru); 2178 DEFSYMBOL (Qstrikethru);
2162 /* Qhighlight, Qreverse defined in general.c */ 2179 /* Qhighlight, Qreverse defined in general.c */
2163 DEFSYMBOL (Qdim); 2180 DEFSYMBOL (Qdim);
2164 DEFSYMBOL (Qblinking); 2181 DEFSYMBOL (Qblinking);
2182 DEFSYMBOL (Qflush);
2165 2183
2166 DEFSYMBOL (Qface_alias); 2184 DEFSYMBOL (Qface_alias);
2167 DEFERROR_STANDARD (Qcyclic_face_alias, Qinvalid_state); 2185 DEFERROR_STANDARD (Qcyclic_face_alias, Qinvalid_state);
2168 2186
2169 DEFSYMBOL (Qinit_face_from_resources); 2187 DEFSYMBOL (Qinit_face_from_resources);
2226 #endif 2244 #endif
2227 2245
2228 Vbuilt_in_face_specifiers = 2246 Vbuilt_in_face_specifiers =
2229 listu (Qforeground, Qbackground, Qfont, Qdisplay_table, Qbackground_pixmap, 2247 listu (Qforeground, Qbackground, Qfont, Qdisplay_table, Qbackground_pixmap,
2230 Qbackground_placement, Qunderline, Qstrikethru, Qhighlight, Qdim, 2248 Qbackground_placement, Qunderline, Qstrikethru, Qhighlight, Qdim,
2231 Qblinking, Qreverse, Qunbound); 2249 Qblinking, Qreverse, Qflush, Qunbound);
2232 staticpro (&Vbuilt_in_face_specifiers); 2250 staticpro (&Vbuilt_in_face_specifiers);
2233 } 2251 }
2234 2252
2235 void 2253 void
2236 complex_vars_of_faces (void) 2254 complex_vars_of_faces (void)
2481 set_specifier_fallback (Fget (Vdefault_face, Qdim, Qnil), 2499 set_specifier_fallback (Fget (Vdefault_face, Qdim, Qnil),
2482 list1 (Fcons (Qnil, Qnil))); 2500 list1 (Fcons (Qnil, Qnil)));
2483 set_specifier_fallback (Fget (Vdefault_face, Qblinking, Qnil), 2501 set_specifier_fallback (Fget (Vdefault_face, Qblinking, Qnil),
2484 list1 (Fcons (Qnil, Qnil))); 2502 list1 (Fcons (Qnil, Qnil)));
2485 set_specifier_fallback (Fget (Vdefault_face, Qreverse, Qnil), 2503 set_specifier_fallback (Fget (Vdefault_face, Qreverse, Qnil),
2504 list1 (Fcons (Qnil, Qnil)));
2505 set_specifier_fallback (Fget (Vdefault_face, Qflush, Qnil),
2486 list1 (Fcons (Qnil, Qnil))); 2506 list1 (Fcons (Qnil, Qnil)));
2487 2507
2488 /* gui-element is the parent face of all gui elements such as 2508 /* gui-element is the parent face of all gui elements such as
2489 modeline, vertical divider and toolbar. */ 2509 modeline, vertical divider and toolbar. */
2490 Vgui_element_face = Fmake_face (Qgui_element, 2510 Vgui_element_face = Fmake_face (Qgui_element,