comparison src/dispextern.h @ 49600:23a1cea22d13

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 14:56:31 +0000
parents d4986198a59a
children c3d892afbca5 d7ddb3e565de
comparison
equal deleted inserted replaced
49599:5ade352e8d1c 49600:23a1cea22d13
110 110
111 #define TRACE(X) (void) 0 111 #define TRACE(X) (void) 0
112 112
113 #endif /* GLYPH_DEBUG == 0 */ 113 #endif /* GLYPH_DEBUG == 0 */
114 114
115 115
116 116
117 /*********************************************************************** 117 /***********************************************************************
118 Text positions 118 Text positions
119 ***********************************************************************/ 119 ***********************************************************************/
120 120
121 /* Starting with Emacs 20.3, characters from strings and buffers have 121 /* Starting with Emacs 20.3, characters from strings and buffers have
122 both a character and a byte position associated with them. The 122 both a character and a byte position associated with them. The
123 following structure holds such a pair of positions. */ 123 following structure holds such a pair of positions. */
124 124
125 struct text_pos 125 struct text_pos
126 { 126 {
127 /* Character position. */ 127 /* Character position. */
128 int charpos; 128 int charpos;
129 129
175 175
176 /* Set marker MARKER from text position POS. */ 176 /* Set marker MARKER from text position POS. */
177 177
178 #define SET_MARKER_FROM_TEXT_POS(MARKER, POS) \ 178 #define SET_MARKER_FROM_TEXT_POS(MARKER, POS) \
179 set_marker_both ((MARKER), Qnil, CHARPOS ((POS)), BYTEPOS ((POS))) 179 set_marker_both ((MARKER), Qnil, CHARPOS ((POS)), BYTEPOS ((POS)))
180 180
181 /* Value is non-zero if character and byte positions of POS1 and POS2 181 /* Value is non-zero if character and byte positions of POS1 and POS2
182 are equal. */ 182 are equal. */
183 183
184 #define TEXT_POS_EQUAL_P(POS1, POS2) \ 184 #define TEXT_POS_EQUAL_P(POS1, POS2) \
185 ((POS1).charpos == (POS2).charpos \ 185 ((POS1).charpos == (POS2).charpos \
222 containing one of the enumerators defined here. */ 222 containing one of the enumerators defined here. */
223 223
224 enum glyph_type 224 enum glyph_type
225 { 225 {
226 /* Glyph describes a character. */ 226 /* Glyph describes a character. */
227 CHAR_GLYPH, 227 CHAR_GLYPH,
228 228
229 /* Glyph describes a composition sequence. */ 229 /* Glyph describes a composition sequence. */
230 COMPOSITE_GLYPH, 230 COMPOSITE_GLYPH,
231 231
232 /* Glyph describes an image. */ 232 /* Glyph describes an image. */
253 together with a null object means glyph is a truncation glyph at 253 together with a null object means glyph is a truncation glyph at
254 the start of a row. */ 254 the start of a row. */
255 int charpos; 255 int charpos;
256 256
257 /* Lisp object source of this glyph. Currently either a buffer or 257 /* Lisp object source of this glyph. Currently either a buffer or
258 a string, if the glyph was produced from characters which came from 258 a string, if the glyph was produced from characters which came from
259 a buffer or a string; or 0 if the glyph was inserted by redisplay 259 a buffer or a string; or 0 if the glyph was inserted by redisplay
260 for its own purposes such as padding. */ 260 for its own purposes such as padding. */
261 Lisp_Object object; 261 Lisp_Object object;
262 262
263 /* Width in pixels. */ 263 /* Width in pixels. */
332 332
333 /* The ascent of the glyph. */ 333 /* The ascent of the glyph. */
334 unsigned ascent : 16; 334 unsigned ascent : 16;
335 } 335 }
336 stretch; 336 stretch;
337 337
338 /* Used to compare all bit-fields above in one step. */ 338 /* Used to compare all bit-fields above in one step. */
339 unsigned val; 339 unsigned val;
340 } u; 340 } u;
341 }; 341 };
342 342
345 345
346 #define CHAR_GLYPH_SPACE_P(GLYPH) \ 346 #define CHAR_GLYPH_SPACE_P(GLYPH) \
347 (GLYPH_FROM_CHAR_GLYPH ((GLYPH)) == SPACEGLYPH) 347 (GLYPH_FROM_CHAR_GLYPH ((GLYPH)) == SPACEGLYPH)
348 348
349 /* Are glyphs *X and *Y displayed equal? */ 349 /* Are glyphs *X and *Y displayed equal? */
350 350
351 #define GLYPH_EQUAL_P(X, Y) \ 351 #define GLYPH_EQUAL_P(X, Y) \
352 ((X)->type == (Y)->type \ 352 ((X)->type == (Y)->type \
353 && (X)->u.val == (Y)->u.val \ 353 && (X)->u.val == (Y)->u.val \
354 && (X)->face_id == (Y)->face_id \ 354 && (X)->face_id == (Y)->face_id \
355 && (X)->padding_p == (Y)->padding_p \ 355 && (X)->padding_p == (Y)->padding_p \
365 && (X)->face_id == (Y)->face_id \ 365 && (X)->face_id == (Y)->face_id \
366 && (X)->padding_p == (Y)->padding_p) 366 && (X)->padding_p == (Y)->padding_p)
367 367
368 /* Fill a character glyph GLYPH. CODE, FACE_ID, PADDING_P correspond 368 /* Fill a character glyph GLYPH. CODE, FACE_ID, PADDING_P correspond
369 to the bits defined for the typedef `GLYPH' in lisp.h. */ 369 to the bits defined for the typedef `GLYPH' in lisp.h. */
370 370
371 #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P) \ 371 #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P) \
372 do \ 372 do \
373 { \ 373 { \
374 (GLYPH).u.ch = (CODE); \ 374 (GLYPH).u.ch = (CODE); \
375 (GLYPH).face_id = (FACE_ID); \ 375 (GLYPH).face_id = (FACE_ID); \
377 } \ 377 } \
378 while (0) 378 while (0)
379 379
380 /* Fill a character type glyph GLYPH from a glyph typedef FROM as 380 /* Fill a character type glyph GLYPH from a glyph typedef FROM as
381 defined in lisp.h. */ 381 defined in lisp.h. */
382 382
383 #define SET_CHAR_GLYPH_FROM_GLYPH(GLYPH, FROM) \ 383 #define SET_CHAR_GLYPH_FROM_GLYPH(GLYPH, FROM) \
384 SET_CHAR_GLYPH ((GLYPH), \ 384 SET_CHAR_GLYPH ((GLYPH), \
385 FAST_GLYPH_CHAR ((FROM)), \ 385 FAST_GLYPH_CHAR ((FROM)), \
386 FAST_GLYPH_FACE ((FROM)), \ 386 FAST_GLYPH_FACE ((FROM)), \
387 0) 387 0)
388 388
389 /* Construct a glyph code from a character glyph GLYPH. If the 389 /* Construct a glyph code from a character glyph GLYPH. If the
390 character is multibyte, return -1 as we can't use glyph table for a 390 character is multibyte, return -1 as we can't use glyph table for a
391 multibyte character. */ 391 multibyte character. */
392 392
393 #define GLYPH_FROM_CHAR_GLYPH(GLYPH) \ 393 #define GLYPH_FROM_CHAR_GLYPH(GLYPH) \
394 ((GLYPH).u.ch < 256 \ 394 ((GLYPH).u.ch < 256 \
395 ? ((GLYPH).u.ch | ((GLYPH).face_id << CHARACTERBITS)) \ 395 ? ((GLYPH).u.ch | ((GLYPH).face_id << CHARACTERBITS)) \
396 : -1) 396 : -1)
397 397
398 /* Is GLYPH a padding glyph? */ 398 /* Is GLYPH a padding glyph? */
399 399
400 #define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p 400 #define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p
401 401
402 402
403 403
404 404
555 555
556 /* Rows of glyphs in a windows or frame glyph matrix. 556 /* Rows of glyphs in a windows or frame glyph matrix.
557 557
558 Each row is partitioned into three areas. The start and end of 558 Each row is partitioned into three areas. The start and end of
559 each area is recorded in a pointer as shown below. 559 each area is recorded in a pointer as shown below.
560 560
561 +--------------------+-------------+---------------------+ 561 +--------------------+-------------+---------------------+
562 | left margin area | text area | right margin area | 562 | left margin area | text area | right margin area |
563 +--------------------+-------------+---------------------+ 563 +--------------------+-------------+---------------------+
564 | | | | 564 | | | |
565 glyphs[LEFT_MARGIN_AREA] glyphs[RIGHT_MARGIN_AREA] 565 glyphs[LEFT_MARGIN_AREA] glyphs[RIGHT_MARGIN_AREA]
566 | | 566 | |
567 glyphs[TEXT_AREA] | 567 glyphs[TEXT_AREA] |
568 glyphs[LAST_AREA] 568 glyphs[LAST_AREA]
569 569
570 Rows in frame matrices reference glyph memory allocated in a frame 570 Rows in frame matrices reference glyph memory allocated in a frame
571 glyph pool (see the description of struct glyph_pool). Rows in 571 glyph pool (see the description of struct glyph_pool). Rows in
572 window matrices on frames having frame matrices reference slices of 572 window matrices on frames having frame matrices reference slices of
573 the glyphs of corresponding rows in the frame matrix. 573 the glyphs of corresponding rows in the frame matrix.
574 574
575 Rows in window matrices on frames having no frame matrices point to 575 Rows in window matrices on frames having no frame matrices point to
576 glyphs allocated from the heap via xmalloc; 576 glyphs allocated from the heap via xmalloc;
577 glyphs[LEFT_MARGIN_AREA] is the start address of the allocated 577 glyphs[LEFT_MARGIN_AREA] is the start address of the allocated
578 glyph structure array. */ 578 glyph structure array. */
579 579
653 unsigned truncated_on_left_p : 1; 653 unsigned truncated_on_left_p : 1;
654 unsigned truncated_on_right_p : 1; 654 unsigned truncated_on_right_p : 1;
655 655
656 /* 1 means the overlay arrow is on this line. */ 656 /* 1 means the overlay arrow is on this line. */
657 unsigned overlay_arrow_p : 1; 657 unsigned overlay_arrow_p : 1;
658 658
659 /* 1 means that this row displays a continued line, i.e. it has a 659 /* 1 means that this row displays a continued line, i.e. it has a
660 continuation mark at the right side. */ 660 continuation mark at the right side. */
661 unsigned continued_p : 1; 661 unsigned continued_p : 1;
662 662
663 /* 0 means that this row does not contain any text, i.e. it is 663 /* 0 means that this row does not contain any text, i.e. it is
693 693
694 /* 1 means this line ends in the middle of a character consisting 694 /* 1 means this line ends in the middle of a character consisting
695 of more than one glyph. Some glyphs have been put in this row, 695 of more than one glyph. Some glyphs have been put in this row,
696 the rest are put in rows below this one. */ 696 the rest are put in rows below this one. */
697 unsigned ends_in_middle_of_char_p : 1; 697 unsigned ends_in_middle_of_char_p : 1;
698 698
699 /* 1 means this line starts in the middle of a character consisting 699 /* 1 means this line starts in the middle of a character consisting
700 of more than one glyph. Some glyphs have been put in the 700 of more than one glyph. Some glyphs have been put in the
701 previous row, the rest are put in this row. */ 701 previous row, the rest are put in this row. */
702 unsigned starts_in_middle_of_char_p : 1; 702 unsigned starts_in_middle_of_char_p : 1;
703 703
724 #define MATRIX_ROW(MATRIX, ROW) matrix_row ((MATRIX), (ROW)) 724 #define MATRIX_ROW(MATRIX, ROW) matrix_row ((MATRIX), (ROW))
725 #else 725 #else
726 #define MATRIX_ROW(MATRIX, ROW) ((MATRIX)->rows + (ROW)) 726 #define MATRIX_ROW(MATRIX, ROW) ((MATRIX)->rows + (ROW))
727 #endif 727 #endif
728 728
729 /* Return a pointer to the row reserved for the mode line in MATRIX. 729 /* Return a pointer to the row reserved for the mode line in MATRIX.
730 Row MATRIX->nrows - 1 is always reserved for the mode line. */ 730 Row MATRIX->nrows - 1 is always reserved for the mode line. */
731 731
732 #define MATRIX_MODE_LINE_ROW(MATRIX) \ 732 #define MATRIX_MODE_LINE_ROW(MATRIX) \
733 ((MATRIX)->rows + (MATRIX)->nrows - 1) 733 ((MATRIX)->rows + (MATRIX)->nrows - 1)
734 734
749 749
750 #define MATRIX_ROW_GLYPH_START(MATRIX, ROW) \ 750 #define MATRIX_ROW_GLYPH_START(MATRIX, ROW) \
751 (MATRIX_ROW ((MATRIX), (ROW))->glyphs[TEXT_AREA]) 751 (MATRIX_ROW ((MATRIX), (ROW))->glyphs[TEXT_AREA])
752 752
753 /* Return the number of used glyphs in the text area of a row. */ 753 /* Return the number of used glyphs in the text area of a row. */
754 754
755 #define MATRIX_ROW_USED(MATRIX, ROW) \ 755 #define MATRIX_ROW_USED(MATRIX, ROW) \
756 (MATRIX_ROW ((MATRIX), (ROW))->used[TEXT_AREA]) 756 (MATRIX_ROW ((MATRIX), (ROW))->used[TEXT_AREA])
757 757
758 /* Return the character/ byte position at which the display of ROW 758 /* Return the character/ byte position at which the display of ROW
759 starts. */ 759 starts. */
760 760
761 #define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->start.pos.charpos) 761 #define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->start.pos.charpos)
762 #define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->start.pos.bytepos) 762 #define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->start.pos.bytepos)
763 763
764 /* Return the character/ byte position at which ROW ends. */ 764 /* Return the character/ byte position at which ROW ends. */
765 765
766 #define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->end.pos.charpos) 766 #define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->end.pos.charpos)
767 #define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->end.pos.bytepos) 767 #define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->end.pos.bytepos)
768 768
769 /* Return the vertical position of ROW in MATRIX. */ 769 /* Return the vertical position of ROW in MATRIX. */
770 770
771 #define MATRIX_ROW_VPOS(ROW, MATRIX) ((ROW) - (MATRIX)->rows) 771 #define MATRIX_ROW_VPOS(ROW, MATRIX) ((ROW) - (MATRIX)->rows)
772 772
773 /* Return the last glyph row + 1 in MATRIX on window W reserved for 773 /* Return the last glyph row + 1 in MATRIX on window W reserved for
774 text. If W has a mode line, the last row in the matrix is reserved 774 text. If W has a mode line, the last row in the matrix is reserved
775 for it. */ 775 for it. */
776 776
777 #define MATRIX_BOTTOM_TEXT_ROW(MATRIX, W) \ 777 #define MATRIX_BOTTOM_TEXT_ROW(MATRIX, W) \
778 ((MATRIX)->rows \ 778 ((MATRIX)->rows \
779 + (MATRIX)->nrows \ 779 + (MATRIX)->nrows \
780 - (WINDOW_WANTS_MODELINE_P ((W)) ? 1 : 0)) 780 - (WINDOW_WANTS_MODELINE_P ((W)) ? 1 : 0))
781 781
782 /* Non-zero if the face of the last glyph in ROW's text area has 782 /* Non-zero if the face of the last glyph in ROW's text area has
783 to be drawn to the end of the text area. */ 783 to be drawn to the end of the text area. */
784 784
785 #define MATRIX_ROW_EXTENDS_FACE_P(ROW) ((ROW)->fill_line_p) 785 #define MATRIX_ROW_EXTENDS_FACE_P(ROW) ((ROW)->fill_line_p)
786 786
787 /* Set and query the enabled_p flag of glyph row ROW in MATRIX. */ 787 /* Set and query the enabled_p flag of glyph row ROW in MATRIX. */
788 788
789 #define SET_MATRIX_ROW_ENABLED_P(MATRIX, ROW, VALUE) \ 789 #define SET_MATRIX_ROW_ENABLED_P(MATRIX, ROW, VALUE) \
790 (MATRIX_ROW ((MATRIX), (ROW))->enabled_p = (VALUE) != 0) 790 (MATRIX_ROW ((MATRIX), (ROW))->enabled_p = (VALUE) != 0)
791 791
792 #define MATRIX_ROW_ENABLED_P(MATRIX, ROW) \ 792 #define MATRIX_ROW_ENABLED_P(MATRIX, ROW) \
793 (MATRIX_ROW ((MATRIX), (ROW))->enabled_p) 793 (MATRIX_ROW ((MATRIX), (ROW))->enabled_p)
794 794
795 /* Non-zero if ROW displays text. Value is non-zero if the row is 795 /* Non-zero if ROW displays text. Value is non-zero if the row is
796 blank but displays a line end. */ 796 blank but displays a line end. */
797 797
798 #define MATRIX_ROW_DISPLAYS_TEXT_P(ROW) ((ROW)->displays_text_p) 798 #define MATRIX_ROW_DISPLAYS_TEXT_P(ROW) ((ROW)->displays_text_p)
799 799
800 /* Non-zero if ROW is not completely visible in window W. */ 800 /* Non-zero if ROW is not completely visible in window W. */
801 801
802 #define MATRIX_ROW_PARTIALLY_VISIBLE_P(ROW) \ 802 #define MATRIX_ROW_PARTIALLY_VISIBLE_P(ROW) \
803 ((ROW)->height != (ROW)->visible_height) 803 ((ROW)->height != (ROW)->visible_height)
804 804
805 /* Non-zero if ROW is partially visible at the top of window W. */ 805 /* Non-zero if ROW is partially visible at the top of window W. */
806 806
807 #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW) \ 807 #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW) \
808 (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \ 808 (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \
809 && (ROW)->y < WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W))) 809 && (ROW)->y < WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
810 810
811 /* Non-zero if ROW is partially visible at the bottom of window W. */ 811 /* Non-zero if ROW is partially visible at the bottom of window W. */
812 812
813 #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW) \ 813 #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW) \
814 (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \ 814 (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \
815 && (ROW)->y + (ROW)->height > WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE ((W))) 815 && (ROW)->y + (ROW)->height > WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE ((W)))
816 816
817 /* Return the bottom Y + 1 of ROW. */ 817 /* Return the bottom Y + 1 of ROW. */
818 818
819 #define MATRIX_ROW_BOTTOM_Y(ROW) ((ROW)->y + (ROW)->height) 819 #define MATRIX_ROW_BOTTOM_Y(ROW) ((ROW)->y + (ROW)->height)
820 820
821 /* Is ROW the last visible one in the display described by the 821 /* Is ROW the last visible one in the display described by the
822 iterator structure pointed to by IT?. */ 822 iterator structure pointed to by IT?. */
823 823
824 #define MATRIX_ROW_LAST_VISIBLE_P(ROW, IT) \ 824 #define MATRIX_ROW_LAST_VISIBLE_P(ROW, IT) \
825 (MATRIX_ROW_BOTTOM_Y ((ROW)) >= (IT)->last_visible_y) 825 (MATRIX_ROW_BOTTOM_Y ((ROW)) >= (IT)->last_visible_y)
826 826
827 /* Non-zero if ROW displays a continuation line. */ 827 /* Non-zero if ROW displays a continuation line. */
828 828
842 842
843 #define MATRIX_ROW_ENDS_IN_OVERLAY_STRING_P(ROW) \ 843 #define MATRIX_ROW_ENDS_IN_OVERLAY_STRING_P(ROW) \
844 ((ROW)->end.overlay_string_index >= 0) 844 ((ROW)->end.overlay_string_index >= 0)
845 845
846 /* Non-zero if ROW starts in the middle of a character. See above. */ 846 /* Non-zero if ROW starts in the middle of a character. See above. */
847 847
848 #define MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P(ROW) \ 848 #define MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P(ROW) \
849 ((ROW)->start.dpvec_index >= 0 \ 849 ((ROW)->start.dpvec_index >= 0 \
850 || (ROW)->starts_in_middle_of_char_p \ 850 || (ROW)->starts_in_middle_of_char_p \
851 || ((ROW)->start.overlay_string_index >= 0 \ 851 || ((ROW)->start.overlay_string_index >= 0 \
852 && (ROW)->start.string_pos.charpos > 0)) 852 && (ROW)->start.string_pos.charpos > 0))
1014 - FRAME_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME ((W)))) \ 1014 - FRAME_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME ((W)))) \
1015 - FRAME_FRINGE_COLS (XFRAME (WINDOW_FRAME ((W))))) \ 1015 - FRAME_FRINGE_COLS (XFRAME (WINDOW_FRAME ((W))))) \
1016 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W)))))) 1016 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1017 1017
1018 /* Height of the display region of W, including a mode line, if any. */ 1018 /* Height of the display region of W, including a mode line, if any. */
1019 1019
1020 #define WINDOW_DISPLAY_PIXEL_HEIGHT(W) \ 1020 #define WINDOW_DISPLAY_PIXEL_HEIGHT(W) \
1021 (XFASTINT ((W)->height) \ 1021 (XFASTINT ((W)->height) \
1022 * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W))))) 1022 * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W)))))
1023 1023
1024 /* Height in pixels of the mode line. May be zero if W doesn't have a 1024 /* Height in pixels of the mode line. May be zero if W doesn't have a
1025 mode line. */ 1025 mode line. */
1026 1026
1027 #define WINDOW_DISPLAY_MODE_LINE_HEIGHT(W) \ 1027 #define WINDOW_DISPLAY_MODE_LINE_HEIGHT(W) \
1028 (WINDOW_WANTS_MODELINE_P ((W)) \ 1028 (WINDOW_WANTS_MODELINE_P ((W)) \
1029 ? CURRENT_MODE_LINE_HEIGHT (W) \ 1029 ? CURRENT_MODE_LINE_HEIGHT (W) \
1030 : 0) 1030 : 0)
1031 1031
1032 /* Height in pixels of the header line. Zero if W doesn't have a header 1032 /* Height in pixels of the header line. Zero if W doesn't have a header
1033 line. */ 1033 line. */
1034 1034
1035 #define WINDOW_DISPLAY_HEADER_LINE_HEIGHT(W) \ 1035 #define WINDOW_DISPLAY_HEADER_LINE_HEIGHT(W) \
1036 (WINDOW_WANTS_HEADER_LINE_P ((W)) \ 1036 (WINDOW_WANTS_HEADER_LINE_P ((W)) \
1037 ? CURRENT_HEADER_LINE_HEIGHT (W) \ 1037 ? CURRENT_HEADER_LINE_HEIGHT (W) \
1038 : 0) 1038 : 0)
1039 1039
1040 /* Pixel height of window W without mode line. */ 1040 /* Pixel height of window W without mode line. */
1041 1041
1042 #define WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE(W) \ 1042 #define WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE(W) \
1043 (WINDOW_DISPLAY_PIXEL_HEIGHT ((W)) \ 1043 (WINDOW_DISPLAY_PIXEL_HEIGHT ((W)) \
1044 - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W))) 1044 - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)))
1045 1045
1046 /* Pixel height of window W without mode and header line. */ 1046 /* Pixel height of window W without mode and header line. */
1047 1047
1048 #define WINDOW_DISPLAY_TEXT_HEIGHT(W) \ 1048 #define WINDOW_DISPLAY_TEXT_HEIGHT(W) \
1049 (WINDOW_DISPLAY_PIXEL_HEIGHT ((W)) \ 1049 (WINDOW_DISPLAY_PIXEL_HEIGHT ((W)) \
1050 - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)) \ 1050 - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)) \
1051 - WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W))) 1051 - WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
1052 1052
1053 /* Left edge of W in pixels relative to its frame. */ 1053 /* Left edge of W in pixels relative to its frame. */
1054 1054
1055 #define WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X(W) \ 1055 #define WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X(W) \
1056 (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W)))) \ 1056 (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W)))) \
1057 + (WINDOW_LEFT_MARGIN ((W)) \ 1057 + (WINDOW_LEFT_MARGIN ((W)) \
1058 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))) \ 1058 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))) \
1059 + FRAME_LEFT_FRINGE_WIDTH (XFRAME (WINDOW_FRAME ((W))))) 1059 + FRAME_LEFT_FRINGE_WIDTH (XFRAME (WINDOW_FRAME ((W)))))
1060 1060
1061 /* Right edge of window W in pixels, relative to its frame. */ 1061 /* Right edge of window W in pixels, relative to its frame. */
1062 1062
1063 #define WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X(W) \ 1063 #define WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X(W) \
1064 (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)) \ 1064 (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)) \
1065 + WINDOW_DISPLAY_PIXEL_WIDTH ((W))) 1065 + WINDOW_DISPLAY_PIXEL_WIDTH ((W)))
1066 1066
1067 /* Top edge of W in pixels relative to its frame. */ 1067 /* Top edge of W in pixels relative to its frame. */
1068 1068
1069 #define WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y(W) \ 1069 #define WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y(W) \
1070 (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W)))) \ 1070 (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W)))) \
1071 + (XFASTINT ((W)->top) \ 1071 + (XFASTINT ((W)->top) \
1072 * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W)))))) 1072 * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1073 1073
1074 /* Bottom edge of window W relative to its frame. */ 1074 /* Bottom edge of window W relative to its frame. */
1075 1075
1076 #define WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y(W) \ 1076 #define WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y(W) \
1077 (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)) \ 1077 (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)) \
1078 + WINDOW_DISPLAY_PIXEL_HEIGHT ((W))) 1078 + WINDOW_DISPLAY_PIXEL_HEIGHT ((W)))
1079 1079
1080 /* Convert window W relative pixel X to frame pixel coordinates. */ 1080 /* Convert window W relative pixel X to frame pixel coordinates. */
1081 1081
1082 #define WINDOW_TO_FRAME_PIXEL_X(W, X) \ 1082 #define WINDOW_TO_FRAME_PIXEL_X(W, X) \
1083 ((X) + WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W))) 1083 ((X) + WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
1084 1084
1085 /* Convert window W relative pixel Y to frame pixel coordinates. */ 1085 /* Convert window W relative pixel Y to frame pixel coordinates. */
1086 1086
1087 #define WINDOW_TO_FRAME_PIXEL_Y(W, Y) \ 1087 #define WINDOW_TO_FRAME_PIXEL_Y(W, Y) \
1088 ((Y) + WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W))) 1088 ((Y) + WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
1089 1089
1090 /* Convert frame relative pixel X to window relative pixel X. */ 1090 /* Convert frame relative pixel X to window relative pixel X. */
1091 1091
1092 #define FRAME_TO_WINDOW_PIXEL_X(W, X) \ 1092 #define FRAME_TO_WINDOW_PIXEL_X(W, X) \
1093 ((X) - WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W))) 1093 ((X) - WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
1094 1094
1095 /* Convert frame relative pixel Y to window relative pixel Y. */ 1095 /* Convert frame relative pixel Y to window relative pixel Y. */
1096 1096
1097 #define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \ 1097 #define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \
1098 ((Y) - WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W))) 1098 ((Y) - WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
1099 1099
1100 /* Width of left margin area in pixels. */ 1100 /* Width of left margin area in pixels. */
1101 1101
1102 #define WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH(W) \ 1102 #define WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH(W) \
1103 (NILP ((W)->left_margin_width) \ 1103 (NILP ((W)->left_margin_width) \
1104 ? 0 \ 1104 ? 0 \
1105 : (XINT ((W)->left_margin_width) \ 1105 : (XINT ((W)->left_margin_width) \
1106 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W)))))) 1106 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1107 1107
1108 /* Width of right marginal area in pixels. */ 1108 /* Width of right marginal area in pixels. */
1109 1109
1110 #define WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH(W) \ 1110 #define WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH(W) \
1111 (NILP ((W)->right_margin_width) \ 1111 (NILP ((W)->right_margin_width) \
1112 ? 0 \ 1112 ? 0 \
1113 : (XINT ((W)->right_margin_width) \ 1113 : (XINT ((W)->right_margin_width) \
1114 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W)))))) 1114 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1115 1115
1116 /* Width of text area in pixels. */ 1116 /* Width of text area in pixels. */
1117 1117
1118 #define WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH(W) \ 1118 #define WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH(W) \
1119 (WINDOW_DISPLAY_PIXEL_WIDTH ((W)) \ 1119 (WINDOW_DISPLAY_PIXEL_WIDTH ((W)) \
1120 - WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \ 1120 - WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \
1121 - WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W))) 1121 - WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W)))
1122 1122
1145 (((AREA) == TEXT_AREA) \ 1145 (((AREA) == TEXT_AREA) \
1146 ? WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH ((W)) \ 1146 ? WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH ((W)) \
1147 : (((AREA) == LEFT_MARGIN_AREA) \ 1147 : (((AREA) == LEFT_MARGIN_AREA) \
1148 ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \ 1148 ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \
1149 : WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W)))) 1149 : WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W))))
1150 1150
1151 /* Value is non-zero if window W wants a mode line. */ 1151 /* Value is non-zero if window W wants a mode line. */
1152 1152
1153 #define WINDOW_WANTS_MODELINE_P(W) \ 1153 #define WINDOW_WANTS_MODELINE_P(W) \
1154 (!MINI_WINDOW_P ((W)) \ 1154 (!MINI_WINDOW_P ((W)) \
1155 && !(W)->pseudo_window_p \ 1155 && !(W)->pseudo_window_p \
1166 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ 1166 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
1167 && BUFFERP ((W)->buffer) \ 1167 && BUFFERP ((W)->buffer) \
1168 && !NILP (XBUFFER ((W)->buffer)->header_line_format) \ 1168 && !NILP (XBUFFER ((W)->buffer)->header_line_format) \
1169 && XFASTINT ((W)->height) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format)) 1169 && XFASTINT ((W)->height) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format))
1170 1170
1171 1171
1172 /*********************************************************************** 1172 /***********************************************************************
1173 Faces 1173 Faces
1174 ***********************************************************************/ 1174 ***********************************************************************/
1175 1175
1176 /* Indices of face attributes in Lisp face vectors. Slot zero is the 1176 /* Indices of face attributes in Lisp face vectors. Slot zero is the
1177 symbol `face'. */ 1177 symbol `face'. */
1178 1178
1179 enum lface_attribute_index 1179 enum lface_attribute_index
1180 { 1180 {
1228 /* The id of this face. The id equals the index of this face in the 1228 /* The id of this face. The id equals the index of this face in the
1229 vector faces_by_id of its face cache. */ 1229 vector faces_by_id of its face cache. */
1230 int id; 1230 int id;
1231 1231
1232 #ifdef HAVE_WINDOW_SYSTEM 1232 #ifdef HAVE_WINDOW_SYSTEM
1233 1233
1234 /* If non-zero, this is a GC that we can use without modification for 1234 /* If non-zero, this is a GC that we can use without modification for
1235 drawing the characters in this face. */ 1235 drawing the characters in this face. */
1236 GC gc; 1236 GC gc;
1237 1237
1238 /* Font used for this face, or null if the font could not be loaded 1238 /* Font used for this face, or null if the font could not be loaded
1239 for some reason. This points to a `font' slot of a struct 1239 for some reason. This points to a `font' slot of a struct
1240 font_info, and we should not call XFreeFont on it because the 1240 font_info, and we should not call XFreeFont on it because the
1241 font may still be used somewhere else. */ 1241 font may still be used somewhere else. */
1242 XFontStruct *font; 1242 XFontStruct *font;
1253 #endif /* not HAVE_WINDOW_SYSTEM */ 1253 #endif /* not HAVE_WINDOW_SYSTEM */
1254 1254
1255 /* Pixel value of foreground color for X frames. Color index 1255 /* Pixel value of foreground color for X frames. Color index
1256 for tty frames. */ 1256 for tty frames. */
1257 unsigned long foreground; 1257 unsigned long foreground;
1258 1258
1259 /* Pixel value or color index of background color. */ 1259 /* Pixel value or color index of background color. */
1260 unsigned long background; 1260 unsigned long background;
1261 1261
1262 /* Pixel value or color index of underline color. */ 1262 /* Pixel value or color index of underline color. */
1263 unsigned long underline_color; 1263 unsigned long underline_color;
1281 /* Fontset ID if this face uses a fontset, or -1. This is only >= 0 1281 /* Fontset ID if this face uses a fontset, or -1. This is only >= 0
1282 if the face was realized for a composition sequence. 1282 if the face was realized for a composition sequence.
1283 Otherwise, a specific font is loaded from the set of fonts 1283 Otherwise, a specific font is loaded from the set of fonts
1284 specified by the fontset given by the family attribute of the face. */ 1284 specified by the fontset given by the family attribute of the face. */
1285 int fontset; 1285 int fontset;
1286 1286
1287 /* Pixmap width and height. */ 1287 /* Pixmap width and height. */
1288 unsigned int pixmap_w, pixmap_h; 1288 unsigned int pixmap_w, pixmap_h;
1289 1289
1290 /* Non-zero means characters in this face have a box that thickness 1290 /* Non-zero means characters in this face have a box that thickness
1291 around them. If it is negative, the absolute value indicates the 1291 around them. If it is negative, the absolute value indicates the
1292 thickness, and the horizontal lines of box (top and bottom) are 1292 thickness, and the horizontal lines of box (top and bottom) are
1293 drawn inside of characters glyph area. The vertical lines of box 1293 drawn inside of characters glyph area. The vertical lines of box
1294 (left and right) are drawn as the same way as the case that this 1294 (left and right) are drawn as the same way as the case that this
1333 unsigned background_defaulted_p : 1; 1333 unsigned background_defaulted_p : 1;
1334 1334
1335 /* 1 means that either no color is specified for underlining or that 1335 /* 1 means that either no color is specified for underlining or that
1336 the specified color couldn't be loaded. Use the foreground 1336 the specified color couldn't be loaded. Use the foreground
1337 color when drawing in that case. */ 1337 color when drawing in that case. */
1338 unsigned underline_defaulted_p : 1; 1338 unsigned underline_defaulted_p : 1;
1339 1339
1340 /* 1 means that either no color is specified for the corresponding 1340 /* 1 means that either no color is specified for the corresponding
1341 attribute or that the specified color couldn't be loaded. 1341 attribute or that the specified color couldn't be loaded.
1342 Use the foreground color when drawing in that case. */ 1342 Use the foreground color when drawing in that case. */
1343 unsigned overline_color_defaulted_p : 1; 1343 unsigned overline_color_defaulted_p : 1;
1413 1413
1414 struct face_cache 1414 struct face_cache
1415 { 1415 {
1416 /* Hash table of cached realized faces. */ 1416 /* Hash table of cached realized faces. */
1417 struct face **buckets; 1417 struct face **buckets;
1418 1418
1419 /* Back-pointer to the frame this cache belongs to. */ 1419 /* Back-pointer to the frame this cache belongs to. */
1420 struct frame *f; 1420 struct frame *f;
1421 1421
1422 /* A vector of faces so that faces can be referenced by an ID. */ 1422 /* A vector of faces so that faces can be referenced by an ID. */
1423 struct face **faces_by_id; 1423 struct face **faces_by_id;
1458 : face_suitable_for_char_p ((FACE), (CHAR))) 1458 : face_suitable_for_char_p ((FACE), (CHAR)))
1459 1459
1460 /* Return the id of the realized face on frame F that is like the face 1460 /* Return the id of the realized face on frame F that is like the face
1461 with id ID but is suitable for displaying character CHAR. 1461 with id ID but is suitable for displaying character CHAR.
1462 This macro is only meaningful for multibyte character CHAR. */ 1462 This macro is only meaningful for multibyte character CHAR. */
1463 1463
1464 #define FACE_FOR_CHAR(F, FACE, CHAR) \ 1464 #define FACE_FOR_CHAR(F, FACE, CHAR) \
1465 (SINGLE_BYTE_CHAR_P (CHAR) \ 1465 (SINGLE_BYTE_CHAR_P (CHAR) \
1466 ? (FACE)->ascii_face->id \ 1466 ? (FACE)->ascii_face->id \
1467 : face_for_char ((F), (FACE), (CHAR))) 1467 : face_for_char ((F), (FACE), (CHAR)))
1468 1468
1688 } 1688 }
1689 stack[2]; 1689 stack[2];
1690 1690
1691 /* Stack pointer. */ 1691 /* Stack pointer. */
1692 int sp; 1692 int sp;
1693 1693
1694 /* Setting of buffer-local variable selective-display-ellipsis. */ 1694 /* Setting of buffer-local variable selective-display-ellipsis. */
1695 unsigned selective_display_ellipsis_p : 1; 1695 unsigned selective_display_ellipsis_p : 1;
1696 1696
1697 /* 1 means control characters are translated into the form `^C' 1697 /* 1 means control characters are translated into the form `^C'
1698 where the `^' can be replaced by a display table entry. */ 1698 where the `^' can be replaced by a display table entry. */
1713 unsigned face_box_p : 1; 1713 unsigned face_box_p : 1;
1714 1714
1715 /* Non-null means that the current character is the first in a run 1715 /* Non-null means that the current character is the first in a run
1716 of characters with box face. */ 1716 of characters with box face. */
1717 unsigned start_of_box_run_p : 1; 1717 unsigned start_of_box_run_p : 1;
1718 1718
1719 /* Non-zero means that the current character is the last in a run 1719 /* Non-zero means that the current character is the last in a run
1720 of characters with box face. */ 1720 of characters with box face. */
1721 unsigned end_of_box_run_p : 1; 1721 unsigned end_of_box_run_p : 1;
1722 1722
1723 /* 1 means overlay strings at end_charpos have been processed. */ 1723 /* 1 means overlay strings at end_charpos have been processed. */
1807 enum glyph_row_area area; 1807 enum glyph_row_area area;
1808 1808
1809 /* Number of glyphs needed for the last character requested via 1809 /* Number of glyphs needed for the last character requested via
1810 produce_glyphs. This is 1 except for tabs. */ 1810 produce_glyphs. This is 1 except for tabs. */
1811 int nglyphs; 1811 int nglyphs;
1812 1812
1813 /* Width of the display element in pixels. Result of 1813 /* Width of the display element in pixels. Result of
1814 produce_glyphs. */ 1814 produce_glyphs. */
1815 int pixel_width; 1815 int pixel_width;
1816 1816
1817 /* Current, maximum logical, and maximum physical line height 1817 /* Current, maximum logical, and maximum physical line height
1923 struct redisplay_interface 1923 struct redisplay_interface
1924 { 1924 {
1925 /* Produce glyphs/get display metrics for the display element IT is 1925 /* Produce glyphs/get display metrics for the display element IT is
1926 loaded with. */ 1926 loaded with. */
1927 void (*produce_glyphs) P_ ((struct it *it)); 1927 void (*produce_glyphs) P_ ((struct it *it));
1928 1928
1929 /* Write or insert LEN glyphs from STRING at the nominal output 1929 /* Write or insert LEN glyphs from STRING at the nominal output
1930 position. */ 1930 position. */
1931 void (*write_glyphs) P_ ((struct glyph *string, int len)); 1931 void (*write_glyphs) P_ ((struct glyph *string, int len));
1932 void (*insert_glyphs) P_ ((struct glyph *start, int len)); 1932 void (*insert_glyphs) P_ ((struct glyph *start, int len));
1933 1933
1934 /* Clear from nominal output position to X. X < 0 means clear 1934 /* Clear from nominal output position to X. X < 0 means clear
1935 to right end of display. */ 1935 to right end of display. */
1936 void (*clear_end_of_line) P_ ((int x)); 1936 void (*clear_end_of_line) P_ ((int x));
1937 1937
1938 /* Function to call to scroll the display as described by RUN on 1938 /* Function to call to scroll the display as described by RUN on
1939 window W. */ 1939 window W. */
1940 void (*scroll_run_hook) P_ ((struct window *w, struct run *run)); 1940 void (*scroll_run_hook) P_ ((struct window *w, struct run *run));
1941 1941
1942 /* Function to call after a line in a display has been completely 1942 /* Function to call after a line in a display has been completely
1953 MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W 1953 MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W
1954 that contained glyphs in mouse-face were overwritten, so we 1954 that contained glyphs in mouse-face were overwritten, so we
1955 have to update the mouse highlight. */ 1955 have to update the mouse highlight. */
1956 void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p, 1956 void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p,
1957 int mouse_face_overwritten_p)); 1957 int mouse_face_overwritten_p));
1958 1958
1959 /* Move cursor to row/column position VPOS/HPOS, pixel coordinates 1959 /* Move cursor to row/column position VPOS/HPOS, pixel coordinates
1960 Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y 1960 Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
1961 are window-relative pixel positions. */ 1961 are window-relative pixel positions. */
1962 void (*cursor_to) P_ ((int vpos, int hpos, int y, int x)); 1962 void (*cursor_to) P_ ((int vpos, int hpos, int y, int x));
1963 1963