]> code.delx.au - gnu-emacs/blobdiff - src/dispextern.h
Replace eldoc-documentation-function with a hook
[gnu-emacs] / src / dispextern.h
index 413947991ec689eb42c66024cea965d3bcc844bb..1325ff9da2811eef8d09e0db642e8ed7b8b2a67d 100644 (file)
@@ -1,13 +1,13 @@
 /* Interface definitions for display code.
 
-Copyright (C) 1985, 1993-1994, 1997-2015 Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1994, 1997-2016 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -82,6 +82,7 @@ typedef XImagePtr XImagePtr_or_DC;
 
 #ifdef HAVE_WINDOW_SYSTEM
 # include <time.h>
+# include "fontset.h"
 #endif
 
 #ifndef HAVE_WINDOW_SYSTEM
@@ -347,7 +348,10 @@ enum glyph_type
   IMAGE_GLYPH,
 
   /* Glyph is a space of fractional width and/or height.  */
-  STRETCH_GLYPH
+  STRETCH_GLYPH,
+
+  /* Glyph is an external widget drawn by the GUI toolkit.  */
+  XWIDGET_GLYPH
 };
 
 
@@ -499,6 +503,11 @@ struct glyph
     /* Image ID for image glyphs (type == IMAGE_GLYPH).  */
     int img_id;
 
+#ifdef HAVE_XWIDGETS
+    /* Xwidget reference (type == XWIDGET_GLYPH).  */
+    struct xwidget *xwidget;
+#endif
+
     /* Sub-structure for type == STRETCH_GLYPH.  */
     struct
     {
@@ -1306,9 +1315,6 @@ struct glyph_string
   /* True means the background of this string has been drawn.  */
   bool_bf background_filled_p : 1;
 
-  /* True means glyph string must be drawn with 16-bit functions.  */
-  bool_bf two_byte_p : 1;
-
   /* True means that the original font determined for drawing this glyph
      string could not be loaded.  The member `font' has been set to
      the frame's default font in this case.  */
@@ -1353,6 +1359,9 @@ struct glyph_string
   /* Image, if any.  */
   struct image *img;
 
+  /* Xwidget.  */
+  struct xwidget *xwidget;
+
   /* Slice */
   struct glyph_slice slice;
 
@@ -1529,6 +1538,12 @@ struct glyph_string
       + (FRAME_LINE_HEIGHT ((F)) > FONT_HEIGHT ((FONT)))) / 2  \
    - (FONT_DESCENT (FRAME_FONT (F)) - FRAME_BASELINE_OFFSET (F)))
 
+/* A heuristic test for fonts that claim they need a preposterously
+   large vertical space.  The heuristics is in the factor of 3.  We
+   ignore the ascent and descent values reported by such fonts, and
+   instead go by the values reported for individual glyphs.  */
+#define FONT_TOO_HIGH(ft)  ((ft)->ascent + (ft)->descent > 3*(ft)->pixel_size)
+
 \f
 /***********************************************************************
                                Faces
@@ -1797,34 +1812,46 @@ struct face_cache
   bool_bf menu_face_changed_p : 1;
 };
 
+/* Return a non-null pointer to the cached face with ID on frame F.  */
+
+#define FACE_FROM_ID(F, ID)                                    \
+  (eassert (UNSIGNED_CMP (ID, <, FRAME_FACE_CACHE (F)->used)), \
+   FRAME_FACE_CACHE (F)->faces_by_id[ID])
+
 /* Return a pointer to the face with ID on frame F, or null if such a
    face doesn't exist.  */
 
-#define FACE_FROM_ID(F, ID)                            \
-     (UNSIGNED_CMP (ID, <, FRAME_FACE_CACHE (F)->used) \
-      ? FRAME_FACE_CACHE (F)->faces_by_id[ID]          \
-      : NULL)
+#define FACE_FROM_ID_OR_NULL(F, ID)                    \
+  (UNSIGNED_CMP (ID, <, FRAME_FACE_CACHE (F)->used)    \
+   ? FRAME_FACE_CACHE (F)->faces_by_id[ID]             \
+   : NULL)
 
+/* True if FACE is suitable for displaying ASCII characters.  */
+INLINE bool
+FACE_SUITABLE_FOR_ASCII_CHAR_P (struct face *face)
+{
 #ifdef HAVE_WINDOW_SYSTEM
-
-/* Non-zero if FACE is suitable for displaying character CHAR.  */
-
-#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR)     \
-  ((FACE) == (FACE)->ascii_face)
+  return face == face->ascii_face;
+#else
+  return true;
+#endif
+}
 
 /* Return the id of the realized face on frame F that is like the face
-   with id ID but is suitable for displaying character CHAR.
-   This macro is only meaningful for multibyte character CHAR.  */
-
-#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT)      \
-  face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT))
-
-#else /* not HAVE_WINDOW_SYSTEM */
-
-#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) true
-#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) ((FACE)->id)
-
-#endif /* not HAVE_WINDOW_SYSTEM */
+   FACE, but is suitable for displaying character CHARACTER at buffer or
+   string position POS.  OBJECT is the string object, or nil for
+   buffer.  This macro is only meaningful for multibyte character
+   CHAR.  */
+INLINE int
+FACE_FOR_CHAR (struct frame *f, struct face *face, int character,
+              ptrdiff_t pos, Lisp_Object object)
+{
+#ifdef HAVE_WINDOW_SYSTEM
+  return face_for_char (f, face, character, pos, object);
+#else
+  return face->id;
+#endif
+}
 
 /* Return true if G contains a valid character code.  */
 INLINE bool
@@ -1957,8 +1984,8 @@ struct bidi_it {
                                   resolving weak and neutral types */
   bidi_type_t type_after_wn;   /* bidi type after overrides and Wn */
   bidi_type_t orig_type;       /* original bidi type, as found in the buffer */
-  char resolved_level;         /* final resolved level of this character */
-  char isolate_level;          /* count of isolate initiators unmatched by PDI */
+  signed char resolved_level;  /* final resolved level of this character */
+  signed char isolate_level;   /* count of isolate initiators unmatched by PDI */
   ptrdiff_t invalid_levels;    /* how many PDFs to ignore */
   ptrdiff_t invalid_isolates;  /* how many PDIs to ignore */
   struct bidi_saved_info prev; /* info about previous character */
@@ -2096,7 +2123,10 @@ enum display_element_type
   IT_TRUNCATION,
 
   /* Continuation glyphs.  See the comment for IT_TRUNCATION.  */
-  IT_CONTINUATION
+  IT_CONTINUATION,
+
+  /* Xwidget.  */
+  IT_XWIDGET
 };
 
 
@@ -2160,6 +2190,7 @@ enum it_method {
   GET_FROM_C_STRING,
   GET_FROM_IMAGE,
   GET_FROM_STRETCH,
+  GET_FROM_XWIDGET,
   NUM_IT_METHODS
 };
 
@@ -2373,14 +2404,14 @@ struct it
        struct it_slice slice;
        ptrdiff_t image_id;
       } image;
-      /* method == GET_FROM_COMPOSITION */
-      struct {
-       Lisp_Object object;
-      } comp;
       /* method == GET_FROM_STRETCH */
       struct {
        Lisp_Object object;
       } stretch;
+      /* method == GET_FROM_XWIDGET */
+      struct {
+       Lisp_Object object;
+      } xwidget;
     } u;
 
     /* Current text and display positions.  */
@@ -2505,6 +2536,9 @@ struct it
   /* If what == IT_IMAGE, the id of the image to display.  */
   ptrdiff_t image_id;
 
+  /* If what == IT_XWIDGET.  */
+  struct xwidget *xwidget;
+
   /* Values from `slice' property.  */
   struct it_slice slice;
 
@@ -2942,6 +2976,10 @@ struct image
   /* Pixmaps of the image.  */
   Pixmap pixmap, mask;
 
+#ifdef USE_CAIRO
+  void *cr_data;
+  void *cr_data2;
+#endif
 #ifdef HAVE_X_WINDOWS
   /* X images of the image, corresponding to the above Pixmaps.
      Non-NULL means it and its Pixmap counterpart may be out of sync
@@ -3055,13 +3093,19 @@ struct image_cache
 };
 
 
+/* A non-null pointer to the image with id ID on frame F.  */
+
+#define IMAGE_FROM_ID(F, ID)                                   \
+  (eassert (UNSIGNED_CMP (ID, <, FRAME_IMAGE_CACHE (F)->used)),        \
+   FRAME_IMAGE_CACHE (F)->images[ID])
+
 /* Value is a pointer to the image with id ID on frame F, or null if
    no image with that id exists.  */
 
-#define IMAGE_FROM_ID(F, ID)                                   \
-     (((ID) >= 0 && (ID) < (FRAME_IMAGE_CACHE (F)->used))      \
-      ? FRAME_IMAGE_CACHE (F)->images[ID]                      \
-      : NULL)
+#define IMAGE_OPT_FROM_ID(F, ID)                               \
+  (UNSIGNED_CMP (ID, <, FRAME_IMAGE_CACHE (F)->used)           \
+   ? FRAME_IMAGE_CACHE (F)->images[ID]                         \
+   : NULL)
 
 /* Size of bucket vector of image caches.  Should be prime.  */
 
@@ -3185,9 +3229,9 @@ struct glyph_row *row_containing_pos (struct window *, ptrdiff_t,
                                       struct glyph_row *, int);
 int line_bottom_y (struct it *);
 int default_line_pixel_height (struct window *);
-int display_prop_intangible_p (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t);
+bool display_prop_intangible_p (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t);
 void resize_echo_area_exactly (void);
-int resize_mini_window (struct window *, int);
+bool resize_mini_window (struct window *, bool);
 void set_vertical_scroll_bar (struct window *);
 void set_horizontal_scroll_bar (struct window *);
 int try_window (Lisp_Object, struct text_pos, int);
@@ -3202,10 +3246,10 @@ int window_box_right (struct window *, enum glyph_row_area);
 int estimate_mode_line_height (struct frame *, enum face_id);
 int move_it_to (struct it *, ptrdiff_t, int, int, int, int);
 void pixel_to_glyph_coords (struct frame *, int, int, int *, int *,
-                            NativeRectangle *, int);
+                            NativeRectangle *, bool);
 void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *);
 
-void mark_window_display_accurate (Lisp_Object, int);
+void mark_window_display_accurate (Lisp_Object, bool);
 void redisplay_preserve_echo_area (int);
 void init_iterator (struct it *, struct window *, ptrdiff_t,
                     ptrdiff_t, struct glyph_row *, enum face_id);
@@ -3231,11 +3275,14 @@ extern void reseat_at_previous_visible_line_start (struct it *);
 extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
 extern ptrdiff_t compute_display_string_pos (struct text_pos *,
                                             struct bidi_string_data *,
-                                            struct window *, int, int *);
+                                            struct window *, bool, int *);
 extern ptrdiff_t compute_display_string_end (ptrdiff_t,
                                             struct bidi_string_data *);
 extern void produce_stretch_glyph (struct it *);
 extern int merge_glyphless_glyph_face (struct it *);
+extern void forget_escape_and_glyphless_faces (void);
+
+extern void get_font_ascent_descent (struct font *, int *, int *);
 
 #ifdef HAVE_WINDOW_SYSTEM
 
@@ -3274,21 +3321,20 @@ extern void get_glyph_string_clip_rect (struct glyph_string *,
 extern Lisp_Object find_hot_spot (Lisp_Object, int, int);
 
 extern void handle_tool_bar_click (struct frame *,
-                                   int, int, int, int);
+                                   int, int, bool, int);
 
 extern void expose_frame (struct frame *, int, int, int, int);
-extern int x_intersect_rectangles (XRectangle *, XRectangle *,
-                                   XRectangle *);
+extern bool x_intersect_rectangles (XRectangle *, XRectangle *, XRectangle *);
 #endif /* HAVE_WINDOW_SYSTEM */
 
 extern void note_mouse_highlight (struct frame *, int, int);
 extern void x_clear_window_mouse_face (struct window *);
 extern void cancel_mouse_face (struct frame *);
-extern int clear_mouse_face (Mouse_HLInfo *);
+extern bool clear_mouse_face (Mouse_HLInfo *);
 extern bool cursor_in_mouse_face_p (struct window *w);
 extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *,
                                          int, int, enum draw_glyphs_face);
-extern void display_tty_menu_item (const char *, int, int, int, int, int);
+extern void display_tty_menu_item (const char *, int, int, int, int, bool);
 
 /* Flags passed to try_window.  */
 #define TRY_WINDOW_CHECK_MARGINS       (1 << 0)
@@ -3304,6 +3350,9 @@ bool update_window_fringes (struct window *, bool);
 void w32_init_fringe (struct redisplay_interface *);
 void w32_reset_fringes (void);
 #endif
+#ifdef USE_CAIRO
+void x_cr_init_fringe (struct redisplay_interface *);
+#endif
 
 extern unsigned row_hash (struct glyph_row *);
 
@@ -3360,7 +3409,6 @@ void unrequest_sigio (void);
 bool tabs_safe_p (int);
 void init_baud_rate (int);
 void init_sigio (int);
-void ignore_sigio (void);
 
 /* Defined in xfaces.c.  */