comparison src/xfaces.c @ 27114:4efa5e54e9a9

(Qunspecified_fg, Qunspecified_bg): Remove. (syms_of_xfaces): Remove their staticpro's. (tty_color_name): Return Lisp strings for unspecified fore- and back-ground colors. (Finternal_set_lisp_face_attribute): Remove the special treatment for Qunspecified_{f,b}g. (realize_default_face): Replace Qunspecified_{f,b}g with a Lisp string.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 03 Jan 2000 16:52:52 +0000
parents 9a0d8503806e
children 24a08208cf3a
comparison
equal deleted inserted replaced
27113:21f49fa0782b 27114:4efa5e54e9a9
280 Lisp_Object Qultra_condensed, Qextra_condensed, Qcondensed; 280 Lisp_Object Qultra_condensed, Qextra_condensed, Qcondensed;
281 Lisp_Object Qsemi_condensed, Qsemi_expanded, Qexpanded, Qextra_expanded; 281 Lisp_Object Qsemi_condensed, Qsemi_expanded, Qexpanded, Qextra_expanded;
282 Lisp_Object Qultra_expanded; 282 Lisp_Object Qultra_expanded;
283 Lisp_Object Qreleased_button, Qpressed_button; 283 Lisp_Object Qreleased_button, Qpressed_button;
284 Lisp_Object QCstyle, QCcolor, QCline_width; 284 Lisp_Object QCstyle, QCcolor, QCline_width;
285 Lisp_Object Qunspecified, Qunspecified_fg, Qunspecified_bg; 285 Lisp_Object Qunspecified;
286
287 char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg";
286 288
287 /* The symbol `x-charset-registry'. This property of charsets defines 289 /* The symbol `x-charset-registry'. This property of charsets defines
288 the X registry and encoding that fonts should have that are used to 290 the X registry and encoding that fonts should have that are used to
289 display characters of that charset. */ 291 display characters of that charset. */
290 292
1192 /* FIXME: When/if w32 supports colors in non-window mode, there should 1194 /* FIXME: When/if w32 supports colors in non-window mode, there should
1193 be a call here to a w32-specific function that returns the color 1195 be a call here to a w32-specific function that returns the color
1194 by index using the default color mapping on a Windows console. */ 1196 by index using the default color mapping on a Windows console. */
1195 #endif 1197 #endif
1196 1198
1197 return 1199 if (idx == FACE_TTY_DEFAULT_FG_COLOR)
1198 idx == FACE_TTY_DEFAULT_FG_COLOR ? Qunspecified_fg 1200 return build_string (unspecified_fg);
1199 : idx == FACE_TTY_DEFAULT_BG_COLOR ? Qunspecified_bg 1201 if (idx == FACE_TTY_DEFAULT_BG_COLOR)
1200 : Qunspecified; 1202 return build_string (unspecified_bg);
1203 return Qunspecified;
1201 } 1204 }
1202 1205
1203 /* Return non-zero if COLOR_NAME is a shade of gray (or white or 1206 /* Return non-zero if COLOR_NAME is a shade of gray (or white or
1204 black) on frame F. The algorithm is taken from 20.2 faces.el. */ 1207 black) on frame F. The algorithm is taken from 20.2 faces.el. */
1205 1208
3443 old_value = LFACE_INVERSE (lface); 3446 old_value = LFACE_INVERSE (lface);
3444 LFACE_INVERSE (lface) = value; 3447 LFACE_INVERSE (lface) = value;
3445 } 3448 }
3446 else if (EQ (attr, QCforeground)) 3449 else if (EQ (attr, QCforeground))
3447 { 3450 {
3448 if (!UNSPECIFIEDP (value) 3451 if (!UNSPECIFIEDP (value))
3449 && !EQ (value, Qunspecified_fg) && !EQ (value, Qunspecified_bg))
3450 { 3452 {
3451 /* Don't check for valid color names here because it depends 3453 /* Don't check for valid color names here because it depends
3452 on the frame (display) whether the color will be valid 3454 on the frame (display) whether the color will be valid
3453 when the face is realized. */ 3455 when the face is realized. */
3454 CHECK_STRING (value, 3); 3456 CHECK_STRING (value, 3);
3458 old_value = LFACE_FOREGROUND (lface); 3460 old_value = LFACE_FOREGROUND (lface);
3459 LFACE_FOREGROUND (lface) = value; 3461 LFACE_FOREGROUND (lface) = value;
3460 } 3462 }
3461 else if (EQ (attr, QCbackground)) 3463 else if (EQ (attr, QCbackground))
3462 { 3464 {
3463 if (!UNSPECIFIEDP (value) 3465 if (!UNSPECIFIEDP (value))
3464 && !EQ (value, Qunspecified_bg) && !EQ (value, Qunspecified_fg))
3465 { 3466 {
3466 /* Don't check for valid color names here because it depends 3467 /* Don't check for valid color names here because it depends
3467 on the frame (display) whether the color will be valid 3468 on the frame (display) whether the color will be valid
3468 when the face is realized. */ 3469 when the face is realized. */
3469 CHECK_STRING (value, 3); 3470 CHECK_STRING (value, 3);
5705 if (CONSP (color) && STRINGP (XCDR (color))) 5706 if (CONSP (color) && STRINGP (XCDR (color)))
5706 LFACE_FOREGROUND (lface) = XCDR (color); 5707 LFACE_FOREGROUND (lface) = XCDR (color);
5707 else if (FRAME_X_P (f)) 5708 else if (FRAME_X_P (f))
5708 return 0; 5709 return 0;
5709 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) 5710 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
5710 LFACE_FOREGROUND (lface) = Qunspecified_fg; 5711 LFACE_FOREGROUND (lface) = build_string (unspecified_fg);
5711 else 5712 else
5712 abort (); 5713 abort ();
5713 } 5714 }
5714 5715
5715 if (UNSPECIFIEDP (LFACE_BACKGROUND (lface))) 5716 if (UNSPECIFIEDP (LFACE_BACKGROUND (lface)))
5720 if (CONSP (color) && STRINGP (XCDR (color))) 5721 if (CONSP (color) && STRINGP (XCDR (color)))
5721 LFACE_BACKGROUND (lface) = XCDR (color); 5722 LFACE_BACKGROUND (lface) = XCDR (color);
5722 else if (FRAME_X_P (f)) 5723 else if (FRAME_X_P (f))
5723 return 0; 5724 return 0;
5724 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) 5725 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
5725 LFACE_BACKGROUND (lface) = Qunspecified_bg; 5726 LFACE_BACKGROUND (lface) = build_string (unspecified_bg);
5726 else 5727 else
5727 abort (); 5728 abort ();
5728 } 5729 }
5729 5730
5730 if (UNSPECIFIEDP (LFACE_STIPPLE (lface))) 5731 if (UNSPECIFIEDP (LFACE_STIPPLE (lface)))
6660 staticpro (&Qbackground_color); 6661 staticpro (&Qbackground_color);
6661 Qforeground_color = intern ("foreground-color"); 6662 Qforeground_color = intern ("foreground-color");
6662 staticpro (&Qforeground_color); 6663 staticpro (&Qforeground_color);
6663 Qunspecified = intern ("unspecified"); 6664 Qunspecified = intern ("unspecified");
6664 staticpro (&Qunspecified); 6665 staticpro (&Qunspecified);
6665 Qunspecified_fg = intern ("unspecified-fg");
6666 staticpro (&Qunspecified_fg);
6667 Qunspecified_bg = intern ("unspecified-bg");
6668 staticpro (&Qunspecified_bg);
6669 6666
6670 Qx_charset_registry = intern ("x-charset-registry"); 6667 Qx_charset_registry = intern ("x-charset-registry");
6671 staticpro (&Qx_charset_registry); 6668 staticpro (&Qx_charset_registry);
6672 Qface_alias = intern ("face-alias"); 6669 Qface_alias = intern ("face-alias");
6673 staticpro (&Qface_alias); 6670 staticpro (&Qface_alias);