Refill some copyright headers.
[bpt/emacs.git] / src / xfaces.c
index 520546c..9d3c592 100644 (file)
@@ -1,6 +1,8 @@
 /* xfaces.c -- "Face" primitives.
+
    Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+  2005, 2006, 2007, 2008, 2009, 2010, 2011
+  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -321,11 +323,6 @@ Lisp_Object QCreverse_video;
 Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit;
 Lisp_Object QCfontset;
 
-/* Keywords symbols used for font properties.  */
-extern Lisp_Object QCfoundry, QCadstyle, QCregistry;
-extern Lisp_Object QCspacing, QCsize, QCavgwidth;
-extern Lisp_Object Qp;
-
 /* Symbols used for attribute values.  */
 
 Lisp_Object Qnormal, Qbold, Qultra_light, Qextra_light, Qlight;
@@ -351,7 +348,6 @@ Lisp_Object Qframe_set_background_mode;
 Lisp_Object Qdefault, Qtool_bar, Qregion, Qfringe;
 Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse, Qmenu;
 Lisp_Object Qmode_line_inactive, Qvertical_border;
-extern Lisp_Object Qmode_line;
 
 /* The symbol `face-alias'.  A symbols having that property is an
    alias for another face.  Value of the property is the name of
@@ -359,8 +355,6 @@ 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
@@ -411,7 +405,6 @@ Lisp_Object Qforeground_color, Qbackground_color;
 /* The symbols `face' and `mouse-face' used as text properties.  */
 
 Lisp_Object Qface;
-extern Lisp_Object Qmouse_face;
 
 /* Property for basic faces which other faces cannot inherit.  */
 
@@ -513,7 +506,6 @@ struct named_merge_point;
 static void map_tty_color (struct frame *, struct face *,
                            enum lface_attribute_index, int *);
 static Lisp_Object resolve_face_name (Lisp_Object, int);
-static int may_use_scalable_font_p (const char *);
 static void set_font_frame_param (Lisp_Object, Lisp_Object);
 static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *,
                                  int, struct named_merge_point *);
@@ -521,7 +513,7 @@ static int load_pixmap (struct frame *, Lisp_Object, unsigned *, unsigned *);
 static struct frame *frame_or_selected_frame (Lisp_Object, int);
 static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
 static void free_face_colors (struct frame *, struct face *);
-static int face_color_gray_p (struct frame *, char *);
+static int face_color_gray_p (struct frame *, const char *);
 static struct face *realize_face (struct face_cache *, Lisp_Object *,
                                   int);
 static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
@@ -726,10 +718,7 @@ x_free_gc (struct frame *f, GC gc)
 /* W32 emulation of GCs */
 
 static INLINE GC
-x_create_gc (f, mask, xgcv)
-     struct frame *f;
-     unsigned long mask;
-     XGCValues *xgcv;
+x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
 {
   GC gc;
   BLOCK_INPUT;
@@ -743,9 +732,7 @@ x_create_gc (f, mask, xgcv)
 /* Free GC which was used on frame F.  */
 
 static INLINE void
-x_free_gc (f, gc)
-     struct frame *f;
-     GC gc;
+x_free_gc (struct frame *f, GC gc)
 {
   IF_DEBUG (xassert (--ngcs >= 0));
   xfree (gc);
@@ -757,10 +744,9 @@ x_free_gc (f, gc)
 /* NS emulation of GCs */
 
 static INLINE GC
-x_create_gc (f, mask, xgcv)
-     struct frame *f;
-     unsigned long mask;
-     XGCValues *xgcv;
+x_create_gc (struct frame *f,
+             unsigned long mask,
+             XGCValues *xgcv)
 {
   GC gc = xmalloc (sizeof (*gc));
   if (gc)
@@ -769,9 +755,7 @@ x_create_gc (f, mask, xgcv)
 }
 
 static INLINE void
-x_free_gc (f, gc)
-     struct frame *f;
-     GC gc;
+x_free_gc (struct frame *f, GC gc)
 {
   xfree (gc);
 }
@@ -1177,7 +1161,8 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor
 /* A version of defined_color for non-X frames.  */
 
 int
-tty_defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc)
+tty_defined_color (struct frame *f, const char *color_name,
+                  XColor *color_def, int alloc)
 {
   int status = 1;
 
@@ -1212,7 +1197,7 @@ tty_defined_color (struct frame *f, char *color_name, XColor *color_def, int all
    This does the right thing for any type of frame.  */
 
 int
-defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc)
+defined_color (struct frame *f, const char *color_name, XColor *color_def, int alloc)
 {
   if (!FRAME_WINDOW_P (f))
     return tty_defined_color (f, color_name, color_def, alloc);
@@ -1272,7 +1257,7 @@ tty_color_name (struct frame *f, int idx)
    The criterion implemented here is not a terribly sophisticated one.  */
 
 static int
-face_color_gray_p (struct frame *f, char *color_name)
+face_color_gray_p (struct frame *f, const char *color_name)
 {
   XColor color;
   int gray_p;
@@ -1299,7 +1284,7 @@ face_color_gray_p (struct frame *f, char *color_name)
    color.  */
 
 static int
-face_color_supported_p (struct frame *f, char *color_name, int background_p)
+face_color_supported_p (struct frame *f, const char *color_name, int background_p)
 {
   Lisp_Object frame;
   XColor not_used;
@@ -3599,8 +3584,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
 /* Make menus on frame F appear as specified by the `menu' face.  */
 
 static void
-x_update_menu_appearance (f)
-     struct frame *f;
+x_update_menu_appearance (struct frame *f)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   XrmDatabase rdb;
@@ -3673,8 +3657,6 @@ x_update_menu_appearance (f)
          if (! NILP (xlfd))
            {
 #if defined HAVE_X_I18N
-             extern char *xic_create_fontsetname
-                (char *base_fontname, Bool motif);
              char *fontsetname = xic_create_fontsetname (SDATA (xlfd), motif);
 #else
              char *fontsetname = (char *) SDATA (xlfd);
@@ -4558,7 +4540,7 @@ uncache_face (struct face_cache *c, struct face *face)
    Value is the ID of the face found.  If no suitable face is found,
    realize a new one.  */
 
-INLINE int
+static INLINE int
 lookup_face (struct frame *f, Lisp_Object *attr)
 {
   struct face_cache *cache = FRAME_FACE_CACHE (f);
@@ -5605,6 +5587,7 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
       struct face *former_face = cache->faces_by_id[former_face_id];
       uncache_face (cache, former_face);
       free_realized_face (cache->f, former_face);
+      SET_FRAME_GARBAGED (cache->f);
     }
 
   if (FRAME_WINDOW_P (cache->f))
@@ -6073,15 +6056,10 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
    The face returned is suitable for displaying ASCII characters.  */
 
 int
-face_at_buffer_position (w, pos, region_beg, region_end,
-                        endptr, limit, mouse, base_face_id)
-     struct window *w;
-     EMACS_INT pos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     EMACS_INT limit;
-     int mouse;
-     int base_face_id;
+face_at_buffer_position (struct window *w, EMACS_INT pos,
+                        EMACS_INT region_beg, EMACS_INT region_end,
+                        EMACS_INT *endptr, EMACS_INT limit,
+                        int mouse, int base_face_id)
 {
   struct frame *f = XFRAME (w->frame);
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
@@ -6181,15 +6159,10 @@ face_at_buffer_position (w, pos, region_beg, region_end,
    simply disregards the `face' properties of all overlays.  */
 
 int
-face_for_overlay_string (w, pos, region_beg, region_end,
-                        endptr, limit, mouse, overlay)
-     struct window *w;
-     EMACS_INT pos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     EMACS_INT limit;
-     int mouse;
-     Lisp_Object overlay;
+face_for_overlay_string (struct window *w, EMACS_INT pos,
+                        EMACS_INT region_beg, EMACS_INT region_end,
+                        EMACS_INT *endptr, EMACS_INT limit,
+                        int mouse, Lisp_Object overlay)
 {
   struct frame *f = XFRAME (w->frame);
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
@@ -6274,15 +6247,11 @@ face_for_overlay_string (w, pos, region_beg, region_end,
    for displaying ASCII characters.  */
 
 int
-face_at_string_position (w, string, pos, bufpos, region_beg,
-                        region_end, endptr, base_face_id, mouse_p)
-     struct window *w;
-     Lisp_Object string;
-     EMACS_INT pos, bufpos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     enum face_id base_face_id;
-     int mouse_p;
+face_at_string_position (struct window *w, Lisp_Object string,
+                        EMACS_INT pos, EMACS_INT bufpos,
+                        EMACS_INT region_beg, EMACS_INT region_end,
+                        EMACS_INT *endptr, enum face_id base_face_id,
+                        int mouse_p)
 {
   Lisp_Object prop, position, end, limit;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -6764,7 +6733,8 @@ See `set-face-stipple' for possible values for this variable.  */);
   Vface_default_stipple = make_pure_c_string ("gray3");
 
   DEFVAR_LISP ("tty-defined-color-alist", &Vtty_defined_color_alist,
-   doc: /* An alist of defined terminal colors and their RGB values.  */);
+   doc: /* An alist of defined terminal colors and their RGB values.
+See the docstring of `tty-color-alist' for the details.  */);
   Vtty_defined_color_alist = Qnil;
 
   DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed,
@@ -6790,10 +6760,10 @@ Each element is of the form:
    (FACE REPLACEMENT...),
 
 which causes display of the face FACE to use REPLACEMENT... instead.
-REPLACEMENT... is interpreted the same way the value of a `face' text
-property is: it may be (1) A face name, (2) A list of face names, (3) A
-property-list of face attribute/value pairs, or (4) A list of face names
-intermixed with lists containing face attribute/value pairs.
+REPLACEMENT... is interpreted the same way as the value of a `face'
+text property: it may be (1) A face name, (2) A list of face names,
+(3) A property-list of face attribute/value pairs, or (4) A list of
+face names or lists containing face attribute/value pairs.
 
 Multiple entries in REPLACEMENT... are merged together to form the final
 result, with faces or attributes earlier in the list taking precedence
@@ -6817,7 +6787,11 @@ face definitions.  For instance, the mode my-mode could define a face
 `my-mode-default', and then in the mode setup function, do:
 
    (set (make-local-variable 'face-remapping-alist)
-        '((default my-mode-default)))).  */);
+        '((default my-mode-default)))).
+
+Because Emacs normally only redraws screen areas when the underlying
+buffer contents change, you may need to call `redraw-display' after
+changing this variable for it to take effect.  */);
   Vface_remapping_alist = Qnil;
 
   DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist,
@@ -6837,5 +6811,3 @@ a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point.  */);
 #endif
 }
 
-/* arch-tag: 8a0f7598-5517-408d-9ab3-1da6fcd4c749
-   (do not change this comment) */