(smerge-auto-leave): New function and variable.
[emacs.git] / src / dispextern.h
blob34dd9712c86f9351ff2904baa14c2038ce6fb2a2
1 /* Interface definitions for display code.
2 Copyright (C) 1985, 1993, 1994, 1997, 1998, 1999
3 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* New redisplay written by Gerd Moellmann <gerd@acm.org>. */
24 #ifndef DISPEXTERN_H_INCLUDED
25 #define DISPEXTERN_H_INCLUDED
27 #ifdef HAVE_X_WINDOWS
28 #include <X11/Xlib.h>
29 #ifdef USE_X_TOOLKIT
30 #include <X11/Intrinsic.h>
31 #endif /* USE_X_TOOLKIT */
32 #endif /* HAVE_X_WINDOWS */
34 #ifdef MSDOS
35 #include "msdos.h"
36 #endif
38 #ifdef HAVE_NTGUI
39 #include "w32gui.h"
40 #endif
42 #ifdef macintosh
43 #include "macterm.h"
44 #endif
46 /* Structure forward declarations. Some are here because function
47 prototypes below reference structure types before their definition
48 in this file. Some are here because not every file including
49 dispextern.h also includes frame.h and windows.h. */
51 struct glyph;
52 struct glyph_row;
53 struct glyph_matrix;
54 struct glyph_pool;
55 struct frame;
56 struct window;
60 /***********************************************************************
61 Debugging
62 ***********************************************************************/
64 /* If GLYPH_DEBUG is non-zero, additional checks are activated. Turn
65 it off by defining the macro GLYPH_DEBUG to zero. */
67 #ifndef GLYPH_DEBUG
68 #define GLYPH_DEBUG 0
69 #endif
71 /* Macros to include code only if GLYPH_DEBUG != 0. */
73 #if GLYPH_DEBUG
74 #define IF_DEBUG(X) X
75 #define xassert(X) do {if (!(X)) abort ();} while (0)
76 #else
77 #define IF_DEBUG(X) (void) 0
78 #define xassert(X) (void) 0
79 #endif
81 /* Macro for displaying traces of redisplay. If Emacs was compiled
82 with GLYPH_DEBUG != 0, the variable trace_redisplay_p can be set to
83 a non-zero value in debugging sessions to activate traces. */
85 #if GLYPH_DEBUG
87 extern int trace_redisplay_p;
88 #include <stdio.h>
90 #define TRACE(X) \
91 if (trace_redisplay_p) \
92 fprintf X; \
93 else \
94 (void) 0
96 #else /* GLYPH_DEBUG == 0 */
98 #define TRACE(X) (void) 0
100 #endif /* GLYPH_DEBUG == 0 */
104 /***********************************************************************
105 Text positions
106 ***********************************************************************/
108 /* Starting with Emacs 20.3, characters from strings and buffers have
109 both a character and a byte position associated with them. The
110 following structure holds such a pair of positions. */
112 struct text_pos
114 /* Character position. */
115 int charpos;
117 /* Corresponding byte position. */
118 int bytepos;
121 /* Access character and byte position of POS in a functional form. */
123 #define BYTEPOS(POS) (POS).bytepos
124 #define CHARPOS(POS) (POS).charpos
126 /* Set character position of POS to CHARPOS, byte position to BYTEPOS. */
128 #define SET_TEXT_POS(POS, CHARPOS, BYTEPOS) \
129 ((POS).charpos = (CHARPOS), (POS).bytepos = BYTEPOS)
131 /* Increment text position POS. */
133 #define INC_TEXT_POS(POS) \
134 do \
136 ++(POS).charpos; \
137 INC_POS ((POS).bytepos); \
139 while (0)
141 /* Decrement text position POS. */
143 #define DEC_TEXT_POS(POS) \
144 do \
146 --(POS).charpos; \
147 DEC_POS ((POS).bytepos); \
149 while (0)
151 /* Set text position POS from marker MARKER. */
153 #define SET_TEXT_POS_FROM_MARKER(POS, MARKER) \
154 (CHARPOS (POS) = marker_position ((MARKER)), \
155 BYTEPOS (POS) = marker_byte_position ((MARKER)))
157 /* Set marker MARKER from text position POS. */
159 #define SET_MARKER_FROM_TEXT_POS(MARKER, POS) \
160 set_marker_both ((MARKER), Qnil, CHARPOS ((POS)), BYTEPOS ((POS)))
162 /* Value is non-zero if character and byte positions of POS1 and POS2
163 are equal. */
165 #define TEXT_POS_EQUAL_P(POS1, POS2) \
166 ((POS1).charpos == (POS2).charpos \
167 && (POS1).bytepos == (POS2).bytepos)
169 /* When rendering glyphs, redisplay scans string or buffer text,
170 overlay strings in that text, and does display table or control
171 character translations. The following structure captures a
172 position taking all this into account. */
174 struct display_pos
176 /* Buffer or string position. */
177 struct text_pos pos;
179 /* If this is a position in an overlay string, overlay_string_index
180 is the index of that overlay string in the sequence of overlay
181 strings at `pos' in the order redisplay processes them. A value
182 < 0 means that this is not a position in an overlay string. */
183 int overlay_string_index;
185 /* If this is a position in an overlay string, string_pos is the
186 position within that string. */
187 struct text_pos string_pos;
189 /* If the character at the position above is a control character or
190 has a display table entry, dpvec_index is an index in the display
191 table or control character translation of that character. A
192 value < 0 means this is not a position in such a translation. */
193 int dpvec_index;
198 /***********************************************************************
199 Glyphs
200 ***********************************************************************/
202 /* Enumeration of glyph types. Glyph structures contain a type field
203 containing one of the enumerators defined here. */
205 enum glyph_type
207 /* Glyph describes a character. */
208 CHAR_GLYPH,
210 /* Glyph describes a composition sequence. */
211 COMPOSITE_GLYPH,
213 /* Glyph describes an image. */
214 IMAGE_GLYPH,
216 /* Glyph is a space of fractional width and/or height. */
217 STRETCH_GLYPH
221 /* Glyphs. */
223 struct glyph
225 /* Position from which this glyph was drawn. If `object' below is a
226 Lisp string, this is a position in that string. If it is a
227 buffer, this is a position in that buffer. A value of -1
228 together with a null object means glyph is a truncation glyph at
229 the start of a row. */
230 int charpos;
232 /* Lisp object source of this glyph. Currently either a buffer or
233 a string, or 0. */
234 Lisp_Object object;
236 /* Width in pixels. */
237 short pixel_width;
239 /* Vertical offset. If < 0, the glyph is displayed raised, if > 0
240 the glyph is displayed lowered. */
241 short voffset;
243 /* Which kind of glyph this is---character, image etc. Value
244 should be an enumerator of type enum glyph_type. */
245 unsigned type : 2;
247 /* 1 means this glyph was produced from multibyte text. Zero
248 means it was produced from unibyte text, i.e. charsets aren't
249 applicable, and encoding is not performed. */
250 unsigned multibyte_p : 1;
252 /* Non-zero means draw a box line at the left or right side of this
253 glyph. This is part of the implementation of the face attribute
254 `:box'. */
255 unsigned left_box_line_p : 1;
256 unsigned right_box_line_p : 1;
258 /* Non-zero means this glyph's physical ascent or descent is greater
259 than its logical ascent/descent, i.e. it may potentially overlap
260 glyphs above or below it. */
261 unsigned overlaps_vertically_p : 1;
263 /* 1 means glyph is a padding glyph. Padding glyphs are used for
264 characters whose visual shape consists of more than one glyph
265 (e.g. Asian characters). All but the first glyph of such a glyph
266 sequence have the padding_p flag set. Only used for terminal
267 frames, and there only to minimize code changes. A better way
268 would probably be to use the width field of glyphs to express
269 padding. */
270 unsigned padding_p : 1;
272 /* 1 means the actual glyph is not available in the current
273 system. */
274 unsigned glyph_not_available_p : 1;
276 /* Face of the glyph. */
277 unsigned face_id : 22;
279 /* A union of sub-structures for different glyph types. */
280 union
282 /* Character code for character glyphs (type == CHAR_GLYPH). */
283 unsigned ch;
285 /* Composition ID for composition glyphs (type == COMPOSITION_GLYPH) */
286 unsigned cmp_id;
288 /* Image ID for image glyphs (type == IMAGE_GLYPH). */
289 unsigned img_id;
291 /* Sub-structure for type == STRETCH_GLYPH. */
292 struct
294 /* The height of the glyph. */
295 unsigned height : 16;
297 /* The ascent of the glyph. */
298 unsigned ascent : 16;
300 stretch;
302 /* Used to compare all bit-fields above in one step. */
303 unsigned val;
304 } u;
308 /* Is GLYPH a space? */
310 #define CHAR_GLYPH_SPACE_P(GLYPH) \
311 (GLYPH_FROM_CHAR_GLYPH ((GLYPH)) == SPACEGLYPH)
313 /* Are glyphs *X and *Y equal? */
315 #define GLYPH_EQUAL_P(X, Y) \
316 ((X)->type == (Y)->type \
317 && (X)->u.val == (Y)->u.val \
318 && (X)->face_id == (Y)->face_id \
319 && (X)->padding_p == (Y)->padding_p \
320 && (X)->left_box_line_p == (Y)->left_box_line_p \
321 && (X)->right_box_line_p == (Y)->right_box_line_p \
322 && (X)->voffset == (Y)->voffset)
324 /* Are character codes, faces, padding_ps of glyphs *X and *Y equal? */
326 #define GLYPH_CHAR_AND_FACE_EQUAL_P(X, Y) \
327 ((X)->u.ch == (Y)->u.ch \
328 && (X)->face_id == (Y)->face_id \
329 && (X)->padding_p == (Y)->padding_p)
331 /* Fill a character glyph GLYPH. CODE, FACE_ID, PADDING_P correspond
332 to the bits defined for the typedef `GLYPH' in lisp.h. */
334 #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P) \
335 do \
337 (GLYPH).u.ch = (CODE); \
338 (GLYPH).face_id = (FACE_ID); \
339 (GLYPH).padding_p = (PADDING_P); \
341 while (0)
343 /* Fill a character type glyph GLYPH from a glyph typedef FROM as
344 defined in lisp.h. */
346 #define SET_CHAR_GLYPH_FROM_GLYPH(GLYPH, FROM) \
347 SET_CHAR_GLYPH ((GLYPH), \
348 FAST_GLYPH_CHAR ((FROM)), \
349 FAST_GLYPH_FACE ((FROM)), \
352 /* Construct a glyph code from a character glyph GLYPH. If the
353 character is multibyte, return -1 as we can't use glyph table for a
354 multibyte character. */
356 #define GLYPH_FROM_CHAR_GLYPH(GLYPH) \
357 ((GLYPH).u.ch < 256 \
358 ? ((GLYPH).u.ch | ((GLYPH).face_id << 8)) \
359 : -1)
361 /* Is GLYPH a padding glyph? */
363 #define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p
368 /***********************************************************************
369 Glyph Pools
370 ***********************************************************************/
372 /* Glyph Pool.
374 Glyph memory for frame-based redisplay is allocated from the heap
375 in one vector kept in a glyph pool structure which is stored with
376 the frame. The size of the vector is made large enough to cover
377 all windows on the frame.
379 Both frame and window glyph matrices reference memory from a glyph
380 pool in frame-based redisplay.
382 In window-based redisplay, no glyphs pools exist; windows allocate
383 and free their glyph memory themselves. */
385 struct glyph_pool
387 /* Vector of glyphs allocated from the heap. */
388 struct glyph *glyphs;
390 /* Allocated size of `glyphs'. */
391 int nglyphs;
393 /* Number of rows and columns in a matrix. */
394 int nrows, ncolumns;
399 /***********************************************************************
400 Glyph Matrix
401 ***********************************************************************/
403 /* Glyph Matrix.
405 Three kinds of glyph matrices exist:
407 1. Frame glyph matrices. These are used for terminal frames whose
408 redisplay needs a view of the whole screen due to limited terminal
409 capabilities. Frame matrices are used only in the update phase
410 of redisplay. They are built in update_frame and not used after
411 the update has been performed.
413 2. Window glyph matrices on frames having frame glyph matrices.
414 Such matrices are sub-matrices of their corresponding frame matrix,
415 i.e. frame glyph matrices and window glyph matrices share the same
416 glyph memory which is allocated in form of a glyph_pool structure.
417 Glyph rows in such a window matrix are slices of frame matrix rows.
419 2. Free-standing window glyph matrices managing their own glyph
420 storage. This form is used in window-based redisplay which
421 includes variable width and height fonts etc.
423 The size of a window's row vector depends on the height of fonts
424 defined on its frame. It is chosen so that the vector is large
425 enough to describe all lines in a window when it is displayed in
426 the smallest possible character size. When new fonts are loaded,
427 or window sizes change, the row vector is adjusted accordingly. */
429 struct glyph_matrix
431 /* The pool from which glyph memory is allocated, if any. This is
432 null for frame matrices and for window matrices managing their
433 own storage. */
434 struct glyph_pool *pool;
436 /* Vector of glyph row structures. The row at nrows - 1 is reserved
437 for the mode line. */
438 struct glyph_row *rows;
440 /* Number of elements allocated for the vector rows above. */
441 int rows_allocated;
443 /* The number of rows used by the window if all lines were displayed
444 with the smallest possible character height. */
445 int nrows;
447 /* Origin within the frame matrix if this is a window matrix on a
448 frame having a frame matrix. Both values are zero for
449 window-based redisplay. */
450 int matrix_x, matrix_y;
452 /* Width and height of the matrix in columns and rows. */
453 int matrix_w, matrix_h;
455 /* If this structure describes a window matrix, window_top_y is the
456 top-most y-position and window_height is the height of the
457 window, and window_vscroll is the vscroll at the time the matrix
458 was last adjusted. Only set for window-based redisplay. */
459 int window_top_y, window_height, window_width, window_vscroll;
461 /* Number of glyphs reserved for left and right marginal areas when
462 the matrix was last adjusted. */
463 int left_margin_glyphs, right_margin_glyphs;
465 /* Flag indicating that scrolling should not be tried in
466 update_window. This flag is set by functions like try_window_id
467 which do their own scrolling. */
468 unsigned no_scrolling_p : 1;
470 /* Non-zero means window displayed in this matrix has a top mode
471 line. */
472 unsigned header_line_p : 1;
474 #ifdef GLYPH_DEBUG
475 /* A string identifying the method used to display the matrix. */
476 char method[512];
477 #endif
479 /* The buffer this matrix displays. Set in redisplay_internal. */
480 struct buffer *buffer;
482 /* Values of BEGV and ZV as of last redisplay. */
483 int begv, zv;
487 /* Check that glyph pointers stored in glyph rows of MATRIX are okay.
488 This aborts if any pointer is found twice. */
490 #if GLYPH_DEBUG
491 void check_matrix_pointer_lossage P_ ((struct glyph_matrix *));
492 #define CHECK_MATRIX(MATRIX) check_matrix_pointer_lossage ((MATRIX))
493 #else
494 #define CHECK_MATRIX(MATRIX) (void) 0
495 #endif
499 /***********************************************************************
500 Glyph Rows
501 ***********************************************************************/
503 /* Area in window glyph matrix. If values are added or removed, the
504 function mark_object in alloc.c has to be changed. */
506 enum glyph_row_area
508 LEFT_MARGIN_AREA,
509 TEXT_AREA,
510 RIGHT_MARGIN_AREA,
511 LAST_AREA
515 /* Rows of glyphs in a windows or frame glyph matrix.
517 Each row is partitioned into three areas. The start and end of
518 each area is recorded in a pointer as shown below.
520 +--------------------+-------------+---------------------+
521 | left margin area | text area | right margin area |
522 +--------------------+-------------+---------------------+
523 | | | |
524 glyphs[LEFT_MARGIN_AREA] glyphs[RIGHT_MARGIN_AREA]
526 glyphs[TEXT_AREA] |
527 glyphs[LAST_AREA]
529 Rows in frame matrices reference glyph memory allocated in a frame
530 glyph pool (see the description of struct glyph_pool). Rows in
531 window matrices on frames having frame matrices reference slices of
532 the glyphs of corresponding rows in the frame matrix.
534 Rows in window matrices on frames having no frame matrices point to
535 glyphs allocated from the heap via xmalloc;
536 glyphs[LEFT_MARGIN_AREA] is the start address of the allocated
537 glyph structure array. */
539 struct glyph_row
541 /* Pointers to beginnings of areas. The end of an area A is found at
542 A + 1 in the vector. The last element of the vector is the end
543 of the whole row.
545 Kludge alert: Even if used[TEXT_AREA] == 0, glyphs[TEXT_AREA][0]'s
546 position field is used. It is -1 if this row does not correspond
547 to any text; it is some buffer position if the row corresponds to
548 an empty display line that displays a line end. This is what old
549 redisplay used to do. (Except in code for terminal frames, this
550 kludge is no longer use, I believe. --gerd).
552 See also start, end, displays_text_p and ends_at_zv_p for cleaner
553 ways to do it. The special meaning of positions 0 and -1 will be
554 removed some day, so don't use it in new code. */
555 struct glyph *glyphs[1 + LAST_AREA];
557 /* Number of glyphs actually filled in areas. */
558 short used[LAST_AREA];
560 /* Window-relative x and y-position of the top-left corner of this
561 row. If y < 0, this means that abs (y) pixels of the row are
562 invisible because it is partially visible at the top of a window.
563 If x < 0, this means that abs (x) pixels of the first glyph of
564 the text area of the row are invisible because the glyph is
565 partially visible. */
566 int x, y;
568 /* Width of the row in pixels without taking face extension at the
569 end of the row into account. */
570 int pixel_width;
572 /* Logical ascent/height of this line. The value of ascent is zero
573 and height is 1 on terminal frames. */
574 int ascent, height;
576 /* Physical ascent/height of this line. If max_ascent > ascent,
577 this line overlaps the line above it on the display. Otherwise,
578 if max_height > height, this line overlaps the line beneath it. */
579 int phys_ascent, phys_height;
581 /* Portion of row that is visible. Partially visible rows may be
582 found at the top and bottom of a window. This is 1 for tty
583 frames. It may be < 0 in case of completely invisible rows. */
584 int visible_height;
586 /* Hash code. This hash code is available as soon as the row
587 is constructed, i.e. after a call to display_line. */
588 unsigned hash;
590 /* First position in this row. This is the text position, including
591 overlay position information etc, where the display of this row
592 started, and can thus be less the position of the first glyph
593 (e.g. due to invisible text or horizontal scrolling). */
594 struct display_pos start;
596 /* Text position at the end of this row. This is the position after
597 the last glyph on this row. It can be greater than the last
598 glyph position + 1, due to truncation, invisible text etc. In an
599 up-to-date display, this should always be equal to the start
600 position of the next row. */
601 struct display_pos end;
603 /* In a desired matrix, 1 means that this row must be updated. In a
604 current matrix, 0 means that the row has been invalidated, i.e.
605 the row's contents do not agree with what is visible on the
606 screen. */
607 unsigned enabled_p : 1;
609 /* Display this line in inverse video? Used for the mode line and
610 menu bar lines. */
611 unsigned inverse_p : 1;
613 /* 1 means row displays a text line that is truncated on the left or
614 right side. */
615 unsigned truncated_on_left_p : 1;
616 unsigned truncated_on_right_p : 1;
618 /* 1 means the overlay arrow is on this line. */
619 unsigned overlay_arrow_p : 1;
621 /* 1 means that this row displays a continued line, i.e. it has a
622 continuation mark at the right side. */
623 unsigned continued_p : 1;
625 /* 0 means that this row does not contain any text, i.e. it is
626 a blank line at the window and buffer end. */
627 unsigned displays_text_p : 1;
629 /* 1 means that this line ends at ZV. */
630 unsigned ends_at_zv_p : 1;
632 /* 1 means the face of the last glyph in the text area is drawn to
633 the right end of the window. This flag is used in
634 update_text_area to optimize clearing to the end of the area. */
635 unsigned fill_line_p : 1;
637 /* Non-zero means display a bitmap on X frames indicating that this
638 line contains no text and ends in ZV. */
639 unsigned indicate_empty_line_p : 1;
641 /* 1 means this row contains glyphs that overlap each other because
642 of lbearing or rbearing. */
643 unsigned contains_overlapping_glyphs_p : 1;
645 /* 1 means this row is a wide as the window it is displayed in, including
646 scroll bars, bitmap areas, and internal borders. This also
647 implies that the row doesn't have marginal areas. */
648 unsigned full_width_p : 1;
650 /* Non-zero means row is a mode or top-line. */
651 unsigned mode_line_p : 1;
653 /* 1 in a current row means this row is overlapped by another row. */
654 unsigned overlapped_p : 1;
656 /* 1 in a current row means this row overlaps others. */
657 unsigned overlapping_p : 1;
659 /* Continuation lines width at the start of the row. */
660 int continuation_lines_width;
664 /* Get a pointer to row number ROW in matrix MATRIX. If GLYPH_DEBUG
665 is defined to a non-zero value, the function matrix_row checks that
666 we don't try to access rows that are out of bounds. */
668 #if GLYPH_DEBUG
669 struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
670 #define MATRIX_ROW(MATRIX, ROW) matrix_row ((MATRIX), (ROW))
671 #else
672 #define MATRIX_ROW(MATRIX, ROW) ((MATRIX)->rows + (ROW))
673 #endif
675 /* Return a pointer to the row reserved for the mode line in MATRIX.
676 Row MATRIX->nrows - 1 is always reserved for the mode line. */
678 #define MATRIX_MODE_LINE_ROW(MATRIX) \
679 ((MATRIX)->rows + (MATRIX)->nrows - 1)
681 /* Return a pointer to the row reserved for the top line in MATRIX.
682 This is always the first row in MATRIX because that's the only
683 way that works in frame-based redisplay. */
685 #define MATRIX_HEADER_LINE_ROW(MATRIX) (MATRIX)->rows
687 /* Return a pointer to first row in MATRIX used for text display. */
689 #define MATRIX_FIRST_TEXT_ROW(MATRIX) \
690 ((MATRIX)->rows->mode_line_p ? (MATRIX)->rows + 1 : (MATRIX)->rows)
692 /* Return a pointer to the first glyph in the text area of a row.
693 MATRIX is the glyph matrix accessed, and ROW is the row index in
694 MATRIX. */
696 #define MATRIX_ROW_GLYPH_START(MATRIX, ROW) \
697 (MATRIX_ROW ((MATRIX), (ROW))->glyphs[TEXT_AREA])
699 /* Return the number of used glyphs in the text area of a row. */
701 #define MATRIX_ROW_USED(MATRIX, ROW) \
702 (MATRIX_ROW ((MATRIX), (ROW))->used[TEXT_AREA])
704 /* Return the character/ byte position at which the display of ROW
705 starts. */
707 #define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->start.pos.charpos)
708 #define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->start.pos.bytepos)
710 /* Return character/ byte position at which ROW ends. */
712 #define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->end.pos.charpos)
713 #define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->end.pos.bytepos)
715 /* Return the vertical position of ROW in MATRIX. */
717 #define MATRIX_ROW_VPOS(ROW, MATRIX) ((ROW) - (MATRIX)->rows)
719 /* Return the last glyph row + 1 in MATRIX on window W reserved for
720 text. If W has a mode line, the last row in the matrix is reserved
721 for it. */
723 #define MATRIX_BOTTOM_TEXT_ROW(MATRIX, W) \
724 ((MATRIX)->rows \
725 + (MATRIX)->nrows \
726 - (WINDOW_WANTS_MODELINE_P ((W)) ? 1 : 0))
728 /* Non-zero if the face of the last glyph in ROW's text area has
729 to be drawn to the end of the text area. */
731 #define MATRIX_ROW_EXTENDS_FACE_P(ROW) ((ROW)->fill_line_p)
733 /* Set and query the enabled_p flag of glyph row ROW in MATRIX. */
735 #define SET_MATRIX_ROW_ENABLED_P(MATRIX, ROW, VALUE) \
736 (MATRIX_ROW ((MATRIX), (ROW))->enabled_p = (VALUE) != 0)
738 #define MATRIX_ROW_ENABLED_P(MATRIX, ROW) \
739 (MATRIX_ROW ((MATRIX), (ROW))->enabled_p)
741 /* Non-zero if ROW displays text. Value is non-zero if the row is
742 blank but displays a line end. */
744 #define MATRIX_ROW_DISPLAYS_TEXT_P(ROW) ((ROW)->displays_text_p)
746 /* Non-zero if ROW is not completely visible in window W. */
748 #define MATRIX_ROW_PARTIALLY_VISIBLE_P(ROW) \
749 ((ROW)->height != (ROW)->visible_height)
751 /* Non-zero if ROW is partially visible at the top of window W. */
753 #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW) \
754 (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \
755 && (ROW)->y < WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
757 /* Non-zero if ROW is partially visible at the bottom of window W. */
759 #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW) \
760 (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \
761 && (ROW)->y + (ROW)->height > WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE ((W)))
763 /* Return the bottom Y + 1 of ROW. */
765 #define MATRIX_ROW_BOTTOM_Y(ROW) ((ROW)->y + (ROW)->height)
767 /* Is ROW the last visible one in the display described by the
768 iterator structure pointed to by IT?. */
770 #define MATRIX_ROW_LAST_VISIBLE_P(ROW, IT) \
771 (MATRIX_ROW_BOTTOM_Y ((ROW)) >= (IT)->last_visible_y)
773 /* Non-zero if ROW displays a continuation line. */
775 #define MATRIX_ROW_CONTINUATION_LINE_P(ROW) \
776 ((ROW)->continuation_lines_width > 0)
778 /* Non-zero if ROW ends in the middle of a character. This is the
779 case for continued lines showing only part of a display table entry
780 or a control char, or an overlay string. */
782 #define MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P(ROW) \
783 ((ROW)->end.dpvec_index >= 0 \
784 || (ROW)->end.overlay_string_index >= 0)
786 /* Non-zero if ROW ends in the middle of an overlay string. */
788 #define MATRIX_ROW_ENDS_IN_OVERLAY_STRING_P(ROW) \
789 ((ROW)->end.overlay_string_index >= 0)
791 /* Non-zero if ROW starts in the middle of a character. See above. */
793 #define MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P(ROW) \
794 ((ROW)->start.dpvec_index >= 0 \
795 || ((ROW)->start.overlay_string_index >= 0 \
796 && (ROW)->start.string_pos.charpos > 0))
798 /* Non-zero means ROW overlaps its predecessor. */
800 #define MATRIX_ROW_OVERLAPS_PRED_P(ROW) \
801 ((ROW)->phys_ascent > (ROW)->ascent)
803 /* Non-zero means ROW overlaps its successor. */
805 #define MATRIX_ROW_OVERLAPS_SUCC_P(ROW) \
806 ((ROW)->phys_height - (ROW)->phys_ascent \
807 > (ROW)->height - (ROW)->ascent)
809 /* Non-zero means that fonts have been loaded since the last glyph
810 matrix adjustments. The function redisplay_internal adjusts glyph
811 matrices when this flag is non-zero. */
813 extern int fonts_changed_p;
815 /* A glyph for a space. */
817 extern struct glyph space_glyph;
819 /* Window being updated by update_window. This is non-null as long as
820 update_window has not finished, and null otherwise. It's role is
821 analogous to updating_frame. */
823 extern struct window *updated_window;
825 /* Glyph row and area updated by update_window_line. */
827 extern struct glyph_row *updated_row;
828 extern int updated_area;
830 /* Non-zero means reading single-character input with prompt so put
831 cursor on mini-buffer after the prompt. Positive means at end of
832 text in echo area; negative means at beginning of line. */
834 extern int cursor_in_echo_area;
836 /* Non-zero means last display completed. Zero means it was
837 preempted. */
839 extern int display_completed;
841 /* Non-zero means redisplay has been performed directly (see also
842 direct_output_for_insert and direct_output_forward_char), so that
843 no further updating has to be performed. The function
844 redisplay_internal checks this flag, and does nothing but reset it
845 to zero if it is non-zero. */
847 extern int redisplay_performed_directly_p;
849 /* A temporary storage area, including a row of glyphs. Initialized
850 in xdisp.c. Used for various purposes, as an example see
851 direct_output_for_insert. */
853 extern struct glyph_row scratch_glyph_row;
857 /************************************************************************
858 Display Dimensions
859 ************************************************************************/
861 /* Return the height of the mode line in glyph matrix MATRIX, or zero
862 if not known. This macro is called under circumstances where
863 MATRIX might not have been allocated yet. */
865 #define MATRIX_MODE_LINE_HEIGHT(MATRIX) \
866 ((MATRIX) && (MATRIX)->rows \
867 ? MATRIX_MODE_LINE_ROW (MATRIX)->height \
868 : 0)
870 /* Return the height of the top line in glyph matrix MATRIX, or zero
871 if not known. This macro is called under circumstances where
872 MATRIX might not have been allocated yet. */
874 #define MATRIX_HEADER_LINE_HEIGHT(MATRIX) \
875 ((MATRIX) && (MATRIX)->rows \
876 ? MATRIX_HEADER_LINE_ROW (MATRIX)->height \
877 : 0)
879 /* Return the current height of the mode line of window W. If not
880 known from W's current glyph matrix, return a default based on the
881 height of the font of the face `modeline'. */
883 #define CURRENT_MODE_LINE_HEIGHT(W) \
884 (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
885 ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
886 : estimate_mode_line_height (XFRAME ((W)->frame), MODE_LINE_FACE_ID))
888 /* Return the current height of the top line of window W. If not
889 known from W's current glyph matrix, return an estimation based on
890 the height of the font of the face `top-line'. */
892 #define CURRENT_HEADER_LINE_HEIGHT(W) \
893 (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \
894 ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \
895 : estimate_mode_line_height (XFRAME ((W)->frame), HEADER_LINE_FACE_ID))
897 /* Return the height of the desired mode line of window W. */
899 #define DESIRED_MODE_LINE_HEIGHT(W) \
900 MATRIX_MODE_LINE_HEIGHT ((W)->desired_matrix)
902 /* Return the height of the desired top line of window W. */
904 #define DESIRED_HEADER_LINE_HEIGHT(W) \
905 MATRIX_HEADER_LINE_HEIGHT ((W)->desired_matrix)
907 /* Like FRAME_INTERNAL_BORDER_WIDTH but checks whether frame F is a
908 window-system frame. */
910 #define FRAME_INTERNAL_BORDER_WIDTH_SAFE(F) \
911 (FRAME_WINDOW_P (F) ? FRAME_INTERNAL_BORDER_WIDTH (F) : 0)
913 /* Width of display region of window W. For terminal frames, this
914 equals the width of W since there are no vertical scroll bars. For
915 window system frames, the value has to be corrected by the pixel
916 width of vertical scroll bars, and bitmap areas. */
918 #define WINDOW_DISPLAY_PIXEL_WIDTH(W) \
919 (((XFASTINT ((W)->width) \
920 - FRAME_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME ((W)))) \
921 - FRAME_FLAGS_AREA_COLS (XFRAME (WINDOW_FRAME ((W))))) \
922 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
924 /* Height of the display region of W, including a mode line, if any. */
926 #define WINDOW_DISPLAY_PIXEL_HEIGHT(W) \
927 (XFASTINT ((W)->height) \
928 * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W)))))
930 /* Height in pixels of the mode line. May be zero if W doesn't have a
931 mode line. */
933 #define WINDOW_DISPLAY_MODE_LINE_HEIGHT(W) \
934 (WINDOW_WANTS_MODELINE_P ((W)) \
935 ? CURRENT_MODE_LINE_HEIGHT (W) \
936 : 0)
938 /* Height in pixels of the top line. Zero if W doesn't have a top
939 line. */
941 #define WINDOW_DISPLAY_HEADER_LINE_HEIGHT(W) \
942 (WINDOW_WANTS_HEADER_LINE_P ((W)) \
943 ? CURRENT_HEADER_LINE_HEIGHT (W) \
944 : 0)
946 /* Pixel height of window W without mode line. */
948 #define WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE(W) \
949 (WINDOW_DISPLAY_PIXEL_HEIGHT ((W)) \
950 - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)))
952 /* Pixel height of window W without mode and top line. */
954 #define WINDOW_DISPLAY_TEXT_HEIGHT(W) \
955 (WINDOW_DISPLAY_PIXEL_HEIGHT ((W)) \
956 - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)) \
957 - WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
959 /* Left edge of W in pixels relative to its frame. */
961 #define WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X(W) \
962 (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W)))) \
963 + (WINDOW_LEFT_MARGIN ((W)) \
964 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))) \
965 + FRAME_LEFT_FLAGS_AREA_WIDTH (XFRAME (WINDOW_FRAME ((W)))))
967 /* Right edge of window W in pixels, relative to its frame. */
969 #define WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X(W) \
970 (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)) \
971 + WINDOW_DISPLAY_PIXEL_WIDTH ((W)))
973 /* Top edge of W in pixels relative to its frame. */
975 #define WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y(W) \
976 (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W)))) \
977 + (XFASTINT ((W)->top) \
978 * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W))))))
980 /* Bottom edge of window W relative to its frame. */
982 #define WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y(W) \
983 (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)) \
984 + WINDOW_DISPLAY_PIXEL_HEIGHT ((W)))
986 /* Convert window W relative pixel X to frame pixel coordinates. */
988 #define WINDOW_TO_FRAME_PIXEL_X(W, X) \
989 ((X) + WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
991 /* Convert window W relative pixel Y to frame pixel coordinates. */
993 #define WINDOW_TO_FRAME_PIXEL_Y(W, Y) \
994 ((Y) + WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
996 /* Convert frame relative pixel X to window relative pixel X. */
998 #define FRAME_TO_WINDOW_PIXEL_X(W, X) \
999 ((X) - WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
1001 /* Convert frame relative pixel X to window relative pixel Y. */
1003 #define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \
1004 ((Y) - WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
1006 /* Width of left margin area in pixels. */
1008 #define WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH(W) \
1009 (NILP ((W)->left_margin_width) \
1010 ? 0 \
1011 : (XINT ((W)->left_margin_width) \
1012 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1014 /* Width of right marginal area in pixels. */
1016 #define WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH(W) \
1017 (NILP ((W)->right_margin_width) \
1018 ? 0 \
1019 : (XINT ((W)->right_margin_width) \
1020 * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
1022 /* Width of text area in pixels. */
1024 #define WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH(W) \
1025 (WINDOW_DISPLAY_PIXEL_WIDTH ((W)) \
1026 - WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \
1027 - WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W)))
1029 /* Convert a text area relative x-position in window W to frame X
1030 pixel coordinates. */
1032 #define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X) \
1033 (WINDOW_TO_FRAME_PIXEL_X ((W), (X)) \
1034 + WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)))
1036 /* Translate an x-position relative to AREA in window W to frame pixel
1037 coordinates. */
1039 #define WINDOW_AREA_TO_FRAME_PIXEL_X(W, AREA, X) \
1040 (WINDOW_TO_FRAME_PIXEL_X ((W), (X)) \
1041 + (((AREA) > LEFT_MARGIN_AREA) \
1042 ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \
1043 : 0) \
1044 + (((AREA) > TEXT_AREA) \
1045 ? WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH ((W)) \
1046 : 0))
1048 /* Return the pixel width of AREA in W. */
1050 #define WINDOW_AREA_PIXEL_WIDTH(W, AREA) \
1051 (((AREA) == TEXT_AREA) \
1052 ? WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH ((W)) \
1053 : (((AREA) == LEFT_MARGIN_AREA) \
1054 ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \
1055 : WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W))))
1057 /* Value is non-zero if window W has a mode line. */
1059 #define WINDOW_WANTS_MODELINE_P(W) \
1060 (!MINI_WINDOW_P (W) \
1061 && !(W)->pseudo_window_p \
1062 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \
1063 && !NILP (XBUFFER ((W)->buffer)->mode_line_format))
1065 /* Value is non-zero if window W wants a top line. */
1067 #define WINDOW_WANTS_HEADER_LINE_P(W) \
1068 (!MINI_WINDOW_P (W) \
1069 && !(W)->pseudo_window_p \
1070 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \
1071 && !NILP (XBUFFER ((W)->buffer)->header_line_format))
1074 /***********************************************************************
1075 Faces
1076 ***********************************************************************/
1078 /* Indices of face attributes in Lisp face vectors. Slot zero is the
1079 symbol `face'. */
1081 enum lface_attribute_index
1083 LFACE_FAMILY_INDEX = 1,
1084 LFACE_SWIDTH_INDEX,
1085 LFACE_HEIGHT_INDEX,
1086 LFACE_WEIGHT_INDEX,
1087 LFACE_SLANT_INDEX,
1088 LFACE_UNDERLINE_INDEX,
1089 LFACE_INVERSE_INDEX,
1090 LFACE_FOREGROUND_INDEX,
1091 LFACE_BACKGROUND_INDEX,
1092 LFACE_STIPPLE_INDEX,
1093 LFACE_OVERLINE_INDEX,
1094 LFACE_STRIKE_THROUGH_INDEX,
1095 LFACE_BOX_INDEX,
1096 LFACE_FONT_INDEX,
1097 LFACE_VECTOR_SIZE
1101 /* Box types of faces. */
1103 enum face_box_type
1105 /* No box around text. */
1106 FACE_NO_BOX,
1108 /* Simple box of specified width and color. Default width is 1, and
1109 default color is the foreground color of the face. */
1110 FACE_SIMPLE_BOX,
1112 /* Boxes with 3D shadows. Color equals the background color of the
1113 face. Width is specified. */
1114 FACE_RAISED_BOX,
1115 FACE_SUNKEN_BOX
1119 /* Structure describing a realized face.
1121 For each Lisp face, 0..N realized faces can exist for different
1122 frames and different charsets. Realized faces are built from Lisp
1123 faces and text properties/overlays by merging faces and adding
1124 unspecified attributes from the `default' face. */
1126 struct face
1128 /* The id of this face. The id equals the index of this face in the
1129 vector faces_by_id of its face cache. */
1130 int id;
1132 #ifdef HAVE_WINDOW_SYSTEM
1134 /* If non-zero, a GC we can use without modification to draw
1135 characters in this face. */
1136 GC gc;
1138 /* Font used for this face, or null if the font could not be loaded
1139 for some reason. This points to a `font' slot of a struct
1140 font_info, and we should not call XFreeFont on it because the
1141 font may still be used somewhere else. */
1142 XFontStruct *font;
1144 /* Background stipple or bitmap used for this face. */
1145 Pixmap stipple;
1147 #else /* not HAVE_WINDOW_SYSTEM */
1149 /* Dummy. */
1150 int stipple;
1152 #endif /* not HAVE_WINDOW_SYSTEM */
1154 /* Pixel value of foreground color for X frames. Color index
1155 for tty frames. */
1156 unsigned long foreground;
1158 /* Pixel value or color index of background color. */
1159 unsigned long background;
1161 /* Pixel value or color index of underline color. */
1162 unsigned long underline_color;
1164 /* Pixel value or color index of overlined, strike-through, or box
1165 color. */
1166 unsigned long overline_color;
1167 unsigned long strike_through_color;
1168 unsigned long box_color;
1170 /* The font's name. This points to a `name' of a font_info, and it
1171 must not be freed. */
1172 char *font_name;
1174 /* Font info ID for this face's font. An ID is stored here because
1175 pointers to font_info structures may change. The reason is that
1176 they are pointers into a font table vector that is itself
1177 reallocated. */
1178 int font_info_id;
1180 /* Fontset ID if this face uses a fontset, or -1. This is only >= 0
1181 if the face was realized for a composition sequence.
1182 Otherwise, a specific font is loaded from the set of fonts
1183 specified by the fontset given by the family attribute of the face. */
1184 int fontset;
1186 /* Pixmap width and height. */
1187 unsigned int pixmap_w, pixmap_h;
1189 /* Non-zero means characters in this face have a box that thickness
1190 around them. */
1191 int box_line_width;
1193 /* Type of box drawn. A value of FACE_NO_BOX means no box is drawn
1194 around text in this face. A value of FACE_SIMPLE_BOX means a box
1195 of width box_line_width is drawn in color box_color. A value of
1196 FACE_RAISED_BOX or FACE_SUNKEN_BOX means a 3D box is drawn with
1197 shadow colors derived from the background color of the face. */
1198 enum face_box_type box;
1200 /* If `box' above specifies a 3D type, 1 means use box_color for
1201 drawing shadows. */
1202 unsigned use_box_color_for_shadows_p : 1;
1204 /* The Lisp face attributes this face realizes. All attributes
1205 in this vector are non-nil. */
1206 Lisp_Object lface[LFACE_VECTOR_SIZE];
1208 /* The hash value of this face. */
1209 unsigned hash;
1211 /* The charset for which this face was realized if it was realized
1212 for use in multibyte text. If fontset >= 0, this is the charset
1213 of the first character of the composition sequence. A value of
1214 charset < 0 means the face was realized for use in unibyte text
1215 where the idea of Emacs charsets isn't applicable. */
1216 int charset;
1218 /* Non-zero if text in this face should be underlined, overlined,
1219 strike-through or have a box drawn around it. */
1220 unsigned underline_p : 1;
1221 unsigned overline_p : 1;
1222 unsigned strike_through_p : 1;
1224 /* 1 means that the colors specified for this face could not be
1225 loaded, and were replaced by default colors, so they shouldn't be
1226 freed. */
1227 unsigned foreground_defaulted_p : 1;
1228 unsigned background_defaulted_p : 1;
1230 /* 1 means that either no color is specified for underlining or that
1231 the the specified color couldn't be loaded. Use the foreground
1232 color when drawing in that case. */
1233 unsigned underline_defaulted_p : 1;
1235 /* 1 means that either no color is specified for the corresponding
1236 attribute or that the the specified color couldn't be loaded.
1237 Use the foreground color when drawing in that case. */
1238 unsigned overline_color_defaulted_p : 1;
1239 unsigned strike_through_color_defaulted_p : 1;
1240 unsigned box_color_defaulted_p : 1;
1242 /* TTY appearances. Blinking is not yet implemented. Colors are
1243 found in `lface' with empty color string meaning the default
1244 color of the TTY. */
1245 unsigned tty_bold_p : 1;
1246 unsigned tty_dim_p : 1;
1247 unsigned tty_underline_p : 1;
1248 unsigned tty_alt_charset_p : 1;
1249 unsigned tty_reverse_p : 1;
1250 unsigned tty_blinking_p : 1;
1252 /* Next and previous face in hash collision list of face cache. */
1253 struct face *next, *prev;
1255 /* If this face is for ASCII characters, this points this face
1256 itself. Otherwise, this points a face for ASCII characters. */
1257 struct face *ascii_face;
1261 /* Color index indicating that face uses a terminal's default color. */
1263 #define FACE_TTY_DEFAULT_COLOR ((unsigned long) -1)
1265 /* Color index indicating that face uses an unknown foreground color. */
1267 #define FACE_TTY_DEFAULT_FG_COLOR ((unsigned long) -2)
1269 /* Color index indicating that face uses an unsigned background color. */
1271 #define FACE_TTY_DEFAULT_BG_COLOR ((unsigned long) -3)
1273 /* Non-zero if FACE was realized for unibyte use. */
1275 #define FACE_UNIBYTE_P(FACE) ((FACE)->charset < 0)
1278 /* IDs of important faces known by the C face code. These are the IDs
1279 of the faces for CHARSET_ASCII. */
1281 enum face_id
1283 DEFAULT_FACE_ID,
1284 MODE_LINE_FACE_ID,
1285 TOOL_BAR_FACE_ID,
1286 BITMAP_AREA_FACE_ID,
1287 HEADER_LINE_FACE_ID,
1288 SCROLL_BAR_FACE_ID,
1289 BORDER_FACE_ID,
1290 CURSOR_FACE_ID,
1291 MOUSE_FACE_ID,
1292 MENU_FACE_ID,
1293 BASIC_FACE_ID_SENTINEL
1297 /* A cache of realized faces. Each frame has its own cache because
1298 Emacs allows different frame-local face definitions. */
1300 struct face_cache
1302 /* Hash table of cached realized faces. */
1303 struct face **buckets;
1305 /* Back-pointer to the frame this cache belongs to. */
1306 struct frame *f;
1308 /* A vector of faces so that faces can be referenced by an ID. */
1309 struct face **faces_by_id;
1311 /* The allocated size, and number of used slots of faces_by_id. */
1312 int size, used;
1316 /* Prepare face FACE for use on frame F. This must be called before
1317 using X resources of FACE. */
1319 #define PREPARE_FACE_FOR_DISPLAY(F, FACE) \
1320 if ((FACE)->gc == 0) \
1321 prepare_face_for_display ((F), (FACE)); \
1322 else \
1323 (void) 0
1325 /* Return a pointer to the face with ID on frame F, or null if such a
1326 face doesn't exist. */
1328 #define FACE_FROM_ID(F, ID) \
1329 (((unsigned) (ID) < FRAME_FACE_CACHE (F)->used) \
1330 ? FRAME_FACE_CACHE (F)->faces_by_id[ID] \
1331 : NULL)
1333 /* Non-zero if FACE is suitable for displaying character CHAR. */
1335 #define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR) \
1336 (SINGLE_BYTE_CHAR_P (CHAR) \
1337 ? (FACE) == (FACE)->ascii_face \
1338 : face_suitable_for_char_p ((FACE), (CHAR)))
1340 /* Return the id of the realized face on frame F that is like the face
1341 with id ID but is suitable for displaying character CHAR.
1342 This macro is only meaningful for multibyte character CHAR. */
1344 #define FACE_FOR_CHAR(F, FACE, CHAR) \
1345 (SINGLE_BYTE_CHAR_P (CHAR) \
1346 ? (FACE)->ascii_face->id \
1347 : face_for_char ((F), (FACE), (CHAR)))
1349 /* The default registry and encoding to use. */
1351 extern Lisp_Object Vface_default_registry;
1353 /* Non-zero means face attributes have been changed since the last
1354 redisplay. Used in redisplay_internal. */
1356 extern int face_change_count;
1361 /***********************************************************************
1362 Display Iterator
1363 ***********************************************************************/
1365 /* Iteration over things to display in current_buffer or in a string.
1367 The iterator handles:
1369 1. Overlay strings (after-string, before-string).
1370 2. Face properties.
1371 3. Invisible text properties.
1372 4. Selective display.
1373 5. Translation of characters via display tables.
1374 6. Translation of control characters to the forms `\003' or `^C'.
1375 7. `glyph' and `space-width' properties.
1377 Iterators are initialized by calling init_iterator or one of the
1378 equivalent functions below. A call to get_next_display_element
1379 loads the iterator structure with information about what next to
1380 display. A call to set_iterator_to_next increments the iterator's
1381 position.
1383 Characters from overlay strings, display table entries or control
1384 character translations are returned one at a time. For example, if
1385 we have a text of `a\x01' where `a' has a display table definition
1386 of `cd' and the control character is displayed with a leading
1387 arrow, then the iterator will return:
1389 Call Return Source Call next
1390 -----------------------------------------------------------------
1391 next c display table move
1392 next d display table move
1393 next ^ control char move
1394 next A control char move
1396 The same mechanism is also used to return characters for ellipses
1397 displayed at the end of invisible text.
1399 CAVEAT: Under some circumstances, move_.* functions can be called
1400 asynchronously, e.g. when computing a buffer position from an x and
1401 y pixel position. This means that these functions and functions
1402 called from them SHOULD NOT USE xmalloc and alike. See also the
1403 comment at the start of xdisp.c. */
1405 /* Enumeration describing what kind of display element an iterator is
1406 loaded with after a call to get_next_display_element. */
1408 enum display_element_type
1410 /* A normal character. */
1411 IT_CHARACTER,
1413 /* A composition sequence. */
1414 IT_COMPOSITION,
1416 /* An image. */
1417 IT_IMAGE,
1419 /* A flexible width and height space. */
1420 IT_STRETCH,
1422 /* End of buffer or string. */
1423 IT_EOB,
1425 /* Truncation glyphs. Never returned by get_next_display_element.
1426 Used to get display information about truncation glyphs via
1427 produce_glyphs. */
1428 IT_TRUNCATION,
1430 /* Continuation glyphs. See the comment for IT_TRUNCATION. */
1431 IT_CONTINUATION
1435 /* An enumerator for each text property that has a meaning for display
1436 purposes. */
1438 enum prop_idx
1440 FONTIFIED_PROP_IDX,
1441 FACE_PROP_IDX,
1442 INVISIBLE_PROP_IDX,
1443 DISPLAY_PROP_IDX,
1444 COMPOSITION_PROP_IDX,
1446 /* Not a property. Used to indicate changes in overlays. */
1447 OVERLAY_PROP_IDX,
1449 /* Sentinel. */
1450 LAST_PROP_IDX
1454 struct it
1456 /* The window in which we iterate over current_buffer (or a string). */
1457 Lisp_Object window;
1458 struct window *w;
1460 /* The window's frame. */
1461 struct frame *f;
1463 /* Function to call to load this structure with the next display
1464 element. */
1465 int (* method) P_ ((struct it *it));
1467 /* The next position at which to check for face changes, invisible
1468 text, overlay strings, end of text etc., which see. */
1469 int stop_charpos;
1471 /* Maximum string or buffer position + 1. ZV when iterating over
1472 current_buffer. */
1473 int end_charpos;
1475 /* C string to iterate over. Non-null means get characters from
1476 this string, otherwise characters are read from current_buffer
1477 or it->string. */
1478 unsigned char *s;
1480 /* Number of characters in the string (s, or it->string) we iterate
1481 over. */
1482 int string_nchars;
1484 /* Start and end of a visible region; -1 if the region is not
1485 visible in the window. */
1486 int region_beg_charpos, region_end_charpos;
1488 /* Position at which redisplay end trigger functions should be run. */
1489 int redisplay_end_trigger_charpos;
1491 /* 1 means multibyte characters are enabled. */
1492 unsigned multibyte_p : 1;
1494 /* 1 means window has a mode line at its top. */
1495 unsigned header_line_p : 1;
1497 /* 1 means `string' is the value of a `display' property.
1498 Don't handle some `display' properties in these strings. */
1499 unsigned string_from_display_prop_p : 1;
1501 /* Display table in effect or null for none. */
1502 struct Lisp_Char_Table *dp;
1504 /* Current display table vector to return characters from and its
1505 end. dpvec null means we are not returning characters from a
1506 display table entry; current.dpvec_index gives the current index
1507 into dpvec. This same mechanism is also used to return
1508 characters from translated control characters, i.e. `\003' or
1509 `^C'. */
1510 Lisp_Object *dpvec, *dpend;
1512 /* Length in bytes of the char that filled dpvec. A value of zero
1513 means that no character such character is involved. */
1514 int dpvec_char_len;
1516 /* Face id of the iterator saved in case a glyph from dpvec contains
1517 a face. The face is restored when all glyphs from dpvec have
1518 been delivered. */
1519 int saved_face_id;
1521 /* Vector of glyphs for control character translation. The pointer
1522 dpvec is set to ctl_chars when a control character is translated.
1523 This vector is also used for incomplete multibyte character
1524 translation (e.g \222\244). Such a character is at most 3 bytes,
1525 thus we need at most 12 bytes here. */
1526 Lisp_Object ctl_chars[12];
1528 /* Current buffer or string position of the iterator, including
1529 position in overlay strings etc. */
1530 struct display_pos current;
1532 /* Vector of overlays to process. Overlay strings are processed
1533 OVERLAY_STRING_CHUNK_SIZE at a time. */
1534 #define OVERLAY_STRING_CHUNK_SIZE 3
1535 Lisp_Object overlay_strings[OVERLAY_STRING_CHUNK_SIZE];
1537 /* Total number of overlay strings to process. This can be >
1538 OVERLAY_STRING_CHUNK_SIZE. */
1539 int n_overlay_strings;
1541 /* If non-nil, a Lisp string being processed. If
1542 current.overlay_string_index >= 0, this is an overlay string from
1543 pos. */
1544 Lisp_Object string;
1546 /* Stack of saved values. New entries are pushed when we begin to
1547 process an overlay string or a string from a `glyph' property.
1548 Entries are popped when we return to deliver display elements
1549 from what we previously had. */
1550 struct iterator_stack_entry
1552 int stop_charpos;
1553 int face_id;
1554 Lisp_Object string;
1555 struct display_pos pos;
1556 int end_charpos;
1557 int string_nchars;
1558 enum glyph_row_area area;
1559 unsigned multibyte_p : 1;
1560 unsigned string_from_display_prop_p : 1;
1561 Lisp_Object space_width;
1562 short voffset;
1563 Lisp_Object font_height;
1565 stack[2];
1567 /* Stack pointer. */
1568 int sp;
1570 /* Setting of buffer-local variable selective-display-ellipsis. */
1571 unsigned selective_display_ellipsis_p : 1;
1573 /* 1 means control characters are translated into the form `^C'
1574 where the `^' can be replaced by a display table entry. */
1575 unsigned ctl_arrow_p : 1;
1577 /* -1 means selective display hides everything between a \r and the
1578 next newline; > 0 means hide lines indented more than that value. */
1579 int selective;
1581 /* An enumeration describing what the next display element is
1582 after a call to get_next_display_element. */
1583 enum display_element_type what;
1585 /* Face to use. */
1586 int face_id;
1588 /* Non-zero means that the current face has a box. */
1589 unsigned face_box_p : 1;
1591 /* Non-null means that the current character is the first in a run
1592 of characters with box face. */
1593 unsigned start_of_box_run_p : 1;
1595 /* Non-zero means that the current character is the last in a run
1596 of characters with box face. */
1597 unsigned end_of_box_run_p : 1;
1599 /* 1 means overlay strings at end_charpos have been processed. */
1600 unsigned overlay_strings_at_end_processed_p : 1;
1602 /* 1 means the actual glyph is not available in the current
1603 system. */
1604 unsigned glyph_not_available_p : 1;
1606 /* The ID of the default face to use. One of DEFAULT_FACE_ID,
1607 MODE_LINE_FACE_ID, or TOOL_BAR_FACE_ID, depending on what we
1608 are displaying. */
1609 int base_face_id;
1611 /* If what == IT_CHARACTER, character and length in bytes. This is
1612 a character from a buffer or string. It may be different from
1613 the character displayed in case that
1614 unibyte_display_via_language_environment is set.
1616 If what == IT_COMPOSITION, the first component of a composition
1617 and length in bytes of the composition. */
1618 int c, len;
1620 /* If what == IT_COMPOSITION, identification number and length in
1621 chars of a composition. */
1622 int cmp_id, cmp_len;
1624 /* The character to display, possibly translated to multibyte
1625 if unibyte_display_via_language_environment is set. This
1626 is set after x_produce_glyphs has been called. */
1627 int char_to_display;
1629 /* If what == IT_IMAGE, the id of the image to display. */
1630 int image_id;
1632 /* Value of the `space-width' property, if any; nil if none. */
1633 Lisp_Object space_width;
1635 /* Computed from the value of the `raise' property. */
1636 short voffset;
1638 /* Value of the `height' property, if any; nil if none. */
1639 Lisp_Object font_height;
1641 /* Object and position where the current display element came from.
1642 Object can be a Lisp string in case the current display element
1643 comes from an overlay string, or it is buffer. Position is
1644 a position in object. */
1645 Lisp_Object object;
1646 struct text_pos position;
1648 /* 1 means lines are truncated. */
1649 unsigned truncate_lines_p : 1;
1651 /* Number of columns per \t. */
1652 short tab_width;
1654 /* Width in pixels of truncation and continuation glyphs. */
1655 short truncation_pixel_width, continuation_pixel_width;
1657 /* First and last visible x-position in the display area. If window
1658 is hscrolled by n columns, first_visible_x == n * CANON_X_UNIT
1659 (f), and last_visible_x == pixel width of W + first_visible_x. */
1660 int first_visible_x, last_visible_x;
1662 /* Last visible y-position + 1 in the display area without a mode
1663 line, if the window has one. */
1664 int last_visible_y;
1666 /* Width of a prompt in front of the line. Used to perform tab
1667 calculations. The x on which tab calculations are based is
1668 current_x - prompt_width + continuation_lines_width. */
1669 int prompt_width;
1671 /* If non-null, glyphs are produced in glyph_row with each call to
1672 produce_glyphs. */
1673 struct glyph_row *glyph_row;
1675 /* The area of glyph_row to which glyphs are added. */
1676 enum glyph_row_area area;
1678 /* Number of glyphs needed for the last character requested via
1679 produce_glyphs. This is 1 except for tabs. */
1680 int nglyphs;
1682 /* Width of the display element in pixels. Result of
1683 produce_glyphs. */
1684 int pixel_width;
1686 /* Current, maximum logical, and maximum physical line height
1687 information. Result of produce_glyphs. */
1688 int ascent, descent, max_ascent, max_descent;
1689 int phys_ascent, phys_descent, max_phys_ascent, max_phys_descent;
1691 /* Current x pixel position within the display line. This value
1692 does not include the width of continuation lines in front of the
1693 line. The value of current_x is automatically incremented by
1694 pixel_width with each call to produce_glyphs. */
1695 int current_x;
1697 /* Accumulated width of continuation lines. If > 0, this means we
1698 are currently in a continuation line. This is initially zero and
1699 incremented/reset by display_line, move_it_to etc. */
1700 int continuation_lines_width;
1702 /* Current y-position. Automatically incremented by the height of
1703 glyph_row in move_it_to and display_line. */
1704 int current_y;
1706 /* Current vertical matrix position, or line number. Automatically
1707 incremented by move_it_to and display_line. */
1708 int vpos;
1710 /* Horizontal matrix position reached in move_it_in_display_line.
1711 Only set there, not in display_line. */
1712 int hpos;
1716 /* Access to positions of iterator IT. */
1718 #define IT_CHARPOS(IT) CHARPOS ((IT).current.pos)
1719 #define IT_BYTEPOS(IT) BYTEPOS ((IT).current.pos)
1720 #define IT_STRING_CHARPOS(IT) CHARPOS ((IT).current.string_pos)
1721 #define IT_STRING_BYTEPOS(IT) BYTEPOS ((IT).current.string_pos)
1723 /* Test if IT has reached the end of its buffer or string. This will
1724 only work after get_next_display_element has been called. */
1726 #define ITERATOR_AT_END_P(IT) ((IT)->what == IT_EOB)
1728 /* Non-zero means IT is at the end of a line. This is the case if it
1729 is either on a newline or on a carriage return and selective
1730 display hides the rest of the line. */
1732 #define ITERATOR_AT_END_OF_LINE_P(IT) \
1733 ((IT)->what == IT_CHARACTER \
1734 && ((IT)->c == '\n' \
1735 || ((IT)->c == '\r' && (IT)->selective)))
1737 /* Call produce_glyphs or produce_glyphs_hook, if set. Shortcut to
1738 avoid the function call overhead. */
1740 #define PRODUCE_GLYPHS(IT) \
1741 (rif \
1742 ? rif->produce_glyphs ((IT)) \
1743 : produce_glyphs ((IT)))
1745 /* Bit-flags indicating what operation move_it_to should perform. */
1747 enum move_operation_enum
1749 /* Stop if specified x-position is reached. */
1750 MOVE_TO_X = 0x01,
1752 /* Stop if specified y-position is reached. */
1753 MOVE_TO_Y = 0x02,
1755 /* Stop if specified vpos is reached. */
1756 MOVE_TO_VPOS = 0x04,
1758 /* Stop if specified buffer or string position is reached. */
1759 MOVE_TO_POS = 0x08
1764 /***********************************************************************
1765 Window-based redisplay interface
1766 ***********************************************************************/
1768 /* Structure used to describe runs of lines that must be scrolled. */
1770 struct run
1772 /* Source and destination y pixel position. */
1773 int desired_y, current_y;
1775 /* Source and destination vpos in matrix. */
1776 int desired_vpos, current_vpos;
1778 /* Height in pixels, number of glyph rows. */
1779 int height, nrows;
1783 /* Structure holding system-dependent interface functions needed
1784 for window-based redisplay. */
1786 struct redisplay_interface
1788 /* Produce glyphs/get display metrics for the display element IT is
1789 loaded with. */
1790 void (*produce_glyphs) P_ ((struct it *it));
1792 /* Write or insert LEN glyphs from STRING at the nominal output
1793 position. */
1794 void (*write_glyphs) P_ ((struct glyph *string, int len));
1795 void (*insert_glyphs) P_ ((struct glyph *start, int len));
1797 /* Clear from nominal output position to X. X < 0 means clear
1798 to right end of display. */
1799 void (*clear_end_of_line) P_ ((int x));
1801 /* Function to call to scroll the display as described by RUN on
1802 window W. */
1803 void (*scroll_run_hook) P_ ((struct window *w, struct run *run));
1805 /* Function to call after a line in a display has been completely
1806 updated. Used to draw truncation marks and alike. DESIRED_ROW
1807 is the desired row which has been updated. */
1808 void (*after_update_window_line_hook) P_ ((struct glyph_row *desired_row));
1810 /* Function to call before beginning to update window W in
1811 window-based redisplay. */
1812 void (*update_window_begin_hook) P_ ((struct window *w));
1814 /* Function to call after window W has been updated in window-based
1815 redisplay. CURSOR_ON_P non-zero means switch cursor on. */
1816 void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p));
1818 /* Move cursor to row/column position VPOS/HPOS, pixel coordinates
1819 Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
1820 are window-relative pixel positions. */
1821 void (*cursor_to) P_ ((int vpos, int hpos, int y, int x));
1823 /* Flush the display of frame F. For X, this is XFlush. */
1824 void (*flush_display) P_ ((struct frame *f));
1826 /* Set *LEFT and *RIGHT to the left and right overhang of GLYPH on
1827 frame F. */
1828 void (*get_glyph_overhangs) P_ ((struct glyph *glyph, struct frame *f,
1829 int *left, int *right));
1831 /* Fix the display of AREA of ROW in window W for overlapping rows.
1832 This function is called from redraw_overlapping_rows after
1833 desired rows have been made current. */
1834 void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row,
1835 enum glyph_row_area area));
1838 /* The current interface for window-based redisplay. */
1840 extern struct redisplay_interface *rif;
1842 /* Hook to call in estimate_mode_line_height. */
1844 extern int (* estimate_mode_line_height_hook) P_ ((struct frame *,
1845 enum face_id));
1848 /***********************************************************************
1849 Images
1850 ***********************************************************************/
1852 #ifdef HAVE_WINDOW_SYSTEM
1854 /* Structure forward declarations. */
1856 struct image;
1859 /* Each image format (JPEG, IIFF, ...) supported is described by
1860 a structure of the type below. */
1862 struct image_type
1864 /* A symbol uniquely identifying the image type, .e.g `jpeg'. */
1865 Lisp_Object *type;
1867 /* Check that SPEC is a valid image specification for the given
1868 image type. Value is non-zero if SPEC is valid. */
1869 int (* valid_p) P_ ((Lisp_Object spec));
1871 /* Load IMG which is used on frame F from information contained in
1872 IMG->spec. Value is non-zero if successful. */
1873 int (* load) P_ ((struct frame *f, struct image *img));
1875 /* Free resources of image IMG which is used on frame F. */
1876 void (* free) P_ ((struct frame *f, struct image *img));
1878 /* Next in list of all supported image types. */
1879 struct image_type *next;
1883 /* Structure describing an image. Specific image formats like XBM are
1884 converted into this form, so that display only has to deal with
1885 this type of image. */
1887 struct image
1889 /* The time in seconds at which the image was last displayed. Set
1890 in prepare_image_for_display. */
1891 unsigned long timestamp;
1893 /* Pixmaps of the image. */
1894 Pixmap pixmap, mask;
1896 /* Colors allocated for this image, if any. Allocated via xmalloc. */
1897 unsigned long *colors;
1898 int ncolors;
1900 /* Width and height of the image. */
1901 int width, height;
1903 /* These values are used for the rectangles displayed for images
1904 that can't be loaded. */
1905 #define DEFAULT_IMAGE_WIDTH 30
1906 #define DEFAULT_IMAGE_HEIGHT 30
1908 /* Percent of image height used as ascent. */
1909 int ascent;
1910 #define DEFAULT_IMAGE_ASCENT 50
1912 /* Lisp specification of this image. */
1913 Lisp_Object spec;
1915 /* Relief to draw around the image. */
1916 int relief;
1918 /* Optional margin around the image. This includes the relief. */
1919 int margin;
1921 /* Reference to the type of the image. */
1922 struct image_type *type;
1924 /* 1 means that loading the image failed. Don't try again. */
1925 unsigned load_failed_p;
1927 /* A place for image types to store additional data. The member
1928 data.lisp_val is marked during GC, so it's safe to store Lisp data
1929 there. Image types should free this data when their `free'
1930 function is called. */
1931 struct
1933 int int_val;
1934 void *ptr_val;
1935 Lisp_Object lisp_val;
1936 } data;
1938 /* Hash value of image specification to speed up comparisons. */
1939 unsigned hash;
1941 /* Image id of this image. */
1942 int id;
1944 /* Hash collision chain. */
1945 struct image *next, *prev;
1949 /* Cache of images. Each frame has a cache. X frames with the same
1950 x_display_info share their caches. */
1952 struct image_cache
1954 /* Hash table of images. */
1955 struct image **buckets;
1957 /* Vector mapping image ids to images. */
1958 struct image **images;
1960 /* Allocated size of `images'. */
1961 unsigned size;
1963 /* Number of images in the cache. */
1964 unsigned used;
1966 /* Reference count (number of frames sharing this cache). */
1967 int refcount;
1971 /* Value is the ascent of image IMG. */
1973 #define IMAGE_ASCENT(IMG) \
1974 (((IMG)->height + (IMG)->margin) * (IMG)->ascent / 100.0)
1976 /* Value is a pointer to the image with id ID on frame F, or null if
1977 no image with that id exists. */
1979 #define IMAGE_FROM_ID(F, ID) \
1980 (((ID) >= 0 && (ID) < (FRAME_X_IMAGE_CACHE (F)->used)) \
1981 ? FRAME_X_IMAGE_CACHE (F)->images[ID] \
1982 : NULL)
1984 /* Size of bucket vector of image caches. Should be prime. */
1986 #define IMAGE_CACHE_BUCKETS_SIZE 1001
1988 #endif /* HAVE_WINDOW_SYSTEM */
1992 /***********************************************************************
1993 Tool-bars
1994 ***********************************************************************/
1996 /* Enumeration defining where to find tool-bar item information in
1997 tool-bar items vectors stored with frames. Each tool-bar item
1998 occupies TOOL_BAR_ITEM_NSLOTS elements in such a vector. */
2000 enum tool_bar_item_idx
2002 /* The key of the tool-bar item. Used to remove items when a binding
2003 for `undefined' is found. */
2004 TOOL_BAR_ITEM_KEY,
2006 /* Non-nil if item is enabled. */
2007 TOOL_BAR_ITEM_ENABLED_P,
2009 /* Non-nil if item is selected (pressed). */
2010 TOOL_BAR_ITEM_SELECTED_P,
2012 /* Caption. */
2013 TOOL_BAR_ITEM_CAPTION,
2015 /* Image(s) to display. This is either a single image specification
2016 or a vector of specifications. */
2017 TOOL_BAR_ITEM_IMAGES,
2019 /* The binding. */
2020 TOOL_BAR_ITEM_BINDING,
2022 /* Button type. One of nil, `:radio' or `:toggle'. */
2023 TOOL_BAR_ITEM_TYPE,
2025 /* Help string. */
2026 TOOL_BAR_ITEM_HELP,
2028 /* Sentinel = number of slots in tool_bar_items occupied by one
2029 tool-bar item. */
2030 TOOL_BAR_ITEM_NSLOTS
2034 /* An enumeration for the different images that can be specified
2035 for a tool-bar item. */
2037 enum tool_bar_item_image
2039 TOOL_BAR_IMAGE_ENABLED_SELECTED,
2040 TOOL_BAR_IMAGE_ENABLED_DESELECTED,
2041 TOOL_BAR_IMAGE_DISABLED_SELECTED,
2042 TOOL_BAR_IMAGE_DISABLED_DESELECTED
2045 /* Non-zero means raise tool-bar buttons when the mouse moves over them. */
2047 extern int auto_raise_tool_bar_buttons_p;
2049 /* Margin around tool-bar buttons in pixels. */
2051 extern int tool_bar_button_margin;
2053 /* Thickness of relief to draw around tool-bar buttons. */
2055 extern int tool_bar_button_relief;
2059 /***********************************************************************
2060 Function Prototypes
2061 ***********************************************************************/
2063 /* Defined in xdisp.c */
2065 void resize_echo_area_axactly P_ ((void));
2066 int resize_mini_window P_ ((struct window *, int));
2067 int try_window P_ ((Lisp_Object, struct text_pos));
2068 void window_box P_ ((struct window *, int, int *, int *, int *, int *));
2069 int window_box_height P_ ((struct window *));
2070 int window_text_bottom_y P_ ((struct window *));
2071 int window_box_width P_ ((struct window *, int));
2072 int window_box_left P_ ((struct window *, int));
2073 int window_box_right P_ ((struct window *, int));
2074 void window_box_edges P_ ((struct window *, int, int *, int *, int *, int *));
2075 void mark_window_display_accurate P_ ((Lisp_Object, int));
2076 void redisplay_preserve_echo_area P_ ((void));
2077 void set_cursor_from_row P_ ((struct window *, struct glyph_row *,
2078 struct glyph_matrix *, int, int, int, int));
2079 void init_iterator P_ ((struct it *, struct window *, int,
2080 int, struct glyph_row *, enum face_id));
2081 void init_iterator_to_row_start P_ ((struct it *, struct window *,
2082 struct glyph_row *));
2083 int get_next_display_element P_ ((struct it *));
2084 void set_iterator_to_next P_ ((struct it *));
2085 void produce_glyphs P_ ((struct it *));
2086 void produce_special_glyphs P_ ((struct it *, enum display_element_type));
2087 void start_display P_ ((struct it *, struct window *, struct text_pos));
2088 void move_it_to P_ ((struct it *, int, int, int, int, int));
2089 void move_it_vertically P_ ((struct it *, int));
2090 void move_it_by_lines P_ ((struct it *, int, int));
2091 int frame_mode_line_height P_ ((struct frame *));
2092 void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *));
2093 int tool_bar_item_info P_ ((struct frame *, struct glyph *, int *));
2094 extern Lisp_Object Qtool_bar;
2095 extern Lisp_Object Vshow_trailing_whitespace;
2096 extern int redisplaying_p;
2097 extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));
2099 /* Defined in sysdep.c */
2101 void get_frame_size P_ ((int *, int *));
2102 void request_sigio P_ ((void));
2103 void unrequest_sigio P_ ((void));
2104 int tabs_safe_p P_ ((void));
2105 void init_baud_rate P_ ((void));
2106 void init_sigio P_ ((int));
2108 /* Defined in xfaces.c */
2110 #ifdef USE_X_TOOLKIT
2111 void x_set_menu_resources_from_menu_face P_ ((struct frame *, Widget));
2112 #endif
2113 #ifdef HAVE_X_WINDOWS
2114 void x_free_colors P_ ((struct frame *, unsigned long *, int));
2115 #endif
2117 void update_face_from_frame_parameter P_ ((struct frame *, Lisp_Object,
2118 Lisp_Object));
2119 Lisp_Object tty_color_name P_ ((struct frame *, int));
2120 void clear_face_cache P_ ((int));
2121 unsigned long load_color P_ ((struct frame *, struct face *, Lisp_Object,
2122 enum lface_attribute_index));
2123 void unload_color P_ ((struct frame *, unsigned long));
2124 int frame_update_line_height P_ ((struct frame *));
2125 int ascii_face_of_lisp_face P_ ((struct frame *, int));
2126 void prepare_face_for_display P_ ((struct frame *, struct face *));
2127 int xstricmp P_ ((unsigned char *, unsigned char *));
2128 int lookup_face P_ ((struct frame *, Lisp_Object *, int, struct face *));
2129 int lookup_named_face P_ ((struct frame *, Lisp_Object, int));
2130 int smaller_face P_ ((struct frame *, int, int));
2131 int face_with_height P_ ((struct frame *, int, int));
2132 int lookup_derived_face P_ ((struct frame *, Lisp_Object, int, int));
2133 void init_frame_faces P_ ((struct frame *));
2134 void free_frame_faces P_ ((struct frame *));
2135 void recompute_basic_faces P_ ((struct frame *));
2136 int face_at_buffer_position P_ ((struct window *, int, int, int, int *,
2137 int, int));
2138 int face_at_string_position P_ ((struct window *, Lisp_Object,
2139 int, int, int, int, int *, enum face_id));
2140 int compute_char_face P_ ((struct frame *, int, Lisp_Object));
2141 void free_all_realized_faces P_ ((Lisp_Object));
2142 extern Lisp_Object Qforeground_color, Qbackground_color;
2143 void free_realized_multibyte_face P_ ((struct frame *, int));
2145 /* Defined in xfns.c */
2147 #ifdef HAVE_X_WINDOWS
2148 void gamma_correct P_ ((struct frame *, XColor *));
2149 #endif
2150 #ifdef WINDOWSNT
2151 void gamma_correct P_ ((struct frame *, COLORREF *));
2152 #endif
2154 #ifdef HAVE_WINDOW_SYSTEM
2156 void x_kill_gs_process P_ ((Pixmap, struct frame *));
2157 int x_screen_planes P_ ((struct frame *));
2158 void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
2159 struct image_cache *make_image_cache P_ ((void));
2160 void free_image_cache P_ ((struct frame *));
2161 void clear_image_cache P_ ((struct frame *, int));
2162 void forall_images_in_image_cache P_ ((struct frame *,
2163 void (*) P_ ((struct image *))));
2164 int valid_image_p P_ ((Lisp_Object));
2165 void prepare_image_for_display P_ ((struct frame *, struct image *));
2166 int lookup_image P_ ((struct frame *, Lisp_Object));
2167 extern struct frame *tip_frame;
2168 extern Window tip_window;
2169 EXFUN (Fx_show_tip, 4);
2170 EXFUN (Fx_hide_tip, 0);
2171 extern void start_busy_cursor P_ ((void));
2172 extern void cancel_busy_cursor P_ ((void));
2173 extern int display_busy_cursor_p;
2175 #endif /* HAVE_WINDOW_SYSTEM */
2178 /* Defined in xmenu.c */
2180 int popup_activated P_ ((void));
2182 /* Defined in dispnew.c */
2184 int estimate_mode_line_height P_ ((struct frame *, enum face_id));
2185 Lisp_Object mode_line_string P_ ((struct window *, int, int, int, int *));
2186 extern void redraw_frame P_ ((struct frame *));
2187 extern void redraw_garbaged_frames P_ ((void));
2188 extern void cancel_line P_ ((int, struct frame *));
2189 extern void init_desired_glyphs P_ ((struct frame *));
2190 extern int scroll_frame_lines P_ ((struct frame *, int, int, int, int));
2191 extern int direct_output_for_insert P_ ((int));
2192 extern int direct_output_forward_char P_ ((int));
2193 extern int update_frame P_ ((struct frame *, int, int));
2194 extern int scrolling P_ ((struct frame *));
2195 extern void bitch_at_user P_ ((void));
2196 void adjust_glyphs P_ ((struct frame *));
2197 void free_glyphs P_ ((struct frame *));
2198 void free_window_matrices P_ ((struct window *));
2199 void check_glyph_memory P_ ((void));
2200 void mirrored_line_dance P_ ((struct glyph_matrix *, int, int, int *, char *));
2201 void clear_glyph_matrix P_ ((struct glyph_matrix *));
2202 void clear_current_matrices P_ ((struct frame *f));
2203 void clear_desired_matrices P_ ((struct frame *));
2204 void shift_glyph_matrix P_ ((struct window *, struct glyph_matrix *,
2205 int, int, int));
2206 void rotate_matrix P_ ((struct glyph_matrix *, int, int, int));
2207 void increment_glyph_matrix_buffer_positions P_ ((struct glyph_matrix *,
2208 int, int, int, int));
2209 void blank_row P_ ((struct window *, struct glyph_row *, int));
2210 void increment_glyph_row_buffer_positions P_ ((struct glyph_row *, int, int));
2211 void enable_glyph_matrix_rows P_ ((struct glyph_matrix *, int, int, int));
2212 void clear_glyph_row P_ ((struct glyph_row *));
2213 void prepare_desired_row P_ ((struct glyph_row *));
2214 int line_hash_code P_ ((struct glyph_row *));
2215 void set_window_update_flags P_ ((struct window *, int));
2216 void write_glyphs P_ ((struct glyph *, int));
2217 void insert_glyphs P_ ((struct glyph *, int));
2218 void redraw_frame P_ ((struct frame *));
2219 void redraw_garbaged_frames P_ ((void));
2220 int scroll_cost P_ ((struct frame *, int, int, int));
2221 int direct_output_for_insert P_ ((int));
2222 int direct_output_forward_char P_ ((int));
2223 int update_frame P_ ((struct frame *, int, int));
2224 void update_single_window P_ ((struct window *, int));
2225 int scrolling P_ ((struct frame *));
2226 int buffer_posn_from_coords P_ ((struct window *, int *, int *));
2227 void do_pending_window_change P_ ((int));
2228 void change_frame_size P_ ((struct frame *, int, int, int, int, int));
2229 void bitch_at_user P_ ((void));
2230 Lisp_Object sit_for P_ ((int, int, int, int, int));
2231 void init_display P_ ((void));
2232 void syms_of_display P_ ((void));
2234 /* Defined in term.c */
2236 extern void ring_bell P_ ((void));
2237 extern void set_terminal_modes P_ ((void));
2238 extern void reset_terminal_modes P_ ((void));
2239 extern void update_begin P_ ((struct frame *));
2240 extern void update_end P_ ((struct frame *));
2241 extern void set_terminal_window P_ ((int));
2242 extern void set_scroll_region P_ ((int, int));
2243 extern void turn_off_insert P_ ((void));
2244 extern void turn_off_highlight P_ ((void));
2245 extern void background_highlight P_ ((void));
2246 extern void reassert_line_highlight P_ ((int, int));
2247 extern void clear_frame P_ ((void));
2248 extern void clear_end_of_line P_ ((int));
2249 extern void clear_end_of_line_raw P_ ((int));
2250 extern void delete_glyphs P_ ((int));
2251 extern void ins_del_lines P_ ((int, int));
2252 extern int string_cost P_ ((char *));
2253 extern int per_line_cost P_ ((char *));
2254 extern void calculate_costs P_ ((struct frame *));
2255 extern void term_init P_ ((char *));
2256 extern void fatal P_ ((/* char *, ... */));
2257 void cursor_to P_ ((int, int));
2258 void change_line_highlight P_ ((int, int, int, int));
2260 /* Defined in scroll.c */
2262 extern int scrolling_max_lines_saved P_ ((int, int, int *, int *, int *));
2263 extern int scroll_cost P_ ((struct frame *, int, int, int));
2264 extern void do_line_insertion_deletion_costs P_ ((struct frame *, char *,
2265 char *, char *, char *,
2266 char *, char *, int));
2267 void scrolling_1 P_ ((struct frame *, int, int, int, int *, int *, int *,
2268 int *, int));
2270 #endif /* not DISPEXTERN_H_INCLUDED */