*** empty log message ***
[bpt/emacs.git] / src / dispextern.h
index 5f62cef..54b58b7 100644 (file)
@@ -26,7 +26,10 @@ Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_X_WINDOWS
 #include <X11/Xlib.h>
-#endif
+#ifdef USE_X_TOOLKIT
+#include <X11/Intrinsic.h>
+#endif /* USE_X_TOOLKIT */
+#endif /* HAVE_X_WINDOWS */
 
 #ifdef MSDOS
 #include "msdos.h"
@@ -36,6 +39,9 @@ Boston, MA 02111-1307, USA.  */
 #include "w32gui.h"
 #endif
 
+#ifdef macintosh
+#include "macterm.h"
+#endif
 
 /* Structure forward declarations.  Some are here because function
    prototypes below reference structure types before their definition
@@ -51,22 +57,6 @@ struct window;
 
 
 \f
-/***********************************************************************
-                             Configuration
- ***********************************************************************/
-
-/* If NO_PROMPT_IN_BUFFER is zero or undefined (default), prompts are
-   inserted into minibuffers as read-only text.  Otherwise, the
-   behavior of Emacs 20.2 is restored.  Define this as part of CFLAGS
-   because dispextern.h is not included in every C source file
-   containing conditional code for it.  */
-
-#if 0
-#define NO_PROMPT_IN_BUFFER 1
-#endif
-
-
-\f
 /***********************************************************************
                              Debugging
  ***********************************************************************/
@@ -82,7 +72,7 @@ struct window;
 
 #if GLYPH_DEBUG
 #define IF_DEBUG(X)    X
-#define xassert(X)     if (!(X)) abort (); else (void) 0
+#define xassert(X)     do {if (!(X)) abort ();} while (0)
 #else
 #define IF_DEBUG(X)    (void) 0
 #define xassert(X)     (void) 0
@@ -217,6 +207,9 @@ enum glyph_type
   /* Glyph describes a character.  */
   CHAR_GLYPH,  
 
+  /* Glyph describes a composition sequence.  */
+  COMPOSITE_GLYPH,
+
   /* Glyph describes an image.  */
   IMAGE_GLYPH,
 
@@ -262,51 +255,43 @@ struct glyph
   unsigned left_box_line_p : 1;
   unsigned right_box_line_p : 1;
 
+  /* Non-zero means this glyph's physical ascent or descent is greater
+     than its logical ascent/descent, i.e. it may potentially overlap
+     glyphs above or below it.  */
+  unsigned overlaps_vertically_p : 1;
+
+  /* 1 means glyph is a padding glyph.  Padding glyphs are used for
+     characters whose visual shape consists of more than one glyph
+     (e.g. Asian characters).  All but the first glyph of such a glyph
+     sequence have the padding_p flag set.  Only used for terminal
+     frames, and there only to minimize code changes.  A better way
+     would probably be to use the width field of glyphs to express
+     padding. */
+  unsigned padding_p : 1;
+
+  /* Face of the glyph.  */
+  unsigned face_id : 23;
+
   /* A union of sub-structures for different glyph types.  */
   union
   {
-    /* Sub-structure for character glyphs (type == CHAR_GLYPH).  */
-    struct 
-    {
-      /* Character code.  */
-      unsigned code : 19;
-
-      /* Character's face.  */
-      unsigned face_id : 11;
-
-      /* 1 means glyph is a padding glyph.  Padding glyphs are used
-        for characters whose visual shape consists of more than one
-        glyph (e.g. Asian characters).  All but the first glyph of
-        such a glyph sequence have the padding_p flag set.  Only used
-        for terminal frames, and there only to minimize code changes.
-        A better way would probably be to use the width field of
-        glyphs to express padding.  */
-      unsigned padding_p : 1;
-    }
-    ch;
+    /* Character code for character glyphs (type == CHAR_GLYPH).  */
+    unsigned ch;
 
-    /* Sub-structure for image glyphs (type == IMAGE_GLYPH).  */
-    struct
-    {
-      /* Image id.  */
-      unsigned id : 20;
+    /* Composition ID for composition glyphs (type == COMPOSITION_GLYPH)  */
+    unsigned cmp_id;
 
-      /* Face under the image.  */
-      unsigned face_id : 12;
-    }
-    img;
+    /* Image ID for image glyphs (type == IMAGE_GLYPH).  */
+    unsigned img_id;
 
     /* Sub-structure for type == STRETCH_GLYPH.  */
     struct
     {
       /* The height of the glyph.  */
-      unsigned height  : 11;
+      unsigned height  : 16;
 
       /* The ascent of the glyph.  */
-      unsigned ascent  : 10;
-
-      /* The face of the stretch glyph.  */
-      unsigned face_id : 11;
+      unsigned ascent  : 16;
     }
     stretch;
     
@@ -326,19 +311,28 @@ struct glyph
 #define GLYPH_EQUAL_P(X, Y)                                    \
      ((X)->type == (Y)->type                                   \
       && (X)->u.val == (Y)->u.val                              \
+      && (X)->face_id == (Y)->face_id                          \
+      && (X)->padding_p == (Y)->padding_p                      \
       && (X)->left_box_line_p == (Y)->left_box_line_p          \
       && (X)->right_box_line_p == (Y)->right_box_line_p                \
       && (X)->voffset == (Y)->voffset)
 
+/* Are character codes, faces, padding_ps of glyphs *X and *Y equal?  */
+
+#define GLYPH_CHAR_AND_FACE_EQUAL_P(X, Y)      \
+  ((X)->u.ch == (Y)->u.ch                      \
+   && (X)->face_id == (Y)->face_id             \
+   && (X)->padding_p == (Y)->padding_p)
+
 /* Fill a character glyph GLYPH.  CODE, FACE_ID, PADDING_P correspond
    to the bits defined for the typedef `GLYPH' in lisp.h.  */
      
 #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P)        \
      do                                                        \
        {                                               \
-         (GLYPH).u.ch.code = (CODE);                   \
-         (GLYPH).u.ch.face_id = (FACE_ID);             \
-         (GLYPH).u.ch.padding_p = (PADDING_P);         \
+         (GLYPH).u.ch = (CODE);                                \
+         (GLYPH).face_id = (FACE_ID);                  \
+         (GLYPH).padding_p = (PADDING_P);              \
        }                                               \
      while (0)
 
@@ -349,18 +343,20 @@ struct glyph
      SET_CHAR_GLYPH ((GLYPH),                                  \
                     FAST_GLYPH_CHAR ((FROM)),                  \
                     FAST_GLYPH_FACE ((FROM)),                  \
-                    ((FROM) & GLYPH_MASK_PADDING) != 0)
+                    0)
 
-/* Construct a typedef'd GLYPH value from a character glyph GLYPH.  */
+/* Construct a glyph code from a character glyph GLYPH.  If the
+   character is multibyte, return -1 as we can't use glyph table for a
+   multibyte character. */
      
-#define GLYPH_FROM_CHAR_GLYPH(GLYPH)                           \
-     ((GLYPH).u.ch.code                                                \
-       | ((GLYPH).u.ch.face_id << CHARACTERBITS)               \
-       | ((GLYPH).u.ch.padding_p ? GLYPH_MASK_PADDING : 0))
+#define GLYPH_FROM_CHAR_GLYPH(GLYPH)           \
+  ((GLYPH).u.ch < 256                          \
+   ? ((GLYPH).u.ch | ((GLYPH).face_id << 8))   \
+   : -1)
 
 /* Is GLYPH a padding glyph?  */
      
-#define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).u.ch.padding_p
+#define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p
 
 
 
@@ -469,12 +465,18 @@ struct glyph_matrix
 
   /* Non-zero means window displayed in this matrix has a top mode
      line.  */
-  unsigned top_line_p : 1;
+  unsigned header_line_p : 1;
 
 #ifdef GLYPH_DEBUG
   /* A string identifying the method used to display the matrix.  */
   char method[512];
 #endif
+
+  /* The buffer this matrix displays.  Set in redisplay_internal.  */
+  struct buffer *buffer;
+
+  /* Values of BEGV and ZV as of last redisplay.  */
+  int begv, zv;
 };
 
 
@@ -563,10 +565,15 @@ struct glyph_row
      end of the row into account.  */
   int pixel_width;
 
-  /* Height information.  The value of ascent is zero and height is 1
-     on terminal frames.  */
+  /* Logical ascent/height of this line.  The value of ascent is zero
+     and height is 1 on terminal frames.  */
   int ascent, height;
 
+  /* Physical ascent/height of this line.  If max_ascent > ascent,
+     this line overlaps the line above it on the display.  Otherwise,
+     if max_height > height, this line overlaps the line beneath it.  */
+  int phys_ascent, phys_height;
+
   /* Portion of row that is visible.  Partially visible rows may be
      found at the top and bottom of a window.  This is 1 for tty
      frames.  It may be < 0 in case of completely invisible rows.  */
@@ -639,6 +646,12 @@ struct glyph_row
   /* Non-zero means row is a mode or top-line.  */
   unsigned mode_line_p : 1;
 
+  /* 1 in a current row means this row is overlapped by another row.  */
+  unsigned overlapped_p : 1;
+
+  /* 1 in a current row means this row overlaps others.  */
+  unsigned overlapping_p : 1;
+
   /* Continuation lines width at the start of the row.  */
   int continuation_lines_width;
 };
@@ -665,7 +678,7 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
    This is always the first row in MATRIX because that's the only
    way that works in frame-based redisplay.  */
 
-#define MATRIX_TOP_LINE_ROW(MATRIX) (MATRIX)->rows
+#define MATRIX_HEADER_LINE_ROW(MATRIX) (MATRIX)->rows
 
 /* Return a pointer to first row in MATRIX used for text display.  */
 
@@ -735,7 +748,7 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
      
 #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW)          \
      (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW))                   \
-      && (ROW)->y < WINDOW_DISPLAY_TOP_LINE_HEIGHT ((W)))
+      && (ROW)->y < WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
 
 /* Non-zero if ROW is partially visible at the bottom of window W.  */
      
@@ -778,7 +791,17 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
       || ((ROW)->start.overlay_string_index >= 0       \
          && (ROW)->start.string_pos.charpos > 0))
 
-     
+/* Non-zero means ROW overlaps its predecessor.  */
+
+#define MATRIX_ROW_OVERLAPS_PRED_P(ROW) \
+     ((ROW)->phys_ascent > (ROW)->ascent)
+
+/* Non-zero means ROW overlaps its successor.  */
+
+#define MATRIX_ROW_OVERLAPS_SUCC_P(ROW)                \
+      ((ROW)->phys_height - (ROW)->phys_ascent \
+       > (ROW)->height - (ROW)->ascent)
+
 /* Non-zero means that fonts have been loaded since the last glyph
    matrix adjustments.  The function redisplay_internal adjusts glyph
    matrices when this flag is non-zero.  */
@@ -844,9 +867,9 @@ extern struct glyph_row scratch_glyph_row;
    if not known.  This macro is called under circumstances where
    MATRIX might not have been allocated yet.  */
 
-#define MATRIX_TOP_LINE_HEIGHT(MATRIX)         \
+#define MATRIX_HEADER_LINE_HEIGHT(MATRIX)      \
      ((MATRIX) && (MATRIX)->rows               \
-      ? MATRIX_TOP_LINE_ROW (MATRIX)->height   \
+      ? MATRIX_HEADER_LINE_ROW (MATRIX)->height        \
       : 0)
 
 /* Return the current height of the mode line of window W.  If not
@@ -862,10 +885,10 @@ extern struct glyph_row scratch_glyph_row;
    known from W's current glyph matrix, return an estimation based on
    the height of the font of the face `top-line'.  */
 
-#define CURRENT_TOP_LINE_HEIGHT(W)                                        \
-      (MATRIX_TOP_LINE_HEIGHT ((W)->current_matrix)                       \
-      ? MATRIX_TOP_LINE_HEIGHT ((W)->current_matrix)                      \
-      : estimate_mode_line_height (XFRAME ((W)->frame), TOP_LINE_FACE_ID))
+#define CURRENT_HEADER_LINE_HEIGHT(W)                                     \
+      (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix)                    \
+      ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix)                           \
+      : estimate_mode_line_height (XFRAME ((W)->frame), HEADER_LINE_FACE_ID))
 
 /* Return the height of the desired mode line of window W.  */
 
@@ -874,8 +897,8 @@ extern struct glyph_row scratch_glyph_row;
 
 /* Return the height of the desired top line of window W.  */
 
-#define DESIRED_TOP_LINE_HEIGHT(W) \
-     MATRIX_TOP_LINE_HEIGHT ((W)->desired_matrix)
+#define DESIRED_HEADER_LINE_HEIGHT(W) \
+     MATRIX_HEADER_LINE_HEIGHT ((W)->desired_matrix)
 
 /* Like FRAME_INTERNAL_BORDER_WIDTH but checks whether frame F is a
    window-system frame.  */
@@ -891,7 +914,7 @@ extern struct glyph_row scratch_glyph_row;
 #define WINDOW_DISPLAY_PIXEL_WIDTH(W)                                  \
      (((XFASTINT ((W)->width)                                          \
         - FRAME_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME ((W))))         \
-       - 2 * FRAME_FLAGS_AREA_COLS (XFRAME (WINDOW_FRAME ((W)))))      \
+       - FRAME_FLAGS_AREA_COLS (XFRAME (WINDOW_FRAME ((W)))))          \
        * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
 
 /* Height of the display region of W, including a mode line, if any.  */
@@ -911,9 +934,9 @@ extern struct glyph_row scratch_glyph_row;
 /* Height in pixels of the top line.  Zero if W doesn't have a top
    line.  */
      
-#define WINDOW_DISPLAY_TOP_LINE_HEIGHT(W)      \
-     (WINDOW_WANTS_TOP_LINE_P ((W))            \
-      ? CURRENT_TOP_LINE_HEIGHT (W)            \
+#define WINDOW_DISPLAY_HEADER_LINE_HEIGHT(W)   \
+     (WINDOW_WANTS_HEADER_LINE_P ((W))         \
+      ? CURRENT_HEADER_LINE_HEIGHT (W)         \
       : 0)
 
 /* Pixel height of window W without mode line.  */
@@ -927,7 +950,7 @@ extern struct glyph_row scratch_glyph_row;
 #define WINDOW_DISPLAY_TEXT_HEIGHT(W)          \
      (WINDOW_DISPLAY_PIXEL_HEIGHT ((W))                \
       - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W))  \
-      - WINDOW_DISPLAY_TOP_LINE_HEIGHT ((W)))
+      - WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
 
 /* Left edge of W in pixels relative to its frame.  */
      
@@ -935,7 +958,7 @@ extern struct glyph_row scratch_glyph_row;
      (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W))))   \
       + (WINDOW_LEFT_MARGIN ((W))                                      \
          * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W)))))                 \
-      + FRAME_FLAGS_AREA_WIDTH (XFRAME (WINDOW_FRAME ((W)))))
+      + FRAME_LEFT_FLAGS_AREA_WIDTH (XFRAME (WINDOW_FRAME ((W)))))
 
 /* Right edge of window W in pixels, relative to its frame.  */
      
@@ -1037,11 +1060,11 @@ extern struct glyph_row scratch_glyph_row;
 
 /* Value is non-zero if window W wants a top line.  */
 
-#define WINDOW_WANTS_TOP_LINE_P(W)                                     \
+#define WINDOW_WANTS_HEADER_LINE_P(W)                                  \
      (!MINI_WINDOW_P (W)                                               \
       && !(W)->pseudo_window_p                                         \
       && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W)))            \
-      && !NILP (XBUFFER ((W)->buffer)->top_line_format))
+      && !NILP (XBUFFER ((W)->buffer)->header_line_format))
 
 \f     
 /***********************************************************************
@@ -1153,8 +1176,8 @@ struct face
   int font_info_id;
 
   /* Fontset ID if this face uses a fontset, or -1.  This is only >= 0
-     if the face was realized for CHARSET_COMPOSITION.  For all other
-     charsets, a specific font is loaded from the set of fonts
+     if the face was realized for a composition sequence.
+     Otherwise, a specific font is loaded from the set of fonts
      specified by the fontset given by the family attribute of the face.  */
   int fontset;
   
@@ -1184,10 +1207,10 @@ struct face
   unsigned hash;
 
   /* The charset for which this face was realized if it was realized
-     for use in multibyte text.  If fontset >= 0, this is
-     CHARSET_COMPOSITION.  A value of charset < 0 means the face was
-     realized for use in unibyte text where the idea of Emacs
-     charsets isn't applicable.  */
+     for use in multibyte text.  If fontset >= 0, this is the charset
+     of the first character of the composition sequence.  A value of
+     charset < 0 means the face was realized for use in unibyte text
+     where the idea of Emacs charsets isn't applicable.  */
   int charset;
 
   /* Non-zero if text in this face should be underlined, overlined,
@@ -1233,6 +1256,14 @@ struct face
 
 #define FACE_TTY_DEFAULT_COLOR ((unsigned long) -1)
 
+/* Color index indicating that face uses an unknown foreground color.  */
+
+#define FACE_TTY_DEFAULT_FG_COLOR ((unsigned long) -2)
+
+/* Color index indicating that face uses an unsigned background color.  */
+
+#define FACE_TTY_DEFAULT_BG_COLOR ((unsigned long) -3)
+
 /* Non-zero if FACE was realized for unibyte use.  */
 
 #define FACE_UNIBYTE_P(FACE) ((FACE)->charset < 0)
@@ -1245,9 +1276,14 @@ enum face_id
 {
   DEFAULT_FACE_ID,
   MODE_LINE_FACE_ID,
-  TOOLBAR_FACE_ID,
+  TOOL_BAR_FACE_ID,
   BITMAP_AREA_FACE_ID,
-  TOP_LINE_FACE_ID,
+  HEADER_LINE_FACE_ID,
+  SCROLL_BAR_FACE_ID,
+  BORDER_FACE_ID,
+  CURSOR_FACE_ID,
+  MOUSE_FACE_ID,
+  MENU_FACE_ID,
   BASIC_FACE_ID_SENTINEL
 };
 
@@ -1284,7 +1320,7 @@ struct face_cache
    face doesn't exist.  */
 
 #define FACE_FROM_ID(F, ID)                            \
-     (((ID) >= 0 && (ID) < FRAME_FACE_CACHE (F)->used) \
+     (((unsigned) (ID) < FRAME_FACE_CACHE (F)->used)   \
       ? FRAME_FACE_CACHE (F)->faces_by_id[ID]          \
       : NULL)
 
@@ -1376,6 +1412,9 @@ enum display_element_type
   /* A normal character.  */
   IT_CHARACTER,
 
+  /* A composition sequence.  */
+  IT_COMPOSITION,
+
   /* An image.  */
   IT_IMAGE,
 
@@ -1404,6 +1443,7 @@ enum prop_idx
   FACE_PROP_IDX,
   INVISIBLE_PROP_IDX,
   DISPLAY_PROP_IDX,
+  COMPOSITION_PROP_IDX,
 
   /* Not a property.  Used to indicate changes in overlays.  */
   OVERLAY_PROP_IDX,
@@ -1453,11 +1493,8 @@ struct it
   /* 1 means multibyte characters are enabled.  */
   unsigned multibyte_p : 1;
 
-  /* 1 means highlight trailing whitespace.  */
-  unsigned show_trailing_whitespace_p : 1;
-
   /* 1 means window has a mode line at its top.  */
-  unsigned top_line_p : 1;
+  unsigned header_line_p : 1;
 
   /* 1 means `string' is the value of a `display' property.
      Don't handle some `display' properties in these strings.  */
@@ -1484,8 +1521,11 @@ struct it
   int saved_face_id;
 
   /* Vector of glyphs for control character translation.  The pointer
-     dpvec is set to ctl_chars when a control character is translated.  */
-  Lisp_Object ctl_chars[4];
+     dpvec is set to ctl_chars when a control character is translated.
+     This vector is also used for incomplete multibyte character
+     translation (e.g \222\244).  Such a character is at most 3 bytes,
+     thus we need at most 12 bytes here.  */
+  Lisp_Object ctl_chars[12];
 
   /* Current buffer or string position of the iterator, including
      position in overlay strings etc.  */
@@ -1562,16 +1602,23 @@ struct it
   unsigned overlay_strings_at_end_processed_p : 1;
 
   /* The ID of the default face to use.  One of DEFAULT_FACE_ID,
-     MODE_LINE_FACE_ID, or TOOLBAR_FACE_ID, depending on what we
+     MODE_LINE_FACE_ID, or TOOL_BAR_FACE_ID, depending on what we
      are displaying.  */
   int base_face_id;
 
   /* If what == IT_CHARACTER, character and length in bytes.  This is
      a character from a buffer or string.  It may be different from
      the character displayed in case that
-     unibyte_display_via_language_environment is set.  */
+     unibyte_display_via_language_environment is set.
+
+     If what == IT_COMPOSITION, the first component of a composition
+     and length in bytes of the composition.  */
   int c, len;
 
+  /* If what == IT_COMPOSITION, identification number and length in
+     chars of a composition.  */
+  int cmp_id, cmp_len;
+
   /* The character to display, possibly translated to multibyte
      if unibyte_display_via_language_environment is set.  This
      is set after x_produce_glyphs has been called.  */
@@ -1638,9 +1685,10 @@ struct it
      produce_glyphs.  */
   int pixel_width;
 
-  /* Current and maximum line height information.  Result of
-     produce_glyphs.  */
+  /* Current, maximum logical, and maximum physical line height
+     information.  Result of produce_glyphs.  */
   int ascent, descent, max_ascent, max_descent;
+  int phys_ascent, phys_descent, max_phys_ascent, max_phys_descent;
 
   /* Current x pixel position within the display line.  This value
      does not include the width of continuation lines in front of the
@@ -1781,6 +1829,12 @@ struct redisplay_interface
      frame F.  */
   void (*get_glyph_overhangs) P_ ((struct glyph *glyph, struct frame *f,
                                   int *left, int *right));
+
+  /* Fix the display of AREA of ROW in window W for overlapping rows.
+     This function is called from redraw_overlapping_rows after
+     desired rows have been made current.  */
+  void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row,
+                                   enum glyph_row_area area));
 };
 
 /* The current interface for window-based redisplay.  */
@@ -1797,7 +1851,7 @@ extern int (* estimate_mode_line_height_hook) P_ ((struct frame *,
                                Images
  ***********************************************************************/
 
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
 
 /* Structure forward declarations.  */
 
@@ -1869,6 +1923,9 @@ struct image
   /* Reference to the type of the image.  */
   struct image_type *type;
 
+  /* 1 means that loading the image failed.  Don't try again.  */
+  unsigned load_failed_p;
+
   /* A place for image types to store additional data.  The member
      data.lisp_val is marked during GC, so it's safe to store Lisp data
      there.  Image types should free this data when their `free'
@@ -1930,74 +1987,74 @@ struct image_cache
 
 #define IMAGE_CACHE_BUCKETS_SIZE 1001
 
-#endif /* HAVE_X_WINDOWS */
+#endif /* HAVE_WINDOW_SYSTEM */
 
 
 \f
 /***********************************************************************
-                              Toolbars
+                              Tool-bars
  ***********************************************************************/
 
-/* Enumeration defining where to find toolbar item information in
-   toolbar items vectors stored with frames.  Each toolbar item
-   occupies TOOLBAR_ITEM_NSLOTS elements in such a vector.  */
+/* Enumeration defining where to find tool-bar item information in
+   tool-bar items vectors stored with frames.  Each tool-bar item
+   occupies TOOL_BAR_ITEM_NSLOTS elements in such a vector.  */
 
-enum toolbar_item_idx
+enum tool_bar_item_idx
 {
-  /* The key of the toolbar item.  Used to remove items when a binding
+  /* The key of the tool-bar item.  Used to remove items when a binding
      for `undefined' is found.  */
-  TOOLBAR_ITEM_KEY,
+  TOOL_BAR_ITEM_KEY,
 
   /* Non-nil if item is enabled.  */
-  TOOLBAR_ITEM_ENABLED_P,
+  TOOL_BAR_ITEM_ENABLED_P,
 
   /* Non-nil if item is selected (pressed).  */
-  TOOLBAR_ITEM_SELECTED_P,
+  TOOL_BAR_ITEM_SELECTED_P,
 
   /* Caption.  */
-  TOOLBAR_ITEM_CAPTION,
+  TOOL_BAR_ITEM_CAPTION,
 
   /* Image(s) to display.  This is either a single image specification
      or a vector of specifications.  */
-  TOOLBAR_ITEM_IMAGES,
+  TOOL_BAR_ITEM_IMAGES,
 
   /* The binding.  */
-  TOOLBAR_ITEM_BINDING,
+  TOOL_BAR_ITEM_BINDING,
 
   /* Button type.  One of nil, `:radio' or `:toggle'.  */
-  TOOLBAR_ITEM_TYPE,
+  TOOL_BAR_ITEM_TYPE,
 
   /* Help string.  */
-  TOOLBAR_ITEM_HELP,
+  TOOL_BAR_ITEM_HELP,
 
-  /* Sentinel = number of slots in toolbar_items occupied by one
-     toolbar item.  */
-  TOOLBAR_ITEM_NSLOTS
+  /* Sentinel = number of slots in tool_bar_items occupied by one
+     tool-bar item.  */
+  TOOL_BAR_ITEM_NSLOTS
 };
 
 
 /* An enumeration for the different images that can be specified
-   for a toolbar item.  */
+   for a tool-bar item.  */
 
-enum toolbar_item_image
+enum tool_bar_item_image
 {
-  TOOLBAR_IMAGE_ENABLED_SELECTED,
-  TOOLBAR_IMAGE_ENABLED_DESELECTED,
-  TOOLBAR_IMAGE_DISABLED_SELECTED,
-  TOOLBAR_IMAGE_DISABLED_DESELECTED
+  TOOL_BAR_IMAGE_ENABLED_SELECTED,
+  TOOL_BAR_IMAGE_ENABLED_DESELECTED,
+  TOOL_BAR_IMAGE_DISABLED_SELECTED,
+  TOOL_BAR_IMAGE_DISABLED_DESELECTED
 };
 
-/* Non-zero means raise toolbar buttons when the mouse moves over them.  */
+/* Non-zero means raise tool-bar buttons when the mouse moves over them.  */
 
-extern int auto_raise_toolbar_buttons_p;
+extern int auto_raise_tool_bar_buttons_p;
 
-/* Margin around toolbar buttons in pixels.  */
+/* Margin around tool-bar buttons in pixels.  */
 
-extern int toolbar_button_margin;
+extern int tool_bar_button_margin;
 
-/* Thickness of relief to draw around toolbar buttons.  */
+/* Thickness of relief to draw around tool-bar buttons.  */
 
-extern int toolbar_button_relief;
+extern int tool_bar_button_relief;
 
 
 \f
@@ -2007,6 +2064,8 @@ extern int toolbar_button_relief;
 
 /* Defined in xdisp.c */
 
+void resize_echo_area_axactly P_ ((void));
+int resize_mini_window P_ ((struct window *, int));
 int try_window P_ ((Lisp_Object, struct text_pos));
 void window_box P_ ((struct window *, int, int *, int *, int *, int *));
 int window_box_height P_ ((struct window *));
@@ -2033,9 +2092,11 @@ void move_it_vertically P_ ((struct it *, int));
 void move_it_by_lines P_ ((struct it *, int, int));
 int frame_mode_line_height P_ ((struct frame *));
 void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *));
-int toolbar_item_info P_ ((struct frame *, struct glyph *, int *));
-extern Lisp_Object Qtoolbar;
+int tool_bar_item_info P_ ((struct frame *, struct glyph *, int *));
+extern Lisp_Object Qtool_bar;
+extern Lisp_Object Vshow_trailing_whitespace;
 extern int redisplaying_p;
+extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));
 
 /* Defined in sysdep.c */
 
@@ -2046,9 +2107,16 @@ int tabs_safe_p P_ ((void));
 void init_baud_rate P_ ((void));
 void init_sigio P_ ((int));
 
-/* Defined in xface.c */
+/* Defined in xfaces.c */
+
+#ifdef USE_X_TOOLKIT
+void x_set_menu_resources_from_menu_face P_ ((struct frame *, Widget));
+#endif
 
+void update_face_from_frame_parameter P_ ((struct frame *, Lisp_Object,
+                                          Lisp_Object));
 char *x_charset_registry P_ ((int));
+Lisp_Object tty_color_name P_ ((struct frame *, int));
 void clear_face_cache P_ ((int));
 unsigned long load_color P_ ((struct frame *, struct face *, Lisp_Object,
                              enum lface_attribute_index));
@@ -2077,8 +2145,16 @@ extern Lisp_Object Qforeground_color, Qbackground_color;
 
 /* Defined in xfns.c  */
 
-#ifdef HAVE_X_WINDOWS 
+#ifdef HAVE_X_WINDOWS
+void gamma_correct P_ ((struct frame *, XColor *));
+#endif
+#ifdef WINDOWSNT
+void gamma_correct P_ ((struct frame *, COLORREF *));
+#endif
 
+#ifdef HAVE_WINDOW_SYSTEM
+
+void x_kill_gs_process P_ ((Pixmap, struct frame *));
 int x_screen_planes P_ ((struct frame *));
 void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
 struct image_cache *make_image_cache P_ ((void));
@@ -2098,15 +2174,16 @@ EXFUN (Fx_hide_busy_cursor, 1);
 extern int inhibit_busy_cursor;
 extern int display_busy_cursor_p;
 
-#endif /* HAVE_X_WINDOWS */
+#endif /* HAVE_WINDOW_SYSTEM */
 
 
 /* Defined in xmenu.c  */
 
 int popup_activated P_ ((void));
 
-/* Defined in dispnw.c  */
+/* Defined in dispnew.c  */
 
+int estimate_mode_line_height P_ ((struct frame *, enum face_id));
 Lisp_Object mode_line_string P_ ((struct window *, int, int, int, int *));
 extern void redraw_frame P_ ((struct frame *));
 extern void redraw_garbaged_frames P_ ((void));
@@ -2117,8 +2194,6 @@ extern int direct_output_for_insert P_ ((int));
 extern int direct_output_forward_char P_ ((int));
 extern int update_frame P_ ((struct frame *, int, int));
 extern int scrolling P_ ((struct frame *));
-extern void do_pending_window_change P_ ((void));
-extern void change_frame_size P_ ((struct frame *, int, int, int, int));
 extern void bitch_at_user P_ ((void));
 void adjust_glyphs P_ ((struct frame *));
 void free_glyphs P_ ((struct frame *));
@@ -2151,8 +2226,8 @@ int update_frame P_ ((struct frame *, int, int));
 void update_single_window P_ ((struct window *, int));
 int scrolling P_ ((struct frame *));
 int buffer_posn_from_coords P_ ((struct window *, int *, int *));
-void do_pending_window_change P_ ((void));
-void change_frame_size P_ ((struct frame *, int, int, int, int));
+void do_pending_window_change P_ ((int));
+void change_frame_size P_ ((struct frame *, int, int, int, int, int));
 void bitch_at_user P_ ((void));
 Lisp_Object sit_for P_ ((int, int, int, int, int));
 void init_display P_ ((void));