/[emacs]/emacs/src/dispextern.h
ViewVC logotype

Diff of /emacs/src/dispextern.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.136 by miles, Tue May 28 01:32:36 2002 UTC revision 1.136.2.1 by miles, Fri Apr 4 06:20:57 2003 UTC
# Line 1  Line 1 
1  /* Interface definitions for display code.  /* Interface definitions for display code.
2     Copyright (C) 1985, 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002     Copyright (C) 1985, 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3       Free Software Foundation, Inc.       Free Software Foundation, Inc.
4    
5  This file is part of GNU Emacs.  This file is part of GNU Emacs.
# Line 25  Boston, MA 02111-1307, USA.  */ Line 25  Boston, MA 02111-1307, USA.  */
25  #define DISPEXTERN_H_INCLUDED  #define DISPEXTERN_H_INCLUDED
26    
27  #ifdef HAVE_X_WINDOWS  #ifdef HAVE_X_WINDOWS
28    
29  #include <X11/Xlib.h>  #include <X11/Xlib.h>
30  #ifdef USE_X_TOOLKIT  #ifdef USE_X_TOOLKIT
31  #include <X11/Intrinsic.h>  #include <X11/Intrinsic.h>
32  #endif /* USE_X_TOOLKIT */  #endif /* USE_X_TOOLKIT */
33    
34    #else /* !HAVE_X_WINDOWS */
35    
36    /* X-related stuff used by non-X gui code. */
37    
38    typedef struct {
39      unsigned long pixel;
40      unsigned short red, green, blue;
41      char flags;
42      char pad;
43    } XColor;
44    
45  #endif /* HAVE_X_WINDOWS */  #endif /* HAVE_X_WINDOWS */
46    
47  #ifdef MSDOS  #ifdef MSDOS
48  #include "msdos.h"  #include "msdos.h"
49  #endif  #endif
50    
51    #ifdef HAVE_X_WINDOWS
52    typedef struct x_display_info Display_Info;
53    #define NativeRectangle XRectangle
54    #endif
55    
56  #ifdef HAVE_NTGUI  #ifdef HAVE_NTGUI
57  #include "w32gui.h"  #include "w32gui.h"
58    typedef struct w32_display_info Display_Info;
59  #endif  #endif
60    
61  #ifdef MAC_OS  #ifdef HAVE_CARBON
62  #include "macgui.h"  #include "macgui.h"
63    typedef struct mac_display_info Display_Info;
64    
65    /* Include Carbon.h to define Cursor and Rect.  */
66    #undef mktime
67    #undef DEBUG
68    #undef Z
69    #undef free
70    #undef malloc
71    #undef realloc
72    /* Macros max and min defined in lisp.h conflict with those in
73       precompiled header Carbon.h.  */
74    #undef max
75    #undef min
76    #undef init_process
77    #include <Carbon/Carbon.h>
78    #undef Z
79    #define Z (current_buffer->text->z)
80    #undef free
81    #define free unexec_free
82    #undef malloc
83    #define malloc unexec_malloc
84    #undef realloc
85    #define realloc unexec_realloc
86    #undef min
87    #define min(a, b) ((a) < (b) ? (a) : (b))
88    #undef max
89    #define max(a, b) ((a) > (b) ? (a) : (b))
90    #undef init_process
91    #define init_process emacs_init_process
92    
93    #endif
94    
95    
96    #ifndef NativeRectangle
97    #define NativeRectangle int
98  #endif  #endif
99    
100    
101  /* Structure forward declarations.  Some are here because function  /* Structure forward declarations.  Some are here because function
102     prototypes below reference structure types before their definition     prototypes below reference structure types before their definition
103     in this file.  Some are here because not every file including     in this file.  Some are here because not every file including
# Line 56  struct frame; Line 111  struct frame;
111  struct window;  struct window;
112    
113    
114    /* Values returned from coordinates_in_window.  */
115    
116    enum window_part
117    {
118      ON_NOTHING,
119      ON_TEXT,
120      ON_MODE_LINE,
121      ON_VERTICAL_BORDER,
122      ON_HEADER_LINE,
123      ON_LEFT_FRINGE,
124      ON_RIGHT_FRINGE,
125      ON_LEFT_MARGIN,
126      ON_RIGHT_MARGIN
127    };
128    
129    
130    
131  /***********************************************************************  /***********************************************************************
132                                Debugging                                Debugging
# Line 99  extern int trace_redisplay_p; Line 170  extern int trace_redisplay_p;
170    
171  #endif /* GLYPH_DEBUG == 0 */  #endif /* GLYPH_DEBUG == 0 */
172    
173        
174    
175  /***********************************************************************  /***********************************************************************
176                              Text positions                              Text positions
# Line 108  extern int trace_redisplay_p; Line 179  extern int trace_redisplay_p;
179  /* Starting with Emacs 20.3, characters from strings and buffers have  /* Starting with Emacs 20.3, characters from strings and buffers have
180     both a character and a byte position associated with them.  The     both a character and a byte position associated with them.  The
181     following structure holds such a pair of positions.  */     following structure holds such a pair of positions.  */
182        
183  struct text_pos  struct text_pos
184  {  {
185    /* Character position.  */    /* Character position.  */
# Line 164  struct text_pos Line 235  struct text_pos
235    
236  #define SET_MARKER_FROM_TEXT_POS(MARKER, POS) \  #define SET_MARKER_FROM_TEXT_POS(MARKER, POS) \
237       set_marker_both ((MARKER), Qnil, CHARPOS ((POS)), BYTEPOS ((POS)))       set_marker_both ((MARKER), Qnil, CHARPOS ((POS)), BYTEPOS ((POS)))
238        
239  /* Value is non-zero if character and byte positions of POS1 and POS2  /* Value is non-zero if character and byte positions of POS1 and POS2
240     are equal.  */     are equal.  */
241    
# Line 211  struct display_pos Line 282  struct display_pos
282  enum glyph_type  enum glyph_type
283  {  {
284    /* Glyph describes a character.  */    /* Glyph describes a character.  */
285    CHAR_GLYPH,      CHAR_GLYPH,
286    
287    /* Glyph describes a composition sequence.  */    /* Glyph describes a composition sequence.  */
288    COMPOSITE_GLYPH,    COMPOSITE_GLYPH,
# Line 227  enum glyph_type Line 298  enum glyph_type
298  /* Glyphs.  /* Glyphs.
299    
300     Be extra careful when changing this structure!  Esp. make sure that     Be extra careful when changing this structure!  Esp. make sure that
301     functions producing glyphs, like x_append_glyph, fill ALL of the     functions producing glyphs, like append_glyph, fill ALL of the
302     glyph structure, and that GLYPH_EQUAL_P compares all     glyph structure, and that GLYPH_EQUAL_P compares all
303     display-relevant members of glyphs (not to imply that these are the     display-relevant members of glyphs (not to imply that these are the
304     only things to check when you add a member).  */     only things to check when you add a member).  */
# Line 242  struct glyph Line 313  struct glyph
313    int charpos;    int charpos;
314    
315    /* Lisp object source of this glyph.  Currently either a buffer or    /* Lisp object source of this glyph.  Currently either a buffer or
316       a string, if the glyph was produced from characters which came from       a string, if the glyph was produced from characters which came from
317       a buffer or a string; or 0 if the glyph was inserted by redisplay       a buffer or a string; or 0 if the glyph was inserted by redisplay
318       for its own purposes such as padding.  */       for its own purposes such as padding.  */
319    Lisp_Object object;    Lisp_Object object;
# Line 289  struct glyph Line 360  struct glyph
360    unsigned glyph_not_available_p : 1;    unsigned glyph_not_available_p : 1;
361    
362    /* Face of the glyph.  */    /* Face of the glyph.  */
363    unsigned face_id : 22;    unsigned face_id : 21;
364    
365  #ifdef WINDOWSNT    /* Type of font used to display the character glyph.  May be used to
   /* Type of font used to display the character glyph. Used to  
366       determine which set of functions to use to obtain font metrics       determine which set of functions to use to obtain font metrics
367       for the glyph. Value should be an enumerator of the type       for the glyph.  On W32, value should be an enumerator of the type
368       w32_char_font_type.  */       w32_char_font_type.  Otherwise it equals FONT_TYPE_UNKNOWN.  */
369    unsigned w32_font_type : 2;    unsigned font_type : 3;
 #endif  
370    
371    /* A union of sub-structures for different glyph types.  */    /* A union of sub-structures for different glyph types.  */
372    union    union
# Line 321  struct glyph Line 390  struct glyph
390        unsigned ascent  : 16;        unsigned ascent  : 16;
391      }      }
392      stretch;      stretch;
393        
394      /* Used to compare all bit-fields above in one step.  */      /* Used to compare all bit-fields above in one step.  */
395      unsigned val;      unsigned val;
396    } u;    } u;
397  };  };
398    
399    
400    /* Default value of the glyph font_type field.  */
401    
402    #define FONT_TYPE_UNKNOWN       0
403    
404  /* Is GLYPH a space?  */  /* Is GLYPH a space?  */
405    
406  #define CHAR_GLYPH_SPACE_P(GLYPH) \  #define CHAR_GLYPH_SPACE_P(GLYPH) \
407       (GLYPH_FROM_CHAR_GLYPH ((GLYPH)) == SPACEGLYPH)       (GLYPH_FROM_CHAR_GLYPH ((GLYPH)) == SPACEGLYPH)
408    
409  /* Are glyphs *X and *Y displayed equal?  */  /* Are glyphs *X and *Y displayed equal?  */
410        
411  #define GLYPH_EQUAL_P(X, Y)                                     \  #define GLYPH_EQUAL_P(X, Y)                                     \
412       ((X)->type == (Y)->type                                    \       ((X)->type == (Y)->type                                    \
413        && (X)->u.val == (Y)->u.val                               \        && (X)->u.val == (Y)->u.val                               \
# Line 354  struct glyph Line 427  struct glyph
427    
428  /* Fill a character glyph GLYPH.  CODE, FACE_ID, PADDING_P correspond  /* Fill a character glyph GLYPH.  CODE, FACE_ID, PADDING_P correspond
429     to the bits defined for the typedef `GLYPH' in lisp.h.  */     to the bits defined for the typedef `GLYPH' in lisp.h.  */
430        
431  #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P) \  #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P) \
432       do                                                 \       do                                                 \
433         {                                                \         {                                                \
# Line 366  struct glyph Line 439  struct glyph
439    
440  /* Fill a character type glyph GLYPH from a glyph typedef FROM as  /* Fill a character type glyph GLYPH from a glyph typedef FROM as
441     defined in lisp.h.  */     defined in lisp.h.  */
442        
443  #define SET_CHAR_GLYPH_FROM_GLYPH(GLYPH, FROM)                  \  #define SET_CHAR_GLYPH_FROM_GLYPH(GLYPH, FROM)                  \
444       SET_CHAR_GLYPH ((GLYPH),                                   \       SET_CHAR_GLYPH ((GLYPH),                                   \
445                       FAST_GLYPH_CHAR ((FROM)),                  \                       FAST_GLYPH_CHAR ((FROM)),                  \
# Line 376  struct glyph Line 449  struct glyph
449  /* Construct a glyph code from a character glyph GLYPH.  If the  /* Construct a glyph code from a character glyph GLYPH.  If the
450     character is multibyte, return -1 as we can't use glyph table for a     character is multibyte, return -1 as we can't use glyph table for a
451     multibyte character.  */     multibyte character.  */
452        
453  #define GLYPH_FROM_CHAR_GLYPH(GLYPH)                            \  #define GLYPH_FROM_CHAR_GLYPH(GLYPH)                            \
454    ((GLYPH).u.ch < 256                                           \    ((GLYPH).u.ch < 256                                           \
455     ? ((GLYPH).u.ch | ((GLYPH).face_id << CHARACTERBITS))        \     ? ((GLYPH).u.ch | ((GLYPH).face_id << CHARACTERBITS))        \
456     : -1)     : -1)
457    
458  /* Is GLYPH a padding glyph?  */  /* Is GLYPH a padding glyph?  */
459        
460  #define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p  #define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p
461    
462    
# Line 544  enum glyph_row_area Line 617  enum glyph_row_area
617    
618     Each row is partitioned into three areas.  The start and end of     Each row is partitioned into three areas.  The start and end of
619     each area is recorded in a pointer as shown below.     each area is recorded in a pointer as shown below.
620      
621     +--------------------+-------------+---------------------+     +--------------------+-------------+---------------------+
622     |  left margin area  |  text area  |  right margin area  |     |  left margin area  |  text area  |  right margin area  |
623     +--------------------+-------------+---------------------+     +--------------------+-------------+---------------------+
# Line 552  enum glyph_row_area Line 625  enum glyph_row_area
625     glyphs[LEFT_MARGIN_AREA]           glyphs[RIGHT_MARGIN_AREA]     glyphs[LEFT_MARGIN_AREA]           glyphs[RIGHT_MARGIN_AREA]
626                          |                                   |                          |                                   |
627                          glyphs[TEXT_AREA]                   |                          glyphs[TEXT_AREA]                   |
628                                                glyphs[LAST_AREA]                                                  glyphs[LAST_AREA]
629    
630     Rows in frame matrices reference glyph memory allocated in a frame     Rows in frame matrices reference glyph memory allocated in a frame
631     glyph pool (see the description of struct glyph_pool).  Rows in     glyph pool (see the description of struct glyph_pool).  Rows in
632     window matrices on frames having frame matrices reference slices of     window matrices on frames having frame matrices reference slices of
633     the glyphs of corresponding rows in the frame matrix.     the glyphs of corresponding rows in the frame matrix.
634      
635     Rows in window matrices on frames having no frame matrices point to     Rows in window matrices on frames having no frame matrices point to
636     glyphs allocated from the heap via xmalloc;     glyphs allocated from the heap via xmalloc;
637     glyphs[LEFT_MARGIN_AREA] is the start address of the allocated     glyphs[LEFT_MARGIN_AREA] is the start address of the allocated
# Line 642  struct glyph_row Line 715  struct glyph_row
715    
716    /* 1 means the overlay arrow is on this line.  */    /* 1 means the overlay arrow is on this line.  */
717    unsigned overlay_arrow_p : 1;    unsigned overlay_arrow_p : 1;
718      
719    /* 1 means that this row displays a continued line, i.e. it has a    /* 1 means that this row displays a continued line, i.e. it has a
720       continuation mark at the right side.  */       continuation mark at the right side.  */
721    unsigned continued_p : 1;    unsigned continued_p : 1;
# Line 682  struct glyph_row Line 755  struct glyph_row
755       of more than one glyph.  Some glyphs have been put in this row,       of more than one glyph.  Some glyphs have been put in this row,
756       the rest are put in rows below this one.  */       the rest are put in rows below this one.  */
757    unsigned ends_in_middle_of_char_p : 1;    unsigned ends_in_middle_of_char_p : 1;
758      
759    /* 1 means this line starts in the middle of a character consisting    /* 1 means this line starts in the middle of a character consisting
760       of more than one glyph.  Some glyphs have been put in the       of more than one glyph.  Some glyphs have been put in the
761       previous row, the rest are put in this row.  */       previous row, the rest are put in this row.  */
# Line 713  struct glyph_row *matrix_row P_ ((struct Line 786  struct glyph_row *matrix_row P_ ((struct
786  #define MATRIX_ROW(MATRIX, ROW)   ((MATRIX)->rows + (ROW))  #define MATRIX_ROW(MATRIX, ROW)   ((MATRIX)->rows + (ROW))
787  #endif  #endif
788    
789  /* Return a pointer to the row reserved for the mode line in MATRIX.    /* Return a pointer to the row reserved for the mode line in MATRIX.
790     Row MATRIX->nrows - 1 is always reserved for the mode line.  */     Row MATRIX->nrows - 1 is always reserved for the mode line.  */
791    
792  #define MATRIX_MODE_LINE_ROW(MATRIX) \  #define MATRIX_MODE_LINE_ROW(MATRIX) \
# Line 738  struct glyph_row *matrix_row P_ ((struct Line 811  struct glyph_row *matrix_row P_ ((struct
811       (MATRIX_ROW ((MATRIX), (ROW))->glyphs[TEXT_AREA])       (MATRIX_ROW ((MATRIX), (ROW))->glyphs[TEXT_AREA])
812    
813  /* Return the number of used glyphs in the text area of a row.  */  /* Return the number of used glyphs in the text area of a row.  */
814        
815  #define MATRIX_ROW_USED(MATRIX, ROW) \  #define MATRIX_ROW_USED(MATRIX, ROW) \
816       (MATRIX_ROW ((MATRIX), (ROW))->used[TEXT_AREA])       (MATRIX_ROW ((MATRIX), (ROW))->used[TEXT_AREA])
817    
818  /* Return the character/ byte position at which the display of ROW  /* Return the character/ byte position at which the display of ROW
819     starts.  */     starts.  */
820        
821  #define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->start.pos.charpos)  #define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->start.pos.charpos)
822  #define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->start.pos.bytepos)  #define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->start.pos.bytepos)
823    
824  /* Return the character/ byte position at which ROW ends.  */  /* Return the character/ byte position at which ROW ends.  */
825        
826  #define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->end.pos.charpos)  #define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->end.pos.charpos)
827  #define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->end.pos.bytepos)  #define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->end.pos.bytepos)
828    
829  /* Return the vertical position of ROW in MATRIX.  */  /* Return the vertical position of ROW in MATRIX.  */
830        
831  #define MATRIX_ROW_VPOS(ROW, MATRIX) ((ROW) - (MATRIX)->rows)  #define MATRIX_ROW_VPOS(ROW, MATRIX) ((ROW) - (MATRIX)->rows)
832    
833  /* Return the last glyph row + 1 in MATRIX on window W reserved for  /* Return the last glyph row + 1 in MATRIX on window W reserved for
834     text.  If W has a mode line, the last row in the matrix is reserved     text.  If W has a mode line, the last row in the matrix is reserved
835     for it.  */     for it.  */
836        
837  #define MATRIX_BOTTOM_TEXT_ROW(MATRIX, W)               \  #define MATRIX_BOTTOM_TEXT_ROW(MATRIX, W)               \
838       ((MATRIX)->rows                                    \       ((MATRIX)->rows                                    \
839        + (MATRIX)->nrows                                 \        + (MATRIX)->nrows                                 \
# Line 768  struct glyph_row *matrix_row P_ ((struct Line 841  struct glyph_row *matrix_row P_ ((struct
841    
842  /* Non-zero if the face of the last glyph in ROW's text area has  /* Non-zero if the face of the last glyph in ROW's text area has
843     to be drawn to the end of the text area.  */     to be drawn to the end of the text area.  */
844        
845  #define MATRIX_ROW_EXTENDS_FACE_P(ROW) ((ROW)->fill_line_p)  #define MATRIX_ROW_EXTENDS_FACE_P(ROW) ((ROW)->fill_line_p)
846    
847  /* Set and query the enabled_p flag of glyph row ROW in MATRIX.  */  /* Set and query the enabled_p flag of glyph row ROW in MATRIX.  */
848        
849  #define SET_MATRIX_ROW_ENABLED_P(MATRIX, ROW, VALUE) \  #define SET_MATRIX_ROW_ENABLED_P(MATRIX, ROW, VALUE) \
850       (MATRIX_ROW ((MATRIX), (ROW))->enabled_p = (VALUE) != 0)       (MATRIX_ROW ((MATRIX), (ROW))->enabled_p = (VALUE) != 0)
851        
852  #define MATRIX_ROW_ENABLED_P(MATRIX, ROW) \  #define MATRIX_ROW_ENABLED_P(MATRIX, ROW) \
853       (MATRIX_ROW ((MATRIX), (ROW))->enabled_p)       (MATRIX_ROW ((MATRIX), (ROW))->enabled_p)
854    
855  /* Non-zero if ROW displays text.  Value is non-zero if the row is  /* Non-zero if ROW displays text.  Value is non-zero if the row is
856     blank but displays a line end.  */     blank but displays a line end.  */
857        
858  #define MATRIX_ROW_DISPLAYS_TEXT_P(ROW) ((ROW)->displays_text_p)  #define MATRIX_ROW_DISPLAYS_TEXT_P(ROW) ((ROW)->displays_text_p)
859    
860  /* Non-zero if ROW is not completely visible in window W.  */  /* Non-zero if ROW is not completely visible in window W.  */
861        
862  #define MATRIX_ROW_PARTIALLY_VISIBLE_P(ROW)     \  #define MATRIX_ROW_PARTIALLY_VISIBLE_P(ROW)     \
863       ((ROW)->height != (ROW)->visible_height)       ((ROW)->height != (ROW)->visible_height)
864    
865  /* Non-zero if ROW is partially visible at the top of window W.  */  /* Non-zero if ROW is partially visible at the top of window W.  */
866        
867  #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW)           \  #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW)           \
868       (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW))                    \       (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW))                    \
869        && (ROW)->y < WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))        && (ROW)->y < WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
870    
871  /* Non-zero if ROW is partially visible at the bottom of window W.  */  /* Non-zero if ROW is partially visible at the bottom of window W.  */
872        
873  #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW)                      \  #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW)                      \
874       (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW))                                  \       (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW))                                  \
875        && (ROW)->y + (ROW)->height > WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE ((W)))        && (ROW)->y + (ROW)->height > WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE ((W)))
876    
877  /* Return the bottom Y + 1 of ROW.   */  /* Return the bottom Y + 1 of ROW.   */
878        
879  #define MATRIX_ROW_BOTTOM_Y(ROW) ((ROW)->y + (ROW)->height)  #define MATRIX_ROW_BOTTOM_Y(ROW) ((ROW)->y + (ROW)->height)
880    
881  /* Is ROW the last visible one in the display described by the  /* Is ROW the last visible one in the display described by the
882     iterator structure pointed to by IT?.  */     iterator structure pointed to by IT?.  */
883        
884  #define MATRIX_ROW_LAST_VISIBLE_P(ROW, IT) \  #define MATRIX_ROW_LAST_VISIBLE_P(ROW, IT) \
885       (MATRIX_ROW_BOTTOM_Y ((ROW)) >= (IT)->last_visible_y)       (MATRIX_ROW_BOTTOM_Y ((ROW)) >= (IT)->last_visible_y)
886    
# Line 831  struct glyph_row *matrix_row P_ ((struct Line 904  struct glyph_row *matrix_row P_ ((struct
904       ((ROW)->end.overlay_string_index >= 0)       ((ROW)->end.overlay_string_index >= 0)
905    
906  /* Non-zero if ROW starts in the middle of a character.  See above.  */  /* Non-zero if ROW starts in the middle of a character.  See above.  */
907        
908  #define MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P(ROW)      \  #define MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P(ROW)      \
909       ((ROW)->start.dpvec_index >= 0                     \       ((ROW)->start.dpvec_index >= 0                     \
910        || (ROW)->starts_in_middle_of_char_p              \        || (ROW)->starts_in_middle_of_char_p              \
# Line 902  extern struct glyph_row scratch_glyph_ro Line 975  extern struct glyph_row scratch_glyph_ro
975    
976    
977  /************************************************************************  /************************************************************************
978                              Glyph Strings
979     ************************************************************************/
980    
981    /* Enumeration for overriding/changing the face to use for drawing
982       glyphs in draw_glyphs.  */
983    
984    enum draw_glyphs_face
985    {
986      DRAW_NORMAL_TEXT,
987      DRAW_INVERSE_VIDEO,
988      DRAW_CURSOR,
989      DRAW_MOUSE_FACE,
990      DRAW_IMAGE_RAISED,
991      DRAW_IMAGE_SUNKEN
992    };
993    
994    #ifdef HAVE_WINDOW_SYSTEM
995    
996    /* A sequence of glyphs to be drawn in the same face.  */
997    
998    struct glyph_string
999    {
1000      /* X-origin of the string.  */
1001      int x;
1002    
1003      /* Y-origin and y-position of the base line of this string.  */
1004      int y, ybase;
1005    
1006      /* The width of the string, not including a face extension.  */
1007      int width;
1008    
1009      /* The width of the string, including a face extension.  */
1010      int background_width;
1011    
1012      /* The height of this string.  This is the height of the line this
1013         string is drawn in, and can be different from the height of the
1014         font the string is drawn in.  */
1015      int height;
1016    
1017      /* Number of pixels this string overwrites in front of its x-origin.
1018         This number is zero if the string has an lbearing >= 0; it is
1019         -lbearing, if the string has an lbearing < 0.  */
1020      int left_overhang;
1021    
1022      /* Number of pixels this string overwrites past its right-most
1023         nominal x-position, i.e. x + width.  Zero if the string's
1024         rbearing is <= its nominal width, rbearing - width otherwise.  */
1025      int right_overhang;
1026    
1027      /* The frame on which the glyph string is drawn.  */
1028      struct frame *f;
1029    
1030      /* The window on which the glyph string is drawn.  */
1031      struct window *w;
1032    
1033      /* X display and window for convenience.  */
1034      Display *display;
1035      Window window;
1036    
1037      /* The glyph row for which this string was built.  It determines the
1038         y-origin and height of the string.  */
1039      struct glyph_row *row;
1040    
1041      /* The area within row.  */
1042      enum glyph_row_area area;
1043    
1044      /* Characters to be drawn, and number of characters.  */
1045      XChar2b *char2b;
1046      int nchars;
1047    
1048      /* A face-override for drawing cursors, mouse face and similar.  */
1049      enum draw_glyphs_face hl;
1050    
1051      /* Face in which this string is to be drawn.  */
1052      struct face *face;
1053    
1054      /* Font in which this string is to be drawn.  */
1055      XFontStruct *font;
1056    
1057      /* Font info for this string.  */
1058      struct font_info *font_info;
1059    
1060      /* Non-null means this string describes (part of) a composition.
1061         All characters from char2b are drawn composed.  */
1062      struct composition *cmp;
1063    
1064      /* Index of this glyph string's first character in the glyph
1065         definition of CMP.  If this is zero, this glyph string describes
1066         the first character of a composition.  */
1067      int gidx;
1068    
1069      /* 1 means this glyph strings face has to be drawn to the right end
1070         of the window's drawing area.  */
1071      unsigned extends_to_end_of_line_p : 1;
1072    
1073      /* 1 means the background of this string has been drawn.  */
1074      unsigned background_filled_p : 1;
1075    
1076      /* 1 means glyph string must be drawn with 16-bit functions.  */
1077      unsigned two_byte_p : 1;
1078    
1079      /* 1 means that the original font determined for drawing this glyph
1080         string could not be loaded.  The member `font' has been set to
1081         the frame's default font in this case.  */
1082      unsigned font_not_found_p : 1;
1083    
1084      /* 1 means that the face in which this glyph string is drawn has a
1085         stipple pattern.  */
1086      unsigned stippled_p : 1;
1087    
1088      /* 1 means only the foreground of this glyph string must be drawn,
1089         and we should use the physical height of the line this glyph
1090         string appears in as clip rect.  */
1091      unsigned for_overlaps_p : 1;
1092    
1093      /* The GC to use for drawing this glyph string.  */
1094    #if defined(HAVE_X_WINDOWS) || defined(HAVE_CARBON)
1095      GC gc;
1096    #endif
1097    #if defined(HAVE_NTGUI)
1098      XGCValues *gc;
1099      HDC hdc;
1100    #endif
1101    
1102      /* A pointer to the first glyph in the string.  This glyph
1103         corresponds to char2b[0].  Needed to draw rectangles if
1104         font_not_found_p is 1.  */
1105      struct glyph *first_glyph;
1106    
1107      /* Image, if any.  */
1108      struct image *img;
1109    
1110      struct glyph_string *next, *prev;
1111    };
1112    
1113    #endif /* HAVE_WINDOW_SYSTEM */
1114    
1115    
1116    /************************************************************************
1117                            Display Dimensions                            Display Dimensions
1118   ************************************************************************/   ************************************************************************/
1119    
# Line 1003  extern struct glyph_row scratch_glyph_ro Line 1215  extern struct glyph_row scratch_glyph_ro
1215         * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))         * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1216    
1217  /* Height of the display region of W, including a mode line, if any.  */  /* Height of the display region of W, including a mode line, if any.  */
1218        
1219  #define WINDOW_DISPLAY_PIXEL_HEIGHT(W)                                  \  #define WINDOW_DISPLAY_PIXEL_HEIGHT(W)                                  \
1220       (XFASTINT ((W)->height)                                            \       (XFASTINT ((W)->height)                                            \
1221        * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W)))))        * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W)))))
1222    
1223  /* Height in pixels of the mode line.  May be zero if W doesn't have a  /* Height in pixels of the mode line.  May be zero if W doesn't have a
1224     mode line.  */     mode line.  */
1225        
1226  #define WINDOW_DISPLAY_MODE_LINE_HEIGHT(W)      \  #define WINDOW_DISPLAY_MODE_LINE_HEIGHT(W)      \
1227       (WINDOW_WANTS_MODELINE_P ((W))             \       (WINDOW_WANTS_MODELINE_P ((W))             \
1228        ? CURRENT_MODE_LINE_HEIGHT (W)            \        ? CURRENT_MODE_LINE_HEIGHT (W)            \
# Line 1018  extern struct glyph_row scratch_glyph_ro Line 1230  extern struct glyph_row scratch_glyph_ro
1230    
1231  /* Height in pixels of the header line.  Zero if W doesn't have a header  /* Height in pixels of the header line.  Zero if W doesn't have a header
1232     line.  */     line.  */
1233        
1234  #define WINDOW_DISPLAY_HEADER_LINE_HEIGHT(W)    \  #define WINDOW_DISPLAY_HEADER_LINE_HEIGHT(W)    \
1235       (WINDOW_WANTS_HEADER_LINE_P ((W))          \       (WINDOW_WANTS_HEADER_LINE_P ((W))          \
1236        ? CURRENT_HEADER_LINE_HEIGHT (W)          \        ? CURRENT_HEADER_LINE_HEIGHT (W)          \
1237        : 0)        : 0)
1238    
1239  /* Pixel height of window W without mode line.  */  /* Pixel height of window W without mode line.  */
1240        
1241  #define WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE(W)   \  #define WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE(W)   \
1242       (WINDOW_DISPLAY_PIXEL_HEIGHT ((W))         \       (WINDOW_DISPLAY_PIXEL_HEIGHT ((W))         \
1243        - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)))        - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)))
1244    
1245  /* Pixel height of window W without mode and header line.  */  /* Pixel height of window W without mode and header line.  */
1246        
1247  #define WINDOW_DISPLAY_TEXT_HEIGHT(W)           \  #define WINDOW_DISPLAY_TEXT_HEIGHT(W)           \
1248       (WINDOW_DISPLAY_PIXEL_HEIGHT ((W))         \       (WINDOW_DISPLAY_PIXEL_HEIGHT ((W))         \
1249        - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W))   \        - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W))   \
1250        - WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))        - WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
1251    
1252  /* Left edge of W in pixels relative to its frame.  */  /* Left edge of W in pixels relative to its frame.  */
1253        
1254  #define WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X(W)                             \  #define WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X(W)                             \
1255       (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W))))    \       (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W))))    \
1256        + (WINDOW_LEFT_MARGIN ((W))                                       \        + (WINDOW_LEFT_MARGIN ((W))                                       \
# Line 1046  extern struct glyph_row scratch_glyph_ro Line 1258  extern struct glyph_row scratch_glyph_ro
1258        + FRAME_LEFT_FRINGE_WIDTH (XFRAME (WINDOW_FRAME ((W)))))        + FRAME_LEFT_FRINGE_WIDTH (XFRAME (WINDOW_FRAME ((W)))))
1259    
1260  /* Right edge of window W in pixels, relative to its frame.  */  /* Right edge of window W in pixels, relative to its frame.  */
1261        
1262  #define WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X(W)            \  #define WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X(W)            \
1263       (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W))            \       (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W))            \
1264        + WINDOW_DISPLAY_PIXEL_WIDTH ((W)))        + WINDOW_DISPLAY_PIXEL_WIDTH ((W)))
1265    
1266  /* Top edge of W in pixels relative to its frame.  */  /* Top edge of W in pixels relative to its frame.  */
1267        
1268  #define WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y(W)                              \  #define WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y(W)                              \
1269       (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W))))    \       (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W))))    \
1270        + (XFASTINT ((W)->top)                                            \        + (XFASTINT ((W)->top)                                            \
1271           * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W))))))           * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1272    
1273  /* Bottom edge of window W relative to its frame.  */  /* Bottom edge of window W relative to its frame.  */
1274        
1275  #define WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y(W)           \  #define WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y(W)           \
1276       (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W))             \       (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W))             \
1277        + WINDOW_DISPLAY_PIXEL_HEIGHT ((W)))        + WINDOW_DISPLAY_PIXEL_HEIGHT ((W)))
1278        
1279  /* Convert window W relative pixel X to frame pixel coordinates.  */  /* Convert window W relative pixel X to frame pixel coordinates.  */
1280        
1281  #define WINDOW_TO_FRAME_PIXEL_X(W, X) \  #define WINDOW_TO_FRAME_PIXEL_X(W, X) \
1282       ((X) + WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))       ((X) + WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
1283    
1284  /* Convert window W relative pixel Y to frame pixel coordinates.  */  /* Convert window W relative pixel Y to frame pixel coordinates.  */
1285        
1286  #define WINDOW_TO_FRAME_PIXEL_Y(W, Y) \  #define WINDOW_TO_FRAME_PIXEL_Y(W, Y) \
1287       ((Y) + WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))       ((Y) + WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
1288    
1289  /* Convert frame relative pixel X to window relative pixel X.  */  /* Convert frame relative pixel X to window relative pixel X.  */
1290        
1291  #define FRAME_TO_WINDOW_PIXEL_X(W, X) \  #define FRAME_TO_WINDOW_PIXEL_X(W, X) \
1292       ((X) - WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))       ((X) - WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
1293    
1294  /* Convert frame relative pixel Y to window relative pixel Y.  */  /* Convert frame relative pixel Y to window relative pixel Y.  */
1295        
1296  #define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \  #define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \
1297       ((Y) - WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))       ((Y) - WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
1298    
1299  /* Width of left margin area in pixels.  */  /* Width of left margin area in pixels.  */
1300        
1301  #define WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH(W)         \  #define WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH(W)         \
1302       (NILP ((W)->left_margin_width)                     \       (NILP ((W)->left_margin_width)                     \
1303        ? 0                                               \        ? 0                                               \
1304        : (XINT ((W)->left_margin_width)                  \        : (XINT ((W)->left_margin_width)                  \
1305           * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))           * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1306                
1307  /* Width of right marginal area in pixels.  */  /* Width of right marginal area in pixels.  */
1308        
1309  #define WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH(W)        \  #define WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH(W)        \
1310       (NILP ((W)->right_margin_width)                    \       (NILP ((W)->right_margin_width)                    \
1311        ? 0                                               \        ? 0                                               \
# Line 1101  extern struct glyph_row scratch_glyph_ro Line 1313  extern struct glyph_row scratch_glyph_ro
1313           * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))           * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1314    
1315  /* Width of text area in pixels.  */  /* Width of text area in pixels.  */
1316        
1317  #define WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH(W)         \  #define WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH(W)         \
1318       (WINDOW_DISPLAY_PIXEL_WIDTH ((W))                  \       (WINDOW_DISPLAY_PIXEL_WIDTH ((W))                  \
1319        - WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W))      \        - WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W))      \
# Line 1134  extern struct glyph_row scratch_glyph_ro Line 1346  extern struct glyph_row scratch_glyph_ro
1346        : (((AREA) == LEFT_MARGIN_AREA)                   \        : (((AREA) == LEFT_MARGIN_AREA)                   \
1347           ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W))   \           ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W))   \
1348           : WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W))))           : WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W))))
1349        
1350  /* Value is non-zero if window W wants a mode line.  */  /* Value is non-zero if window W wants a mode line.  */
1351    
1352  #define WINDOW_WANTS_MODELINE_P(W)                                      \  #define WINDOW_WANTS_MODELINE_P(W)                                      \
# Line 1155  extern struct glyph_row scratch_glyph_ro Line 1367  extern struct glyph_row scratch_glyph_ro
1367        && !NILP (XBUFFER ((W)->buffer)->header_line_format)              \        && !NILP (XBUFFER ((W)->buffer)->header_line_format)              \
1368        && XFASTINT ((W)->height) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format))        && XFASTINT ((W)->height) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format))
1369    
1370        
1371    /* Return proper value to be used as baseline offset of font that has
1372       ASCENT and DESCENT to draw characters by the font at the vertical
1373       center of the line of frame F.
1374    
1375       Here, our task is to find the value of BOFF in the following figure;
1376    
1377            -------------------------+-----------+-
1378             -+-+---------+-+        |           |
1379              | |         | |        |           |
1380              | |         | |        F_ASCENT    F_HEIGHT
1381              | |         | ASCENT   |           |
1382         HEIGHT |         | |        |           |
1383              | |         |-|-+------+-----------|------- baseline
1384              | |         | | BOFF   |           |
1385              | |---------|-+-+      |           |
1386              | |         | DESCENT  |           |
1387             -+-+---------+-+        F_DESCENT   |
1388            -------------------------+-----------+-
1389    
1390            -BOFF + DESCENT + (F_HEIGHT - HEIGHT) / 2 = F_DESCENT
1391            BOFF = DESCENT +  (F_HEIGHT - HEIGHT) / 2 - F_DESCENT
1392            DESCENT = FONT->descent
1393            HEIGHT = FONT_HEIGHT (FONT)
1394            F_DESCENT = (F->output_data.x->font->descent
1395                         - F->output_data.x->baseline_offset)
1396            F_HEIGHT = FRAME_LINE_HEIGHT (F)
1397    */
1398    
1399    #define VCENTER_BASELINE_OFFSET(FONT, F)                        \
1400      (FONT_DESCENT (FONT)                                          \
1401       + (FRAME_LINE_HEIGHT ((F)) - FONT_HEIGHT ((FONT))            \
1402          + (FRAME_LINE_HEIGHT ((F)) > FONT_HEIGHT ((FONT)))) / 2   \
1403       - (FONT_DESCENT (FRAME_FONT (F)) - FRAME_BASELINE_OFFSET (F)))
1404    
1405    
1406  /***********************************************************************  /***********************************************************************
1407                                  Faces                                  Faces
1408   ***********************************************************************/   ***********************************************************************/
1409        
1410  /* Indices of face attributes in Lisp face vectors.  Slot zero is the  /* Indices of face attributes in Lisp face vectors.  Slot zero is the
1411     symbol `face'.  */     symbol `face'.  */
1412    
# Line 1217  struct face Line 1464  struct face
1464    int id;    int id;
1465    
1466  #ifdef HAVE_WINDOW_SYSTEM  #ifdef HAVE_WINDOW_SYSTEM
1467      
1468    /* If non-zero, this is a GC that we can use without modification for    /* If non-zero, this is a GC that we can use without modification for
1469       drawing the characters in this face.  */       drawing the characters in this face.  */
1470    GC gc;    GC gc;
1471      
1472    /* Font used for this face, or null if the font could not be loaded    /* Font used for this face, or null if the font could not be loaded
1473       for some reason.  This points to a `font' slot of a struct       for some reason.  This points to a `font' slot of a struct
1474       font_info, and we should not call XFreeFont on it because the       font_info, and we should not call XFreeFont on it because the
# Line 1242  struct face Line 1489  struct face
1489    /* Pixel value of foreground color for X frames.  Color index    /* Pixel value of foreground color for X frames.  Color index
1490       for tty frames.  */       for tty frames.  */
1491    unsigned long foreground;    unsigned long foreground;
1492      
1493    /* Pixel value or color index of background color.  */    /* Pixel value or color index of background color.  */
1494    unsigned long background;    unsigned long background;
1495    
# Line 1270  struct face Line 1517  struct face
1517       Otherwise, a specific font is loaded from the set of fonts       Otherwise, a specific font is loaded from the set of fonts
1518       specified by the fontset given by the family attribute of the face.  */       specified by the fontset given by the family attribute of the face.  */
1519    int fontset;    int fontset;
1520      
1521    /* Pixmap width and height.  */    /* Pixmap width and height.  */
1522    unsigned int pixmap_w, pixmap_h;    unsigned int pixmap_w, pixmap_h;
1523      
1524    /* Non-zero means characters in this face have a box that thickness    /* Non-zero means characters in this face have a box that thickness
1525       around them.  If it is negative, the absolute value indicates the       around them.  If it is negative, the absolute value indicates the
1526       thickness, and the horizontal lines of box (top and bottom) are       thickness, and the horizontal lines of box (top and bottom) are
# Line 1322  struct face Line 1569  struct face
1569    /* 1 means that either no color is specified for underlining or that    /* 1 means that either no color is specified for underlining or that
1570       the specified color couldn't be loaded.  Use the foreground       the specified color couldn't be loaded.  Use the foreground
1571       color when drawing in that case. */       color when drawing in that case. */
1572    unsigned underline_defaulted_p : 1;    unsigned underline_defaulted_p : 1;
1573    
1574    /* 1 means that either no color is specified for the corresponding    /* 1 means that either no color is specified for the corresponding
1575       attribute or that the specified color couldn't be loaded.       attribute or that the specified color couldn't be loaded.
# Line 1346  struct face Line 1593  struct face
1593       realize_x_face).  */       realize_x_face).  */
1594    unsigned colors_copied_bitwise_p : 1;    unsigned colors_copied_bitwise_p : 1;
1595    
1596      /* If non-zero, use overstrike (to simulate bold-face).  */
1597      unsigned overstrike : 1;
1598    
1599    /* Next and previous face in hash collision list of face cache.  */    /* Next and previous face in hash collision list of face cache.  */
1600    struct face *next, *prev;    struct face *next, *prev;
1601    
# Line 1399  struct face_cache Line 1649  struct face_cache
1649  {  {
1650    /* Hash table of cached realized faces.  */    /* Hash table of cached realized faces.  */
1651    struct face **buckets;    struct face **buckets;
1652      
1653    /* Back-pointer to the frame this cache belongs to.  */    /* Back-pointer to the frame this cache belongs to.  */
1654    struct frame *f;    struct frame *f;
1655    
# Line 1444  struct face_cache Line 1694  struct face_cache
1694  /* Return the id of the realized face on frame F that is like the face  /* Return the id of the realized face on frame F that is like the face
1695     with id ID but is suitable for displaying character CHAR.     with id ID but is suitable for displaying character CHAR.
1696     This macro is only meaningful for multibyte character CHAR.  */     This macro is only meaningful for multibyte character CHAR.  */
1697      
1698  #define FACE_FOR_CHAR(F, FACE, CHAR)    \  #define FACE_FOR_CHAR(F, FACE, CHAR)    \
1699    (SINGLE_BYTE_CHAR_P (CHAR)            \    (SINGLE_BYTE_CHAR_P (CHAR)            \
1700     ? (FACE)->ascii_face->id             \     ? (FACE)->ascii_face->id             \
# Line 1466  extern int face_change_count; Line 1716  extern int face_change_count;
1716    
1717    
1718  /***********************************************************************  /***********************************************************************
1719                                   Fringes
1720     ***********************************************************************/
1721    
1722    enum fringe_bitmap_type
1723    {
1724      NO_FRINGE_BITMAP = 0,
1725      LEFT_TRUNCATION_BITMAP,
1726      RIGHT_TRUNCATION_BITMAP,
1727      CONTINUED_LINE_BITMAP,
1728      CONTINUATION_LINE_BITMAP,
1729      OVERLAY_ARROW_BITMAP,
1730      ZV_LINE_BITMAP,
1731      MAX_FRINGE_BITMAPS
1732    };
1733    
1734    struct fringe_bitmap
1735    {
1736      int width;
1737      int height;
1738      int period;
1739      unsigned char *bits;
1740    };
1741    
1742    /* Structure used to describe where and how to draw a fringe bitmap.
1743       WHICH is the fringe bitmap to draw.  WD and H is the (adjusted)
1744       width and height of the bitmap, DH is the height adjustment (if
1745       bitmap is periodic).  X and Y are frame coordinates of the area to
1746       display the bitmap, DY is relative offset of the bitmap into that
1747       area.  BX, NX, BY, NY specifies the area to clear if the bitmap
1748       does not fill the entire area.  FACE is the fringe face.  */
1749    
1750    struct draw_fringe_bitmap_params
1751    {
1752      enum fringe_bitmap_type which;
1753      int wd, h, dh;
1754      int x, y;
1755      int bx, nx, by, ny;
1756      struct face *face;
1757    };
1758    
1759    extern struct fringe_bitmap fringe_bitmaps[MAX_FRINGE_BITMAPS];
1760    
1761    
1762    /***********************************************************************
1763                              Display Iterator                              Display Iterator
1764   ***********************************************************************/   ***********************************************************************/
1765    
# Line 1674  struct it Line 1968  struct it
1968    
1969    /* Stack pointer.  */    /* Stack pointer.  */
1970    int sp;    int sp;
1971      
1972    /* Setting of buffer-local variable selective-display-ellipsis.  */    /* Setting of buffer-local variable selective-display-ellipsis.  */
1973    unsigned selective_display_ellipsis_p : 1;    unsigned selective_display_ellipsis_p : 1;
1974    
# Line 1699  struct it Line 1993  struct it
1993    /* Non-null means that the current character is the first in a run    /* Non-null means that the current character is the first in a run
1994       of characters with box face.  */       of characters with box face.  */
1995    unsigned start_of_box_run_p : 1;    unsigned start_of_box_run_p : 1;
1996      
1997    /* Non-zero means that the current character is the last in a run    /* Non-zero means that the current character is the last in a run
1998       of characters with box face.  */       of characters with box face.  */
1999    unsigned end_of_box_run_p : 1;    unsigned end_of_box_run_p : 1;
# Line 1739  struct it Line 2033  struct it
2033    
2034    /* The character to display, possibly translated to multibyte    /* The character to display, possibly translated to multibyte
2035       if unibyte_display_via_language_environment is set.  This       if unibyte_display_via_language_environment is set.  This
2036       is set after x_produce_glyphs has been called.  */       is set after produce_glyphs has been called.  */
2037    int char_to_display;    int char_to_display;
2038    
2039    /* If what == IT_IMAGE, the id of the image to display.  */    /* If what == IT_IMAGE, the id of the image to display.  */
# Line 1793  struct it Line 2087  struct it
2087    /* Number of glyphs needed for the last character requested via    /* Number of glyphs needed for the last character requested via
2088       produce_glyphs.  This is 1 except for tabs.  */       produce_glyphs.  This is 1 except for tabs.  */
2089    int nglyphs;    int nglyphs;
2090      
2091    /* Width of the display element in pixels.  Result of    /* Width of the display element in pixels.  Result of
2092       produce_glyphs.  */       produce_glyphs.  */
2093    int pixel_width;    int pixel_width;
# Line 1852  struct it Line 2146  struct it
2146  /* Call produce_glyphs or produce_glyphs_hook, if set.  Shortcut to  /* Call produce_glyphs or produce_glyphs_hook, if set.  Shortcut to
2147     avoid the function call overhead.  */     avoid the function call overhead.  */
2148    
2149  #define PRODUCE_GLYPHS(IT)                      \  #define PRODUCE_GLYPHS(IT)                      \
2150       (rif                                       \       do {                                       \
2151        ? rif->produce_glyphs ((IT))              \         extern int inhibit_free_realized_faces;  \
2152        : produce_glyphs ((IT)))         if (rif != NULL)                         \
2153             rif->produce_glyphs ((IT));            \
2154           else                                     \
2155             produce_glyphs ((IT));                 \
2156           if ((IT)->glyph_row != NULL)             \
2157             inhibit_free_realized_faces = 1;       \
2158         } while (0)
2159    
2160  /* Bit-flags indicating what operation move_it_to should perform.  */  /* Bit-flags indicating what operation move_it_to should perform.  */
2161    
# Line 1895  struct run Line 2195  struct run
2195  };  };
2196    
2197    
2198    /* Handlers for setting frame parameters.  */
2199    
2200    typedef void (*frame_parm_handler) P_ ((struct frame *, Lisp_Object, Lisp_Object));
2201    
2202    
2203  /* Structure holding system-dependent interface functions needed  /* Structure holding system-dependent interface functions needed
2204     for window-based redisplay.  */     for window-based redisplay.  */
2205    
2206  struct redisplay_interface  struct redisplay_interface
2207  {  {
2208      /* Handlers for setting frame parameters.  */
2209      frame_parm_handler *frame_parm_handlers;
2210    
2211    /* Produce glyphs/get display metrics for the display element IT is    /* Produce glyphs/get display metrics for the display element IT is
2212       loaded with.  */       loaded with.  */
2213    void (*produce_glyphs) P_ ((struct it *it));    void (*produce_glyphs) P_ ((struct it *it));
2214      
2215    /* Write or insert LEN glyphs from STRING at the nominal output    /* Write or insert LEN glyphs from STRING at the nominal output
2216       position.  */       position.  */
2217    void (*write_glyphs) P_ ((struct glyph *string, int len));    void (*write_glyphs) P_ ((struct glyph *string, int len));
# Line 1912  struct redisplay_interface Line 2220  struct redisplay_interface
2220    /* Clear from nominal output position to X.  X < 0 means clear    /* Clear from nominal output position to X.  X < 0 means clear
2221       to right end of display.  */       to right end of display.  */
2222    void (*clear_end_of_line) P_ ((int x));    void (*clear_end_of_line) P_ ((int x));
2223      
2224    /* Function to call to scroll the display as described by RUN on    /* Function to call to scroll the display as described by RUN on
2225       window W.  */       window W.  */
2226    void (*scroll_run_hook) P_ ((struct window *w, struct run *run));    void (*scroll_run_hook) P_ ((struct window *w, struct run *run));
# Line 1933  struct redisplay_interface Line 2241  struct redisplay_interface
2241       have to update the mouse highlight.  */       have to update the mouse highlight.  */
2242    void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p,    void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p,
2243                                        int mouse_face_overwritten_p));                                        int mouse_face_overwritten_p));
2244      
2245    /* Move cursor to row/column position VPOS/HPOS, pixel coordinates    /* Move cursor to row/column position VPOS/HPOS, pixel coordinates
2246       Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y       Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
2247       are window-relative pixel positions.  */       are window-relative pixel positions.  */
# Line 1942  struct redisplay_interface Line 2250  struct redisplay_interface
2250    /* Flush the display of frame F.  For X, this is XFlush.  */    /* Flush the display of frame F.  For X, this is XFlush.  */
2251    void (*flush_display) P_ ((struct frame *f));    void (*flush_display) P_ ((struct frame *f));
2252    
2253      /* Flush the display of frame F if non-NULL.  This is called
2254         during redisplay, and should be NULL on systems which flushes
2255         automatically before reading input.  */
2256      void (*flush_display_optional) P_ ((struct frame *f));
2257    
2258    /* Clear the mouse hightlight in window W, if there is any.  */    /* Clear the mouse hightlight in window W, if there is any.  */
2259    void (*clear_mouse_face) P_ ((struct window *w));    void (*clear_window_mouse_face) P_ ((struct window *w));
2260    
2261    /* Set *LEFT and *RIGHT to the left and right overhang of GLYPH on    /* Set *LEFT and *RIGHT to the left and right overhang of GLYPH on
2262       frame F.  */       frame F.  */
# Line 1955  struct redisplay_interface Line 2268  struct redisplay_interface
2268       desired rows have been made current.  */       desired rows have been made current.  */
2269    void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row,    void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row,
2270                                      enum glyph_row_area area));                                      enum glyph_row_area area));
2271    
2272    #ifdef HAVE_WINDOW_SYSTEM
2273    
2274      /* Draw a fringe bitmap in window W of row ROW using parameters P.  */
2275      void (*draw_fringe_bitmap) P_ ((struct window *w, struct glyph_row *row,
2276                                      struct draw_fringe_bitmap_params *p));
2277    
2278    /* Get metrics of character CHAR2B in FONT of type FONT_TYPE.
2279       Value is null if CHAR2B is not contained in the font.  */
2280      XCharStruct * (*per_char_metric) P_ ((XFontStruct *font, XChar2b *char2b,
2281                                            int font_type));
2282    
2283    /* Encode CHAR2B using encoding information from FONT_INFO.  CHAR2B is
2284       the two-byte form of C.  Encoding is returned in *CHAR2B.  If
2285       TWO_BYTE_P is non-null, return non-zero there if font is two-byte.  */
2286      int (*encode_char) P_ ((int c, XChar2b *char2b,
2287                              struct font_info *font_into, int *two_byte_p));
2288    
2289    /* Compute left and right overhang of glyph string S.  
2290       A NULL pointer if platform does not support this. */
2291      void (*compute_glyph_string_overhangs) P_ ((struct glyph_string *s));
2292    
2293    /* Draw a glyph string S.  */
2294      void (*draw_glyph_string) P_ ((struct glyph_string *s));
2295    
2296    /* Define cursor CURSOR on frame F.  */
2297      void (*define_frame_cursor) P_ ((struct frame *f, Cursor cursor));
2298    
2299    /* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F.  */
2300      void (*clear_frame_area) P_ ((struct frame *f, int x, int y,
2301                                    int width, int height));
2302    
2303    /* Draw specified cursor CURSOR_TYPE of width CURSOR_WIDTH
2304       at row GLYPH_ROW on window W if ON_P is 1.  If ON_P is
2305       0, don't draw cursor.  If ACTIVE_P is 1, system caret
2306       should track this cursor (when applicable).  */
2307      void (*draw_window_cursor) P_ ((struct window *w,
2308                                      struct glyph_row *glyph_row,
2309                                      int x, int y,
2310                                      int cursor_type, int cursor_width,
2311                                      int on_p, int active_p));
2312    
2313    /* Draw vertical border for window W from (X,Y0) to (X,Y1).  */
2314      void (*draw_vertical_window_border) P_ ((struct window *w,
2315                                               int x, int y0, int y1));
2316    
2317    /* Shift display of frame F to make room for inserted glyphs.
2318       The area at pixel (X,Y) of width WIDTH and height HEIGHT is
2319       shifted right by SHIFT_BY pixels.  */
2320      void (*shift_glyphs_for_insert) P_ ((struct frame *f,
2321                                           int x, int y, int width,
2322                                           int height, int shift_by));
2323    
2324    #endif /* HAVE_WINDOW_SYSTEM */
2325  };  };
2326    
2327  /* The current interface for window-based redisplay.  */  /* The current interface for window-based redisplay.  */
2328    
2329  extern struct redisplay_interface *rif;  extern struct redisplay_interface *rif;
2330    
 /* Hook to call in estimate_mode_line_height.  */  
   
 extern int (* estimate_mode_line_height_hook) P_ ((struct frame *,  
                                                    enum face_id));  
   
2331    
2332  /***********************************************************************  /***********************************************************************
2333                                  Images                                  Images
# Line 2178  enum tool_bar_item_image Line 2540  enum tool_bar_item_image
2540    TOOL_BAR_IMAGE_DISABLED_DESELECTED    TOOL_BAR_IMAGE_DISABLED_DESELECTED
2541  };  };
2542    
 /* Non-zero means raise tool-bar buttons when the mouse moves over them.  */  
   
 extern int auto_raise_tool_bar_buttons_p;  
   
2543  /* Margin around tool-bar buttons in pixels.  */  /* Margin around tool-bar buttons in pixels.  */
2544    
2545  extern Lisp_Object Vtool_bar_button_margin;  extern Lisp_Object Vtool_bar_button_margin;
# Line 2239  int window_box_width P_ ((struct window Line 2597  int window_box_width P_ ((struct window
2597  int window_box_left P_ ((struct window *, int));  int window_box_left P_ ((struct window *, int));
2598  int window_box_right P_ ((struct window *, int));  int window_box_right P_ ((struct window *, int));
2599  void window_box_edges P_ ((struct window *, int, int *, int *, int *, int *));  void window_box_edges P_ ((struct window *, int, int *, int *, int *, int *));
2600    int estimate_mode_line_height P_ ((struct frame *, enum face_id));
2601    void pixel_to_glyph_coords P_ ((struct frame *, int, int, int *, int *,
2602                                    NativeRectangle *, int));
2603    int glyph_to_pixel_coords P_ ((struct window *, int, int, int *, int *));
2604  void mark_window_display_accurate P_ ((Lisp_Object, int));  void mark_window_display_accurate P_ ((Lisp_Object, int));
2605  void redisplay_preserve_echo_area P_ ((int));  void redisplay_preserve_echo_area P_ ((int));
2606  void set_cursor_from_row P_ ((struct window *, struct glyph_row *,  void set_cursor_from_row P_ ((struct window *, struct glyph_row *,
# Line 2257  void move_it_vertically P_ ((struct it * Line 2619  void move_it_vertically P_ ((struct it *
2619  void move_it_vertically_backward P_ ((struct it *, int));  void move_it_vertically_backward P_ ((struct it *, int));
2620  void move_it_by_lines P_ ((struct it *, int, int));  void move_it_by_lines P_ ((struct it *, int, int));
2621  void move_it_past_eol P_ ((struct it *));  void move_it_past_eol P_ ((struct it *));
2622    int in_display_vector_p P_ ((struct it *));
2623  int frame_mode_line_height P_ ((struct frame *));  int frame_mode_line_height P_ ((struct frame *));
2624  void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *));  void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *));
2625  int tool_bar_item_info P_ ((struct frame *, struct glyph *, int *));  void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *));
2626    void compute_fringe_widths P_ ((struct frame *, int));
2627  extern Lisp_Object Qtool_bar;  extern Lisp_Object Qtool_bar;
2628  extern Lisp_Object Vshow_trailing_whitespace;  extern Lisp_Object Vshow_trailing_whitespace;
2629  extern int mode_line_in_non_selected_windows;  extern int mode_line_in_non_selected_windows;
# Line 2268  extern Lisp_Object Vimage_types; Line 2632  extern Lisp_Object Vimage_types;
2632  extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));  extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));
2633  extern int help_echo_showing_p;  extern int help_echo_showing_p;
2634  extern int current_mode_line_height, current_header_line_height;  extern int current_mode_line_height, current_header_line_height;
2635  extern int cursor_in_non_selected_windows;  extern Lisp_Object help_echo_string, help_echo_window;
2636    extern Lisp_Object help_echo_object, previous_help_echo_string;
2637    extern int help_echo_pos;
2638    extern struct frame *last_mouse_frame;
2639    extern int last_tool_bar_item;
2640    extern int mouse_autoselect_window;
2641    
2642    #ifdef HAVE_WINDOW_SYSTEM
2643    
2644    #if GLYPH_DEBUG
2645    extern void dump_glyph_string P_ ((struct glyph_string *));
2646    #endif
2647    
2648    extern void x_get_glyph_overhangs P_ ((struct glyph *, struct frame *,
2649                                           int *, int *));
2650    extern void x_produce_glyphs P_ ((struct it *));
2651    
2652    extern void x_write_glyphs P_ ((struct glyph *, int));
2653    extern void x_insert_glyphs P_ ((struct glyph *, int len));
2654    extern void x_clear_end_of_line P_ ((int));
2655    
2656    extern int x_stretch_cursor_p;
2657    extern struct cursor_pos output_cursor;
2658    
2659    extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *,
2660                                            enum glyph_row_area));
2661    extern void draw_phys_cursor_glyph P_ ((struct window *,
2662                                              struct glyph_row *,
2663                                              enum draw_glyphs_face));
2664    extern void erase_phys_cursor P_ ((struct window *));
2665    extern void display_and_set_cursor P_ ((struct window *,
2666                                              int, int, int, int, int));
2667    
2668    extern void set_output_cursor P_ ((struct cursor_pos *));
2669    extern void x_cursor_to P_ ((int, int, int, int));
2670    
2671    extern void x_update_cursor P_ ((struct frame *, int));
2672    extern void x_clear_cursor P_ ((struct window *));
2673    extern void x_draw_vertical_border P_ ((struct window *w));
2674    
2675    extern void frame_to_window_pixel_xy P_ ((struct window *, int *, int *));
2676    extern void get_glyph_string_clip_rect P_ ((struct glyph_string *,
2677                                                NativeRectangle *nr));
2678    extern void note_mouse_highlight P_ ((struct frame *, int, int));
2679    extern void x_clear_window_mouse_face P_ ((struct window *));
2680    extern void cancel_mouse_face P_ ((struct frame *));
2681    
2682    extern void handle_tool_bar_click P_ ((struct frame *,
2683                                           int, int, int, unsigned int));
2684    
2685    /* msdos.c defines its own versions of these functions. */
2686    extern int clear_mouse_face P_ ((Display_Info *));
2687    extern void show_mouse_face P_ ((Display_Info *, enum draw_glyphs_face));
2688    extern int cursor_in_mouse_face_p P_ ((struct window *w));
2689    
2690    extern void expose_frame P_ ((struct frame *, int, int, int, int));
2691    extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *,
2692                                           XRectangle *));
2693    #endif
2694    
2695  /* Defined in sysdep.c */  /* Defined in sysdep.c */
2696    
# Line 2295  void unload_color P_ ((struct frame *, u Line 2717  void unload_color P_ ((struct frame *, u
2717  int frame_update_line_height P_ ((struct frame *));  int frame_update_line_height P_ ((struct frame *));
2718  int ascii_face_of_lisp_face P_ ((struct frame *, int));  int ascii_face_of_lisp_face P_ ((struct frame *, int));
2719  void prepare_face_for_display P_ ((struct frame *, struct face *));  void prepare_face_for_display P_ ((struct frame *, struct face *));
2720  int xstricmp P_ ((unsigned char *, unsigned char *));  int xstricmp P_ ((const unsigned char *, const unsigned char *));
2721  int lookup_face P_ ((struct frame *, Lisp_Object *, int, struct face *));  int lookup_face P_ ((struct frame *, Lisp_Object *, int, struct face *));
2722  int lookup_named_face P_ ((struct frame *, Lisp_Object, int));  int lookup_named_face P_ ((struct frame *, Lisp_Object, int));
2723  int smaller_face P_ ((struct frame *, int, int));  int smaller_face P_ ((struct frame *, int, int));
# Line 2382  int popup_activated P_ ((void)); Line 2804  int popup_activated P_ ((void));
2804  extern int inverse_video;  extern int inverse_video;
2805  extern int required_matrix_width P_ ((struct window *));  extern int required_matrix_width P_ ((struct window *));
2806  extern int required_matrix_height P_ ((struct window *));  extern int required_matrix_height P_ ((struct window *));
2807  extern int estimate_mode_line_height P_ ((struct frame *, enum face_id));  extern Lisp_Object mode_line_string P_ ((struct window *, int, int,
2808  extern Lisp_Object mode_line_string P_ ((struct window *, int, int, int, int *));                                           enum window_part, int *));
2809  extern Lisp_Object marginal_area_string P_ ((struct window *, int, int, int, int *));  extern Lisp_Object marginal_area_string P_ ((struct window *, int, int,
2810                                                 enum window_part, int *));
2811  extern void redraw_frame P_ ((struct frame *));  extern void redraw_frame P_ ((struct frame *));
2812  extern void redraw_garbaged_frames P_ ((void));  extern void redraw_garbaged_frames P_ ((void));
2813  extern void cancel_line P_ ((int, struct frame *));  extern void cancel_line P_ ((int, struct frame *));
# Line 2472  extern void do_line_insertion_deletion_c Line 2895  extern void do_line_insertion_deletion_c
2895  void scrolling_1 P_ ((struct frame *, int, int, int, int *, int *, int *,  void scrolling_1 P_ ((struct frame *, int, int, int, int *, int *, int *,
2896                        int *, int));                        int *, int));
2897    
2898    /* Defined in frame.c */
2899    
2900    #ifdef HAVE_WINDOW_SYSTEM
2901    
2902    /* Types we might convert a resource string into.  */
2903    enum resource_types
2904    {
2905      RES_TYPE_NUMBER,
2906      RES_TYPE_FLOAT,
2907      RES_TYPE_BOOLEAN,
2908      RES_TYPE_STRING,
2909      RES_TYPE_SYMBOL
2910    };
2911    
2912    extern Lisp_Object x_get_arg P_ ((Display_Info *, Lisp_Object,
2913                                      Lisp_Object, char *, char *class,
2914                                      enum resource_types));
2915    extern Lisp_Object x_frame_get_arg P_ ((struct frame *, Lisp_Object,
2916                                            Lisp_Object, char *, char *,
2917                                            enum resource_types));
2918    extern Lisp_Object x_frame_get_and_record_arg P_ ((
2919                                            struct frame *, Lisp_Object,
2920                                            Lisp_Object, char *, char *,
2921                                            enum resource_types));
2922    extern Lisp_Object x_default_parameter P_ ((struct frame *, Lisp_Object,
2923                                                Lisp_Object, Lisp_Object,
2924                                                char *, char *,
2925                                                enum resource_types));
2926    
2927    #endif /* HAVE_WINDOW_SYSTEM */
2928    
2929  #endif /* not DISPEXTERN_H_INCLUDED */  #endif /* not DISPEXTERN_H_INCLUDED */

Legend:
Removed from v.1.136  
changed lines
  Added in v.1.136.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26