*** empty log message ***
[bpt/emacs.git] / src / dispextern.h
index 9e717a1..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"
@@ -204,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,
 
@@ -254,51 +260,38 @@ struct glyph
      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;
     
@@ -318,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)
 
@@ -341,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
 
 
 
@@ -1172,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;
   
@@ -1203,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,
@@ -1252,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)
@@ -1271,6 +1283,7 @@ enum face_id
   BORDER_FACE_ID,
   CURSOR_FACE_ID,
   MOUSE_FACE_ID,
+  MENU_FACE_ID,
   BASIC_FACE_ID_SENTINEL
 };
 
@@ -1307,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)
 
@@ -1399,6 +1412,9 @@ enum display_element_type
   /* A normal character.  */
   IT_CHARACTER,
 
+  /* A composition sequence.  */
+  IT_COMPOSITION,
+
   /* An image.  */
   IT_IMAGE,
 
@@ -1427,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,
@@ -1592,9 +1609,16 @@ struct it
   /* 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.  */
@@ -1827,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.  */
 
@@ -1899,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'
@@ -1960,7 +1987,7 @@ struct image_cache
 
 #define IMAGE_CACHE_BUCKETS_SIZE 1001
 
-#endif /* HAVE_X_WINDOWS */
+#endif /* HAVE_WINDOW_SYSTEM */
 
 
 \f
@@ -2069,6 +2096,7 @@ 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 */
 
@@ -2079,11 +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));
@@ -2112,9 +2145,15 @@ 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));
@@ -2135,7 +2174,7 @@ 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  */