X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d196a54737897fdd4a19ca62034f53ce731d5f20..09a1444abb2494d0db3d71e4c942f5210786b619:/src/xfaces.c diff --git a/src/xfaces.c b/src/xfaces.c index 146036aa97..2884bccb3b 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -195,11 +195,13 @@ Boston, MA 02111-1307, USA. */ #include #include #include +#include /* This needs to be before termchar.h */ #include "lisp.h" #include "charset.h" #include "keyboard.h" #include "frame.h" +#include "termhooks.h" #ifdef HAVE_WINDOW_SYSTEM #include "fontset.h" @@ -242,6 +244,7 @@ Boston, MA 02111-1307, USA. */ #include "blockinput.h" #include "window.h" #include "intervals.h" +#include "termchar.h" #ifdef HAVE_X_WINDOWS @@ -333,6 +336,8 @@ extern Lisp_Object Qmode_line; Lisp_Object Qface_alias; +extern Lisp_Object Qcircular_list; + /* Default stipple pattern used on monochrome displays. This stipple pattern is used on monochrome displays instead of shades of gray for a face background color. See `set-face-stipple' for possible @@ -468,7 +473,7 @@ struct named_merge_point; static void map_tty_color P_ ((struct frame *, struct face *, enum lface_attribute_index, int *)); -static Lisp_Object resolve_face_name P_ ((Lisp_Object)); +static Lisp_Object resolve_face_name P_ ((Lisp_Object, int)); static int may_use_scalable_font_p P_ ((const char *)); static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object)); static int better_font_p P_ ((int *, struct font_name *, struct font_name *, @@ -3201,27 +3206,63 @@ push_named_merge_point (struct named_merge_point *new_named_merge_point, +static Lisp_Object +internal_resolve_face_name (nargs, args) + int nargs; + Lisp_Object *args; +{ + Fget (args[0], args[1]); +} + +static Lisp_Object +resolve_face_name_error (ignore) + Lisp_Object ignore; +{ + return Qnil; +} /* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it - to make it a symvol. If FACE_NAME is an alias for another face, - return that face's name. */ + to make it a symbol. If FACE_NAME is an alias for another face, + return that face's name. + + Return default face in case of errors. */ static Lisp_Object -resolve_face_name (face_name) +resolve_face_name (face_name, signal_p) Lisp_Object face_name; + int signal_p; { - Lisp_Object aliased; + Lisp_Object orig_face; + Lisp_Object tortoise, hare; if (STRINGP (face_name)) face_name = intern (SDATA (face_name)); - while (SYMBOLP (face_name)) + if (NILP (face_name) || !SYMBOLP (face_name)) + return face_name; + + orig_face = face_name; + tortoise = hare = face_name; + + while (1) { - aliased = Fget (face_name, Qface_alias); - if (NILP (aliased)) + face_name = hare; + hare = Fget (hare, Qface_alias); + if (NILP (hare) || !SYMBOLP (hare)) break; - else - face_name = aliased; + + face_name = hare; + hare = Fget (hare, Qface_alias); + if (NILP (hare) || !SYMBOLP (hare)) + break; + + tortoise = Fget (tortoise, Qface_alias); + if (EQ (hare, tortoise)) + { + if (signal_p) + Fsignal (Qcircular_list, Fcons (orig_face, Qnil)); + return Qdefault; + } } return face_name; @@ -3245,7 +3286,7 @@ lface_from_face_name (f, face_name, signal_p) { Lisp_Object lface; - face_name = resolve_face_name (face_name); + face_name = resolve_face_name (face_name, signal_p); if (f) lface = assq_no_quit (face_name, f->face_alist); @@ -3980,7 +4021,7 @@ FRAME 0 means change the face on all frames, and change the default CHECK_SYMBOL (face); CHECK_SYMBOL (attr); - face = resolve_face_name (face); + face = resolve_face_name (face, 1); /* If FRAME is 0, change face on all frames, and change the default for new frames. */ @@ -6071,7 +6112,7 @@ tty_supports_face_attributes_p (f, attrs, def_face) /* See if the capabilities we selected above are supported, with the given colors. */ if (test_caps != 0 && - ! tty_capable_p (f, test_caps, fg_tty_color.pixel, bg_tty_color.pixel)) + ! tty_capable_p (FRAME_TTY (f), test_caps, fg_tty_color.pixel, bg_tty_color.pixel)) return 0; @@ -6864,7 +6905,8 @@ realize_basic_faces (f) { FRAME_FACE_CACHE (f)->menu_face_changed_p = 0; #ifdef USE_X_TOOLKIT - x_update_menu_appearance (f); + if (FRAME_WINDOW_P (f)) + x_update_menu_appearance (f); #endif } @@ -6951,7 +6993,7 @@ realize_default_face (f) LFACE_FOREGROUND (lface) = XCDR (color); else if (FRAME_WINDOW_P (f)) return 0; - else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) + else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) LFACE_FOREGROUND (lface) = build_string (unspecified_fg); else abort (); @@ -6966,7 +7008,7 @@ realize_default_face (f) LFACE_BACKGROUND (lface) = XCDR (color); else if (FRAME_WINDOW_P (f)) return 0; - else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) + else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) LFACE_BACKGROUND (lface) = build_string (unspecified_bg); else abort (); @@ -7055,6 +7097,11 @@ realize_face (cache, attrs, c, base_face, former_face_id) face = realize_x_face (cache, attrs, c, base_face); else if (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f)) face = realize_tty_face (cache, attrs, c); + else if (FRAME_INITIAL_P (cache->f)) + { + /* Create a dummy face. */ + face = make_realized_face (attrs); + } else abort (); @@ -7084,8 +7131,9 @@ realize_x_face (cache, attrs, c, base_face) int c; struct face *base_face; { + struct face *face = NULL; #ifdef HAVE_WINDOW_SYSTEM - struct face *face, *default_face; + struct face *default_face; struct frame *f; Lisp_Object stipple, overline, strike_through, box; @@ -7281,8 +7329,8 @@ realize_x_face (cache, attrs, c, base_face) face->stipple = load_pixmap (f, stipple, &face->pixmap_w, &face->pixmap_h); xassert (FACE_SUITABLE_FOR_CHAR_P (face, c)); - return face; #endif /* HAVE_WINDOW_SYSTEM */ + return face; }