diff options
| author | Gerd Moellmann | 1999-09-12 20:22:02 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-09-12 20:22:02 +0000 |
| commit | 926106201f8bfebbaac3c5b0f5e36192b7f00f1b (patch) | |
| tree | 8edf052821df809bfe1b97a4b860ced3272288b6 /src | |
| parent | 92a90e893abce4d7112aec8b00aff4234a5614bf (diff) | |
| download | emacs-926106201f8bfebbaac3c5b0f5e36192b7f00f1b.tar.gz emacs-926106201f8bfebbaac3c5b0f5e36192b7f00f1b.zip | |
(Fx_family_fonts): Replaces Fx_font_list.
(syms_of_xfaces): Defsubr accordingly.
(lface_from_face_name): Resolve face aliases.
(Qmode_line): Replaces Qmodeline.
(realize_basic_faces): Use Qmode_line.
(syms_of_xfaces): Initialize Qmode_line.
(Qframe_update_face_colors): New.
(syms_of_xfaces): Initialize call.
(update_face_from_frame_parameter): Call that function when
the frame's background changes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index e4f7d7f7244..d4ec11d5f04 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -278,11 +278,22 @@ Lisp_Object Qunspecified; | |||
| 278 | 278 | ||
| 279 | Lisp_Object Qx_charset_registry; | 279 | Lisp_Object Qx_charset_registry; |
| 280 | 280 | ||
| 281 | /* The name of the function to call when the background of the frame | ||
| 282 | has changed, frame_update_face_colors. */ | ||
| 283 | |||
| 284 | Lisp_Object Qframe_update_face_colors; | ||
| 285 | |||
| 281 | /* Names of basic faces. */ | 286 | /* Names of basic faces. */ |
| 282 | 287 | ||
| 283 | Lisp_Object Qdefault, Qmodeline, Qtool_bar, Qregion, Qfringe; | 288 | Lisp_Object Qdefault, Qmode_line, Qtool_bar, Qregion, Qfringe; |
| 284 | Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse;; | 289 | Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse;; |
| 285 | 290 | ||
| 291 | /* The symbol `face-alias'. A symbols having that property is an | ||
| 292 | alias for another face. Value of the property is the name of | ||
| 293 | the aliased face. */ | ||
| 294 | |||
| 295 | Lisp_Object Qface_alias; | ||
| 296 | |||
| 286 | /* Names of frame parameters related to faces. */ | 297 | /* Names of frame parameters related to faces. */ |
| 287 | 298 | ||
| 288 | extern Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; | 299 | extern Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; |
| @@ -2274,7 +2285,7 @@ font_list (f, pattern, family, registry_and_encoding, fonts) | |||
| 2274 | 2285 | ||
| 2275 | 2286 | ||
| 2276 | /* Remove elements from LIST whose cars are `equal'. Called from | 2287 | /* Remove elements from LIST whose cars are `equal'. Called from |
| 2277 | x-font-list and x-font-family-list to remove duplicate font | 2288 | x-family-fonts and x-font-family-list to remove duplicate font |
| 2278 | entries. */ | 2289 | entries. */ |
| 2279 | 2290 | ||
| 2280 | static void | 2291 | static void |
| @@ -2294,7 +2305,7 @@ remove_duplicates (list) | |||
| 2294 | } | 2305 | } |
| 2295 | 2306 | ||
| 2296 | 2307 | ||
| 2297 | DEFUN ("x-font-list", Fxfont_list, Sx_font_list, 0, 2, 0, | 2308 | DEFUN ("x-family-fonts", Fx_family_fonts, Sx_family_fonts, 0, 2, 0, |
| 2298 | "Return a list of available fonts of family FAMILY on FRAME.\n\ | 2309 | "Return a list of available fonts of family FAMILY on FRAME.\n\ |
| 2299 | If FAMILY is omitted or nil, list all families.\n\ | 2310 | If FAMILY is omitted or nil, list all families.\n\ |
| 2300 | Otherwise, FAMILY must be a string, possibly containing wildcards\n\ | 2311 | Otherwise, FAMILY must be a string, possibly containing wildcards\n\ |
| @@ -2610,9 +2621,11 @@ check_lface (lface) | |||
| 2610 | /* Return the face definition of FACE_NAME on frame F. F null means | 2621 | /* Return the face definition of FACE_NAME on frame F. F null means |
| 2611 | return the global definition. FACE_NAME may be a string or a | 2622 | return the global definition. FACE_NAME may be a string or a |
| 2612 | symbol (apparently Emacs 20.2 allows strings as face names in face | 2623 | symbol (apparently Emacs 20.2 allows strings as face names in face |
| 2613 | text properties; ediff uses that). If SIGNAL_P is non-zero, signal | 2624 | text properties; ediff uses that). If FACE_NAME is an alias for |
| 2614 | an error if FACE_NAME is not a valid face name. If SIGNAL_P is | 2625 | another face, return that face's definition. If SIGNAL_P is |
| 2615 | zero, value is nil if FACE_NAME is not a valid face name. */ | 2626 | non-zero, signal an error if FACE_NAME is not a valid face name. |
| 2627 | If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face | ||
| 2628 | name. */ | ||
| 2616 | 2629 | ||
| 2617 | static INLINE Lisp_Object | 2630 | static INLINE Lisp_Object |
| 2618 | lface_from_face_name (f, face_name, signal_p) | 2631 | lface_from_face_name (f, face_name, signal_p) |
| @@ -2620,11 +2633,17 @@ lface_from_face_name (f, face_name, signal_p) | |||
| 2620 | Lisp_Object face_name; | 2633 | Lisp_Object face_name; |
| 2621 | int signal_p; | 2634 | int signal_p; |
| 2622 | { | 2635 | { |
| 2623 | Lisp_Object lface; | 2636 | Lisp_Object lface, alias; |
| 2624 | 2637 | ||
| 2625 | if (STRINGP (face_name)) | 2638 | if (STRINGP (face_name)) |
| 2626 | face_name = intern (XSTRING (face_name)->data); | 2639 | face_name = intern (XSTRING (face_name)->data); |
| 2627 | 2640 | ||
| 2641 | /* If FACE_NAME is an alias for another face, return the definition | ||
| 2642 | of the aliased face. */ | ||
| 2643 | alias = Fget (face_name, Qface_alias); | ||
| 2644 | if (!NILP (alias)) | ||
| 2645 | face_name = alias; | ||
| 2646 | |||
| 2628 | if (f) | 2647 | if (f) |
| 2629 | lface = assq_no_quit (face_name, f->face_alist); | 2648 | lface = assq_no_quit (face_name, f->face_alist); |
| 2630 | else | 2649 | else |
| @@ -3557,7 +3576,7 @@ update_face_from_frame_parameter (f, param, new_value) | |||
| 3557 | 3576 | ||
| 3558 | /* If there are no faces yet, give up. This is the case when called | 3577 | /* If there are no faces yet, give up. This is the case when called |
| 3559 | from Fx_create_frame, and we do the necessary things later in | 3578 | from Fx_create_frame, and we do the necessary things later in |
| 3560 | face-set-after-frame-defaults. */ | 3579 | face-set-after-frame-defaults. */ |
| 3561 | if (NILP (f->face_alist)) | 3580 | if (NILP (f->face_alist)) |
| 3562 | return; | 3581 | return; |
| 3563 | 3582 | ||
| @@ -3570,6 +3589,14 @@ update_face_from_frame_parameter (f, param, new_value) | |||
| 3570 | } | 3589 | } |
| 3571 | else if (EQ (param, Qbackground_color)) | 3590 | else if (EQ (param, Qbackground_color)) |
| 3572 | { | 3591 | { |
| 3592 | Lisp_Object frame; | ||
| 3593 | |||
| 3594 | /* Changing the background color might change the background | ||
| 3595 | mode, so that we have to load new defface specs. Call | ||
| 3596 | frame-update-face-colors to do that. */ | ||
| 3597 | XSETFRAME (frame, f); | ||
| 3598 | call1 (Qframe_update_face_colors, frame); | ||
| 3599 | |||
| 3573 | lface = lface_from_face_name (f, Qdefault, 1); | 3600 | lface = lface_from_face_name (f, Qdefault, 1); |
| 3574 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) | 3601 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
| 3575 | ? new_value : Qunspecified); | 3602 | ? new_value : Qunspecified); |
| @@ -5235,7 +5262,7 @@ realize_basic_faces (f) | |||
| 5235 | 5262 | ||
| 5236 | if (realize_default_face (f)) | 5263 | if (realize_default_face (f)) |
| 5237 | { | 5264 | { |
| 5238 | realize_named_face (f, Qmodeline, MODE_LINE_FACE_ID); | 5265 | realize_named_face (f, Qmode_line, MODE_LINE_FACE_ID); |
| 5239 | realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); | 5266 | realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); |
| 5240 | realize_named_face (f, Qfringe, BITMAP_AREA_FACE_ID); | 5267 | realize_named_face (f, Qfringe, BITMAP_AREA_FACE_ID); |
| 5241 | realize_named_face (f, Qheader_line, HEADER_LINE_FACE_ID); | 5268 | realize_named_face (f, Qheader_line, HEADER_LINE_FACE_ID); |
| @@ -6249,7 +6276,9 @@ syms_of_xfaces () | |||
| 6249 | staticpro (&Qface); | 6276 | staticpro (&Qface); |
| 6250 | Qpixmap_spec_p = intern ("pixmap-spec-p"); | 6277 | Qpixmap_spec_p = intern ("pixmap-spec-p"); |
| 6251 | staticpro (&Qpixmap_spec_p); | 6278 | staticpro (&Qpixmap_spec_p); |
| 6252 | 6279 | Qframe_update_face_colors = intern ("frame-update-face-colors"); | |
| 6280 | staticpro (&Qframe_update_face_colors); | ||
| 6281 | |||
| 6253 | /* Lisp face attribute keywords. */ | 6282 | /* Lisp face attribute keywords. */ |
| 6254 | QCfamily = intern (":family"); | 6283 | QCfamily = intern (":family"); |
| 6255 | staticpro (&QCfamily); | 6284 | staticpro (&QCfamily); |
| @@ -6348,10 +6377,12 @@ syms_of_xfaces () | |||
| 6348 | 6377 | ||
| 6349 | Qx_charset_registry = intern ("x-charset-registry"); | 6378 | Qx_charset_registry = intern ("x-charset-registry"); |
| 6350 | staticpro (&Qx_charset_registry); | 6379 | staticpro (&Qx_charset_registry); |
| 6380 | Qface_alias = intern ("face-alias"); | ||
| 6381 | staticpro (&Qface_alias); | ||
| 6351 | Qdefault = intern ("default"); | 6382 | Qdefault = intern ("default"); |
| 6352 | staticpro (&Qdefault); | 6383 | staticpro (&Qdefault); |
| 6353 | Qmodeline = intern ("modeline"); | 6384 | Qmode_line = intern ("mode-line"); |
| 6354 | staticpro (&Qmodeline); | 6385 | staticpro (&Qmode_line); |
| 6355 | Qtool_bar = intern ("tool-bar"); | 6386 | Qtool_bar = intern ("tool-bar"); |
| 6356 | staticpro (&Qtool_bar); | 6387 | staticpro (&Qtool_bar); |
| 6357 | Qregion = intern ("region"); | 6388 | Qregion = intern ("region"); |
| @@ -6436,7 +6467,7 @@ scaled if its name matches a regular expression in the list."); | |||
| 6436 | defsubr (&Spixmap_spec_p); | 6467 | defsubr (&Spixmap_spec_p); |
| 6437 | defsubr (&Sx_list_fonts); | 6468 | defsubr (&Sx_list_fonts); |
| 6438 | defsubr (&Sinternal_face_x_get_resource); | 6469 | defsubr (&Sinternal_face_x_get_resource); |
| 6439 | defsubr (&Sx_font_list); | 6470 | defsubr (&Sx_family_fonts); |
| 6440 | defsubr (&Sx_font_family_list); | 6471 | defsubr (&Sx_font_family_list); |
| 6441 | #endif /* HAVE_X_WINDOWS */ | 6472 | #endif /* HAVE_X_WINDOWS */ |
| 6442 | 6473 | ||