(minibuf_selected_window): Renamed from Vminibuf_selected_window.
[bpt/emacs.git] / src / dispextern.h
index f737b54..7777e56 100644 (file)
@@ -295,7 +295,7 @@ struct glyph
   /* Type of font used to display the character glyph. Used to
      determine which set of functions to use to obtain font metrics
      for the glyph. Value should be an enumerator of the type
-     w32_char_font_type. */
+     w32_char_font_type.  */
   unsigned w32_font_type : 2;
 #endif
 
@@ -375,7 +375,7 @@ struct 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. */
+   multibyte character.  */
      
 #define GLYPH_FROM_CHAR_GLYPH(GLYPH)                           \
   ((GLYPH).u.ch < 256                                          \
@@ -575,7 +575,7 @@ struct glyph_row
      to any text; it is some buffer position if the row corresponds to
      an empty display line that displays a line end.  This is what old
      redisplay used to do.  (Except in code for terminal frames, this
-     kludge is no longer use, I believe. --gerd).
+     kludge is no longer used, I believe. --gerd).
 
      See also start, end, displays_text_p and ends_at_zv_p for cleaner
      ways to do it.  The special meaning of positions 0 and -1 will be
@@ -667,12 +667,12 @@ struct glyph_row
      of lbearing or rbearing.  */
   unsigned contains_overlapping_glyphs_p : 1;
 
-  /* 1 means this row is a wide as the window it is displayed in, including
-     scroll bars, bitmap areas, and internal borders.  This also
+  /* 1 means this row is as wide as the window it is displayed in, including
+     scroll bars, fringes, and internal borders.  This also
      implies that the row doesn't have marginal areas.  */
   unsigned full_width_p : 1;
 
-  /* Non-zero means row is a mode or top-line.  */
+  /* Non-zero means row is a mode or header-line.  */
   unsigned mode_line_p : 1;
 
   /* 1 in a current row means this row is overlapped by another row.  */
@@ -685,7 +685,7 @@ struct glyph_row
   
   /* 1 means this line starts in the middle of a character consisting
      of more than one glyph.  Some glyphs have been put in the
-     previoius row, the rest are put in this row.  */
+     previous row, the rest are put in this row.  */
   unsigned starts_in_middle_of_char_p : 1;
 
   /* 1 in a current row means this row overlaps others.  */
@@ -719,7 +719,7 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
 #define MATRIX_MODE_LINE_ROW(MATRIX) \
      ((MATRIX)->rows + (MATRIX)->nrows - 1)
 
-/* Return a pointer to the row reserved for the top line in MATRIX.
+/* Return a pointer to the row reserved for the header line in MATRIX.
    This is always the first row in MATRIX because that's the only
    way that works in frame-based redisplay.  */
 
@@ -748,7 +748,7 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
 #define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->start.pos.charpos)
 #define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->start.pos.bytepos)
 
-/* Return character/ byte position at which ROW ends.  */
+/* Return the character/ byte position at which ROW ends.  */
      
 #define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->end.pos.charpos)
 #define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->end.pos.bytepos)
@@ -914,7 +914,7 @@ extern struct glyph_row scratch_glyph_row;
       ? MATRIX_MODE_LINE_ROW (MATRIX)->height  \
       : 0)
 
-/* Return the height of the top line in glyph matrix MATRIX, or zero
+/* Return the height of the header line in glyph matrix MATRIX, or zero
    if not known.  This macro is called under circumstances where
    MATRIX might not have been allocated yet.  */
 
@@ -923,6 +923,32 @@ extern struct glyph_row scratch_glyph_row;
       ? MATRIX_HEADER_LINE_ROW (MATRIX)->height        \
       : 0)
 
+/* Return the desired face id for the mode line of a window, depending
+   on whether the window is selected or not, or if the window is the
+   scrolling window for the currently active minibuffer window.
+
+   Due to the way display_mode_lines manipulates with the contents of
+   selected_window, this macro needs three arguments: SELW which is
+   compared against the current value of selected_window, MBW which is
+   compared against minibuf_window (if SELW doesn't match), and SCRW
+   which is compared against minibuf_selected_window (if MBW matches).  */
+
+#define CURRENT_MODE_LINE_FACE_ID_3(SELW, MBW, SCRW)           \
+     ((!mode_line_in_non_selected_windows                      \
+       || (SELW) == XWINDOW (selected_window)                  \
+       || (minibuf_level > 0                                   \
+           && !NILP (minibuf_selected_window)                  \
+           && (MBW) == XWINDOW (minibuf_window)                        \
+           && (SCRW) == XWINDOW (minibuf_selected_window)))    \
+      ? MODE_LINE_FACE_ID                                      \
+      : MODE_LINE_INACTIVE_FACE_ID)
+
+
+/* Return the desired face id for the mode line of window W.  */
+
+#define CURRENT_MODE_LINE_FACE_ID(W)           \
+       (CURRENT_MODE_LINE_FACE_ID_3((W), XWINDOW (selected_window), (W)))
+
 /* Return the current height of the mode line of window W.  If not
    known from current_mode_line_height, look at W's current glyph
    matrix, or return a default based on the height of the font of the
@@ -934,9 +960,9 @@ extern struct glyph_row scratch_glyph_row;
       : (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix)         \
         ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix)        \
         : estimate_mode_line_height (XFRAME ((W)->frame),      \
-                                     MODE_LINE_FACE_ID)))
+                                     CURRENT_MODE_LINE_FACE_ID (W))))
 
-/* Return the current height of the top line of window W.  If not
+/* Return the current height of the header line of window W.  If not
    known from current_header_line_height, look at W's current glyph
    matrix, or return an estimation based on the height of the font of
    the face `header-line'.  */
@@ -954,7 +980,7 @@ extern struct glyph_row scratch_glyph_row;
 #define DESIRED_MODE_LINE_HEIGHT(W) \
      MATRIX_MODE_LINE_HEIGHT ((W)->desired_matrix)
 
-/* Return the height of the desired top line of window W.  */
+/* Return the height of the desired header line of window W.  */
 
 #define DESIRED_HEADER_LINE_HEIGHT(W) \
      MATRIX_HEADER_LINE_HEIGHT ((W)->desired_matrix)
@@ -968,12 +994,12 @@ extern struct glyph_row scratch_glyph_row;
 /* Width of display region of window W.  For terminal frames, this
    equals the width of W since there are no vertical scroll bars.  For
    window system frames, the value has to be corrected by the pixel
-   width of vertical scroll bars, and bitmap areas.  */
+   width of vertical scroll bars, and fringes.  */
 
 #define WINDOW_DISPLAY_PIXEL_WIDTH(W)                                  \
      (((XFASTINT ((W)->width)                                          \
         - FRAME_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME ((W))))         \
-       - FRAME_FLAGS_AREA_COLS (XFRAME (WINDOW_FRAME ((W)))))          \
+       - FRAME_FRINGE_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.  */
@@ -990,7 +1016,7 @@ extern struct glyph_row scratch_glyph_row;
       ? CURRENT_MODE_LINE_HEIGHT (W)           \
       : 0)
 
-/* Height in pixels of the top line.  Zero if W doesn't have a top
+/* Height in pixels of the header line.  Zero if W doesn't have a header
    line.  */
      
 #define WINDOW_DISPLAY_HEADER_LINE_HEIGHT(W)   \
@@ -1004,7 +1030,7 @@ extern struct glyph_row scratch_glyph_row;
      (WINDOW_DISPLAY_PIXEL_HEIGHT ((W))                \
       - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)))
 
-/* Pixel height of window W without mode and top line.  */
+/* Pixel height of window W without mode and header line.  */
      
 #define WINDOW_DISPLAY_TEXT_HEIGHT(W)          \
      (WINDOW_DISPLAY_PIXEL_HEIGHT ((W))                \
@@ -1017,7 +1043,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_LEFT_FLAGS_AREA_WIDTH (XFRAME (WINDOW_FRAME ((W)))))
+      + FRAME_LEFT_FRINGE_WIDTH (XFRAME (WINDOW_FRAME ((W)))))
 
 /* Right edge of window W in pixels, relative to its frame.  */
      
@@ -1053,7 +1079,7 @@ extern struct glyph_row scratch_glyph_row;
 #define FRAME_TO_WINDOW_PIXEL_X(W, X) \
      ((X) - WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
 
-/* Convert frame relative pixel X to window relative pixel Y.  */
+/* Convert frame relative pixel Y to window relative pixel Y.  */
      
 #define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \
      ((Y) - WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
@@ -1109,23 +1135,25 @@ extern struct glyph_row scratch_glyph_row;
         ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W))   \
         : WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W))))
      
-/* Value is non-zero if window W has a mode line.  */
+/* Value is non-zero if window W wants a mode line.  */
 
 #define WINDOW_WANTS_MODELINE_P(W)                                     \
-     (!MINI_WINDOW_P (W)                                               \
+     (!MINI_WINDOW_P ((W))                                             \
       && !(W)->pseudo_window_p                                         \
-      && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W)))            \
+      && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W))))          \
       && BUFFERP ((W)->buffer)                                         \
-      && !NILP (XBUFFER ((W)->buffer)->mode_line_format))
+      && !NILP (XBUFFER ((W)->buffer)->mode_line_format)               \
+      && XFASTINT ((W)->height) > 1)
 
-/* Value is non-zero if window W wants a top line.  */
+/* Value is non-zero if window W wants a header line.  */
 
 #define WINDOW_WANTS_HEADER_LINE_P(W)                                  \
-     (!MINI_WINDOW_P (W)                                               \
+     (!MINI_WINDOW_P ((W))                                             \
       && !(W)->pseudo_window_p                                         \
-      && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W)))            \
+      && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W))))          \
       && BUFFERP ((W)->buffer)                                         \
-      && !NILP (XBUFFER ((W)->buffer)->header_line_format))
+      && !NILP (XBUFFER ((W)->buffer)->header_line_format)             \
+      && XFASTINT ((W)->height) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format))
 
 \f     
 /***********************************************************************
@@ -1190,8 +1218,8 @@ struct face
 
 #ifdef HAVE_WINDOW_SYSTEM
   
-  /* If non-zero, a GC we can use without modification to draw 
-     characters in this face.  */
+  /* If non-zero, this is a GC that we can use without modification for
+     drawing the characters in this face.  */
   GC gc;
   
   /* Font used for this face, or null if the font could not be loaded
@@ -1249,7 +1277,7 @@ struct face
   /* Non-zero means characters in this face have a box that thickness
      around them.  If it is negative, the absolute value indicates the
      thickness, and the horizontal lines of box (top and bottom) are
-     drawn inside of characters glyph area.  The vartical lines of box
+     drawn inside of characters glyph area.  The vertical lines of box
      (left and right) are drawn as the same way as the case that this
      value is positive.  */
   int box_line_width;
@@ -1292,12 +1320,12 @@ struct face
   unsigned background_defaulted_p : 1;
 
   /* 1 means that either no color is specified for underlining or that
-     the the specified color couldn't be loaded.  Use the foreground
+     the specified color couldn't be loaded.  Use the foreground
      color when drawing in that case. */
   unsigned underline_defaulted_p : 1; 
 
   /* 1 means that either no color is specified for the corresponding
-     attribute or that the the specified color couldn't be loaded.
+     attribute or that the specified color couldn't be loaded.
      Use the foreground color when drawing in that case. */
   unsigned overline_color_defaulted_p : 1;
   unsigned strike_through_color_defaulted_p : 1;
@@ -1313,6 +1341,11 @@ struct face
   unsigned tty_reverse_p : 1;
   unsigned tty_blinking_p : 1;
 
+  /* 1 means that colors of this face may not be freed because they
+     have been copied bitwise from a base face (see
+     realize_x_face).  */
+  unsigned colors_copied_bitwise_p : 1;
+
   /* Next and previous face in hash collision list of face cache.  */
   struct face *next, *prev;
 
@@ -1330,7 +1363,7 @@ struct face
 
 #define FACE_TTY_DEFAULT_FG_COLOR ((unsigned long) -2)
 
-/* Color index indicating that face uses an unsigned background color.  */
+/* Color index indicating that face uses an unknown background color.  */
 
 #define FACE_TTY_DEFAULT_BG_COLOR ((unsigned long) -3)
 
@@ -1346,8 +1379,9 @@ enum face_id
 {
   DEFAULT_FACE_ID,
   MODE_LINE_FACE_ID,
+  MODE_LINE_INACTIVE_FACE_ID,
   TOOL_BAR_FACE_ID,
-  BITMAP_AREA_FACE_ID,
+  FRINGE_FACE_ID,
   HEADER_LINE_FACE_ID,
   SCROLL_BAR_FACE_ID,
   BORDER_FACE_ID,
@@ -1583,7 +1617,7 @@ struct it
   Lisp_Object *dpvec, *dpend;
 
   /* Length in bytes of the char that filled dpvec.  A value of zero
-     means that no character such character is involved.  */
+     means that no such character is involved.  */
   int dpvec_char_len;
 
   /* Face id of the iterator saved in case a glyph from dpvec contains
@@ -1746,7 +1780,7 @@ struct it
   int last_visible_y;
 
   /* Additional space in pixels between lines (for window systems
-     only.).  */
+     only.)  */
   int extra_line_spacing;
 
   /* If non-null, glyphs are produced in glyph_row with each call to
@@ -1896,7 +1930,7 @@ struct redisplay_interface
      redisplay.  CURSOR_ON_P non-zero means switch cursor on.
      MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W
      that contained glyphs in mouse-face were overwritten, so we
-     have to update the mouse hightlight.  */
+     have to update the mouse highlight.  */
   void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p,
                                      int mouse_face_overwritten_p));
   
@@ -1944,7 +1978,7 @@ extern int (* estimate_mode_line_height_hook) P_ ((struct frame *,
 struct image;
 
 
-/* Each image format (JPEG, IIFF, ...) supported is described by
+/* Each image format (JPEG, TIFF, ...) supported is described by
    a structure of the type below.  */
 
 struct image_type
@@ -1985,6 +2019,22 @@ struct image
   unsigned long *colors;
   int ncolors;
 
+  /* A single `background color' for this image, for the use of anyone that
+     cares about such a thing.  Only valid if the `background_valid' field
+     is true.  This should generally be accessed by calling the accessor
+     macro `IMAGE_BACKGROUND', which will heuristically calculate a value
+     if necessary.  */
+  unsigned long background;
+
+  /* True if this image has a `transparent' background -- that is, is
+     uses an image mask.  The accessor macro for this is
+     `IMAGE_BACKGROUND_TRANSPARENT'.  */
+  unsigned background_transparent : 1;
+
+  /* True if the `background' and `background_transparent' fields are
+     valid, respectively. */
+  unsigned background_valid : 1, background_transparent_valid : 1;
+
   /* Width and height of the image.  */
   int width, height;
 
@@ -1994,7 +2044,7 @@ struct image
 #define DEFAULT_IMAGE_HEIGHT 30
 
   /* Percent of image height used as ascent.  A value of
-     CENTERED_IMAGE_ASCENT means draw center the image centered on the
+     CENTERED_IMAGE_ASCENT means draw the image centered on the
      line.  */
   int ascent;
 #define DEFAULT_IMAGE_ASCENT 50
@@ -2195,6 +2245,7 @@ void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *));
 int tool_bar_item_info P_ ((struct frame *, struct glyph *, int *));
 extern Lisp_Object Qtool_bar;
 extern Lisp_Object Vshow_trailing_whitespace;
+extern int mode_line_in_non_selected_windows;
 extern int redisplaying_p;
 extern Lisp_Object Vimage_types;
 extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));
@@ -2268,6 +2319,14 @@ void forall_images_in_image_cache P_ ((struct frame *,
 int valid_image_p P_ ((Lisp_Object));
 void prepare_image_for_display P_ ((struct frame *, struct image *));
 int lookup_image P_ ((struct frame *, Lisp_Object));
+
+#ifdef HAVE_X_WINDOWS
+unsigned long image_background P_ ((struct image *, struct frame *,
+                                   XImage *ximg));
+int image_background_transparent P_ ((struct image *, struct frame *,
+                                     XImage *mask));
+#endif /* HAVE_X_WINDOWS */
+
 extern Lisp_Object tip_frame;
 extern Window tip_window;
 EXFUN (Fx_show_tip, 6);
@@ -2276,6 +2335,24 @@ extern void start_hourglass P_ ((void));
 extern void cancel_hourglass P_ ((void));
 extern int display_hourglass_p;
 
+/* Returns the background color of IMG, calculating one heuristically if
+   necessary.  If non-zero, XIMG is an existing XImage object to use for
+   the heuristic.  */
+
+#define IMAGE_BACKGROUND(img, f, ximg)                                       \
+   ((img)->background_valid                                                  \
+    ? (img)->background                                                              \
+    : image_background (img, f, ximg))
+
+/* Returns true if IMG has a `transparent' background, using heuristics
+   to decide if necessary.  If non-zero, MASK is an existing XImage
+   object to use for the heuristic.  */
+
+#define IMAGE_BACKGROUND_TRANSPARENT(img, f, mask)                           \
+   ((img)->background_transparent_valid                                              \
+    ? (img)->background_transparent                                          \
+    : image_background_transparent (img, f, mask))
+
 #endif /* HAVE_WINDOW_SYSTEM */
 
 
@@ -2360,6 +2437,8 @@ extern void ins_del_lines P_ ((int, int));
 extern int string_cost P_ ((char *));
 extern int per_line_cost P_ ((char *));
 extern void calculate_costs P_ ((struct frame *));
+extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
+extern void tty_setup_colors P_ ((int));
 extern void term_init P_ ((char *));
 extern void fatal P_ ((/* char *, ... */));
 void cursor_to P_ ((int, int));