update.
[chise/xemacs-chise.git.1] / src / redisplay.h
1 /* Redisplay data structures.
2    Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3    Copyright (C) 1996 Chuck Thompson.
4    Copyright (C) 1995, 1996 Ben Wing.
5
6 This file is part of XEmacs.
7
8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
11 later version.
12
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with XEmacs; see the file COPYING.  If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 /* Synched up with: Not in FSF. */
24
25 #ifndef INCLUDED_redisplay_h_
26 #define INCLUDED_redisplay_h_
27
28 #include "character.h"
29
30 /* Redisplay DASSERT types */
31 #define DB_DISP_POS             1
32 #define DB_DISP_TEXT_LAYOUT     2
33 #define DB_DISP_REDISPLAY       4
34
35 /* These are the possible return values from pixel_to_glyph_translation. */
36 #define OVER_MODELINE           0
37 #define OVER_TEXT               1
38 #define OVER_OUTSIDE            2
39 #define OVER_NOTHING            3
40 #define OVER_BORDER             4
41 #define OVER_TOOLBAR            5
42 #define OVER_V_DIVIDER          6
43
44 #define NO_BLOCK        -1
45
46 /* Imagine that the text in the buffer is displayed on a piece of paper
47    the width of the frame and very very tall.  The line start cache is
48    an array of struct line_start_cache's, describing the start and
49    end buffer positions for a contiguous set of lines on that piece
50    of paper. */
51
52 typedef struct line_start_cache line_start_cache;
53 struct line_start_cache
54 {
55   Bufpos start, end;
56   int height;
57 };
58
59 typedef struct
60 {
61   Dynarr_declare (line_start_cache);
62 } line_start_cache_dynarr;
63
64 /* The possible types of runes.
65
66    #### The Lisp_Glyph type is broken.  There should instead be a pixmap
67    type.  Currently the device-specific output routines have to worry
68    about whether the glyph is textual or not, etc.  For Mule this is
69    a big problem because you might need multiple fonts to display the
70    text.  It also eliminates optimizations that could come from glumping
71    the text of multiple text glyphs together -- this makes displaying
72    binary files (with lots of control chars, etc.) very very slow. */
73
74 #define RUNE_BLANK      0
75 #define RUNE_CHAR       1
76 #define RUNE_DGLYPH     2
77 #define RUNE_HLINE      3
78 #define RUNE_VLINE      4
79
80 #define CURSOR_ON       0
81 #define CURSOR_OFF      1
82 #define NO_CURSOR       2
83 #define NEXT_CURSOR     3
84 #define IGNORE_CURSOR   4
85
86 #define DEFAULT_INDEX   (face_index) 0
87 #define MODELINE_INDEX  (face_index) 1
88
89 /* A rune is a single display element, such as a printable character
90    or pixmap.  Any single character in a buffer has one or more runes
91    (or zero, if the character is invisible) corresponding to it.
92    (Printable characters typically have one rune associated with them,
93    but control characters have two -- a ^ and a letter -- and other
94    non-printing characters (those displayed in octal) have four. */
95
96 /* WARNING! In compare_runes (one of the most heavily used functions)
97    two runes are compared. So please be careful with changes to this
98    structure. See comments in compare_runes.
99
100    #### This should really be made smaller.
101 */
102
103 typedef struct rune rune;
104 struct rune
105 {
106   face_index findex;            /* face rune is displayed with.  The
107                                    face_index is an index into a
108                                    window-specific array of face cache
109                                    elements.  Each face cache element
110                                    corresponds to one "merged face"
111                                    (the result of merging all the
112                                    faces that overlap the rune) and
113                                    contains the instance values for
114                                    each of the face properties in this
115                                    particular window. */
116
117   Bufpos bufpos;                /* buffer position this rune is displaying;
118                                    for the modeline, the value here is a
119                                    Charcount, but who's looking? */
120   Bufpos endpos;                /* if set this rune covers a range of pos */
121                                 /* #### Chuck, what does it mean for a rune
122                                    to cover a range of pos?  I don't get
123                                    this. */
124                                 /* #### This isn't used as an rvalue anywhere!
125                                    remove! */
126
127
128   short xpos;                   /* horizontal starting position in pixels */
129   short width;                  /* pixel width of rune */
130
131
132   unsigned char cursor_type;    /* is this rune covered by the cursor? */
133   unsigned char type;           /* type of rune object */
134                                 /* We used to do bitfields here, but if I
135                                    (JV) count correctly that doesn't matter
136                                    for the size of the structure. All the bit
137                                    fiddling _does_ slow down redisplay by
138                                    about 10%. So don't do that */
139
140   union                         /* Information specific to the type of rune */
141   {
142     /* #### Glyphs are rare. Is it really necessary to waste 8 bytes on every
143        rune for that?! */
144     /* DGLYPH */
145     struct
146     {
147       Lisp_Object glyph;
148       Lisp_Object extent;       /* extent rune is attached to, if any.
149                                    If this is a rune in the modeline
150                                    then this might be nil. */
151
152       int ascent;               /* Ascent of this glyph, in pixels. */
153       int descent;              /* Descent of this glyph, in pixels. */
154       int yoffset;              /* Offset from line top to reach glyph top */
155       int xoffset;              /* Number of pixels that need to be
156                                    chopped off the left of the glyph.
157                                    This has the effect of shifting the
158                                    glyph to the left while still clipping
159                                    at XPOS. */
160     } dglyph;
161
162     /* CHAR */
163     struct Charc cglyph;        /* Character of this rune. */
164
165     /* HLINE */
166     struct
167     {
168       short thickness;  /* how thick to make hline */
169       short yoffset;    /* how far down from top of line to put top */
170     } hline;
171   } object;                     /* actual rune object */
172 };
173
174 typedef struct
175 {
176   Dynarr_declare (rune);
177 } rune_dynarr;
178
179 /* These must have distinct values.  Note that the ordering actually
180    represents priority levels.  TEXT has the lowest priority level. */
181 enum display_type
182 {
183   TEXT,
184   LEFT_OUTSIDE_MARGIN,
185   LEFT_INSIDE_MARGIN,
186   RIGHT_INSIDE_MARGIN,
187   RIGHT_OUTSIDE_MARGIN,
188   OVERWRITE
189 };
190
191 /* A display block represents a run of text on a single line.
192    Apparently there is only one display block per line for each
193    of the types listed in `enum display_type'.
194
195    A display block consists mostly of an array of runes, one per
196    atomic display element (printable character, pixmap, etc.). */
197
198 /* #### Yuckity yuckity yuck yuck yuck yuck yuck!!
199
200    Chuck, I think you should redo this.  It should not be the
201    responsibility of the device-specific code to worry about
202    the different faces.  The generic stuff in redisplay-output.c
203    should glump things up into sub-blocks, each of which
204    corresponds to a single pixmap or a single run of text in
205    the same font.
206
207    It might still make sense for the device-specific output routine
208    to get passed an entire display line.  That way, it can make
209    calls to XDrawText() (which draws multiple runs of single-font
210    data) instead of XDrawString().  The reason for this is to
211    reduce the amount of X traffic, which will help things significantly
212    on a slow line. */
213
214 typedef struct display_block display_block;
215 struct display_block
216 {
217   enum display_type type;       /* type of display block */
218
219   int start_pos;                /* starting pixel position of block */
220   int end_pos;                  /* ending pixel position of block */
221
222   rune_dynarr *runes;           /* Dynamic array of runes */
223 };
224
225 typedef struct
226 {
227   Dynarr_declare (display_block);
228 } display_block_dynarr;
229
230 typedef struct layout_bounds_type
231 {
232   int left_out;
233   int left_in;
234   int left_white;
235   int right_white;
236   int right_in;
237   int right_out;
238 } layout_bounds;
239
240 typedef struct glyph_block glyph_block;
241 struct glyph_block
242 {
243   Lisp_Object glyph;
244   Lisp_Object extent;
245   /* The rest are only used by margin routines. */
246   face_index findex;
247   int active;
248   int width;
249 };
250
251 typedef struct
252 {
253   Dynarr_declare (glyph_block);
254 } glyph_block_dynarr;
255
256 /*************************************************************************/
257 /*                              display lines                             */
258 /*************************************************************************/
259
260 /*  Modeline commentary: IMO the modeline is handled very badly, we
261   special case virtually *everything* in the redisplay routines for
262   the modeline. The fact that dl->bufpos can be either a buffer
263   position or a char count highlights this. There is no abstraction at
264   all that I can find and it means that the code is made very ugly as
265   a result. Either we should treat the modeline *entirely* separately,
266   or we should abstract to something that applies equally well to the
267   modeline and to buffer text, the things are not enormously different
268   after all and handling them identically at some level would
269   eliminate some bugs that still exist (mainly to do with modeline
270   handling). This problem doesn't help trying to implement gutters
271   which are somewhere in between buffer text and modeline text.
272
273   Redisplay commentary: Everything in redisplay is tied very tightly
274   to the things that are being displayed, and the context,
275   e.g. buffers and windows. According to Chuck this is so that we can
276   get speed, which seems fine to me, however this usage is extended
277   too far down the redisplay routines IMO. At some level there should
278   be functions that know how to display strings with extents and
279   faces, regardless of buffer etc. After all the window system does
280   not care. <andy@xemacs.org> */
281
282 typedef struct display_line display_line;
283 struct display_line
284 {
285   short ypos;                           /* vertical position in pixels
286                                            of the baseline for this line. */
287   unsigned short ascent, descent;       /* maximum values for this line.
288                                            The ascent is the number of
289                                            pixels above the baseline, and
290                                            the descent is the number of
291                                            pixels below the baseline.
292                                            The descent includes the baseline
293                                            pixel-row itself, I think. */
294   unsigned short clip;                  /* amount of bottom of line to clip
295                                            in pixels.*/
296   unsigned short top_clip;              /* amount of top of line to clip
297                                            in pixels.*/
298   Bufpos bufpos;                        /* first buffer position on line */
299   Bufpos end_bufpos;                    /* last buffer position on line */
300   Charcount offset;                     /* adjustment to bufpos vals */
301   Charcount num_chars;                  /* # of chars on line
302                                            including expansion of tabs
303                                            and control chars */
304   int cursor_elt;                       /* rune block of TEXT display
305                                            block cursor is at or -1 */
306   char used_prop_data;                  /* can't incrementally update if line
307                                            used propagation data */
308
309   layout_bounds bounds;                 /* line boundary positions */
310
311   char modeline;                        /* t if this line is a modeline */
312
313   char line_continuation;               /* t if this line continues to
314                                            next display line. */
315
316   /* Dynamic array of display blocks */
317   display_block_dynarr *display_blocks;
318
319   /* Dynamic arrays of left and right glyph blocks */
320   glyph_block_dynarr *left_glyphs;
321   glyph_block_dynarr *right_glyphs;
322
323   face_index    left_margin_findex;
324   face_index    right_margin_findex;
325   face_index    default_findex;
326 };
327
328 #define DISPLAY_LINE_HEIGHT(dl) \
329 (dl->ascent + dl->descent - (dl->clip + dl->top_clip))
330 #define DISPLAY_LINE_YPOS(dl) \
331 (dl->ypos - (dl->ascent - dl->top_clip))
332 #define DISPLAY_LINE_YEND(dl) \
333 ((dl->ypos + dl->descent) - dl->clip)
334
335 typedef struct
336 {
337   Dynarr_declare (display_line);
338 } display_line_dynarr;
339
340 /* The following two structures are used to represent an area to
341 displayed and where to display it. Using these two structures all
342 combinations of clipping and position can be accommodated.  */
343
344 /* This represents an area to be displayed into. */
345 typedef struct display_box display_box;
346 struct display_box
347 {
348   int xpos;             /* absolute horizontal position of area */
349   int ypos;             /* absolute vertical position of area */
350   int width, height;
351 };
352
353 /* This represents the area from a glyph to be displayed. */
354 typedef struct display_glyph_area display_glyph_area;
355 struct display_glyph_area
356 {
357   int xoffset;          /* horizontal offset of the glyph, +ve means
358                            display the glyph with x offset by xoffset,
359                            -ve means display starting xoffset into the
360                            glyph. */
361   int yoffset;          /* vertical offset of the glyph, +ve means
362                            display the glyph with y offset by yoffset,
363                            -ve means display starting xoffset into the
364                            glyph. */
365   int width, height;    /* width and height of glyph to display. */
366 };
367
368 /* It could be argued that the following two structs belong in
369    extents.h, but they're only used by redisplay and it simplifies
370    the header files to put them here. */
371
372 typedef struct
373 {
374   Dynarr_declare (EXTENT);
375 } EXTENT_dynarr;
376
377 struct font_metric_info
378 {
379   int width;
380   int height;                   /* always ascent + descent; for convenience */
381   int ascent;
382   int descent;
383
384   int proportional_p;
385 };
386
387 /* NOTE NOTE NOTE: Currently the positions in an extent fragment
388    structure are Bytind's, not Bufpos's.  This could change. */
389
390 struct extent_fragment
391 {
392   Lisp_Object object; /* buffer or string */
393   struct frame *frm;
394   Bytind pos, end;
395   EXTENT_dynarr *extents;
396   glyph_block_dynarr *begin_glyphs, *end_glyphs;
397   unsigned int invisible:1;
398   unsigned int invisible_ellipses:1;
399   unsigned int previously_invisible:1;
400   unsigned int invisible_ellipses_already_displayed:1;
401 };
402
403 #define EDGE_TOP 1
404 #define EDGE_LEFT 2
405 #define EDGE_BOTTOM 4
406 #define EDGE_RIGHT 8
407 #define EDGE_ALL (EDGE_TOP | EDGE_LEFT | EDGE_BOTTOM | EDGE_RIGHT)
408
409 \f
410 /*************************************************************************/
411 /*                              change flags                             */
412 /*************************************************************************/
413
414 /* Quick flags to signal redisplay.  redisplay() sets them all to 0
415    when it finishes.  If none of them are set when it starts, it
416    assumes that nothing needs to be done.  Functions that make a change
417    that is (potentially) visible on the screen should set the
418    appropriate flag.
419
420    If any of these flags are set, redisplay will look more carefully
421    to see if anything has really changed. */
422
423 /* Nonzero if the contents of a buffer have changed since the last time
424    redisplay completed. */
425 extern int buffers_changed;
426 extern int buffers_changed_set;
427
428 /* Nonzero if head_clip or tail_clip of a buffer has changed
429    since last redisplay that finished. */
430 extern int clip_changed;
431 extern int clip_changed_set;
432
433 /* Nonzero if any extent has changed since the last time redisplay completed. */
434 extern int extents_changed;
435 extern int extents_changed_set;
436
437 /* Nonzero if any face has changed since the last time redisplay completed. */
438 extern int faces_changed;
439
440 /* Nonzero means one or more frames have been marked as garbaged. */
441 extern int frame_changed;
442
443 /* True if any of the builtin display glyphs (continuation,
444    hscroll, control-arrow, etc) is in need of updating
445    somewhere. */
446 extern int glyphs_changed;
447 extern int glyphs_changed_set;
448
449 /* True if any displayed subwindow is in need of updating
450    somewhere. */
451 extern int subwindows_changed;
452 extern int subwindows_changed_set;
453
454 /* True if any displayed subwindow is in need of updating
455    somewhere. */
456 extern int subwindows_state_changed;
457 extern int subwindows_state_changed_set;
458
459 /* True if an icon is in need of updating somewhere. */
460 extern int icon_changed;
461 extern int icon_changed_set;
462
463 /* True if a menubar is in need of updating somewhere. */
464 extern int menubar_changed;
465 extern int menubar_changed_set;
466
467 /* True iff we should redraw the modelines on the next redisplay. */
468 extern int modeline_changed;
469 extern int modeline_changed_set;
470
471 /* Nonzero if point has changed in some buffer since the last time
472    redisplay completed. */
473 extern int point_changed;
474 extern int point_changed_set;
475
476 /* Nonzero if some frame has changed its size. */
477 extern int size_changed;
478
479 /* Nonzero if some device has signaled that it wants to change size. */
480 extern int asynch_device_change_pending;
481
482 /* Nonzero if some frame has changed the layout of internal elements
483    (gutters or toolbars). */
484 extern int frame_layout_changed;
485
486 /* Nonzero if any toolbar has changed. */
487 extern int toolbar_changed;
488 extern int toolbar_changed_set;
489
490 /* Nonzero if any gutter has changed. */
491 extern int gutter_changed;
492 extern int gutter_changed_set;
493
494 /* Nonzero if any window has changed since the last time redisplay completed */
495 extern int windows_changed;
496
497 /* Nonzero if any frame's window structure has changed since the last
498    time redisplay completed. */
499 extern int windows_structure_changed;
500
501 /* These macros can be relatively expensive.  Since they are often
502    called numerous times between each call to redisplay, we keep track
503    if each has already been called and don't bother doing most of the
504    work if it is currently set. */
505
506 #define MARK_TYPE_CHANGED(object) do {                          \
507   if (!object##_changed_set) {                                  \
508     Lisp_Object MTC_devcons, MTC_concons;                       \
509     DEVICE_LOOP_NO_BREAK (MTC_devcons, MTC_concons)             \
510       {                                                         \
511         Lisp_Object MTC_frmcons;                                \
512         struct device *MTC_d = XDEVICE (XCAR (MTC_devcons));    \
513         DEVICE_FRAME_LOOP (MTC_frmcons, MTC_d)                  \
514           {                                                     \
515             struct frame *MTC_f = XFRAME (XCAR (MTC_frmcons));  \
516             MTC_f->object##_changed = 1;                        \
517             MTC_f->modiff++;                                    \
518           }                                                     \
519         MTC_d->object##_changed = 1;                            \
520       }                                                         \
521     object##_changed = 1;                                       \
522     object##_changed_set = 1; }                                 \
523   }  while (0)
524
525 #define MARK_BUFFERS_CHANGED MARK_TYPE_CHANGED (buffers)
526 #define MARK_CLIP_CHANGED MARK_TYPE_CHANGED (clip)
527 #define MARK_EXTENTS_CHANGED MARK_TYPE_CHANGED (extents)
528 #define MARK_ICON_CHANGED MARK_TYPE_CHANGED (icon)
529 #define MARK_MENUBAR_CHANGED MARK_TYPE_CHANGED (menubar)
530 #define MARK_MODELINE_CHANGED MARK_TYPE_CHANGED (modeline)
531 #define MARK_POINT_CHANGED MARK_TYPE_CHANGED (point)
532 #define MARK_TOOLBAR_CHANGED MARK_TYPE_CHANGED (toolbar)
533 #define MARK_GUTTER_CHANGED MARK_TYPE_CHANGED (gutter)
534 #define MARK_GLYPHS_CHANGED MARK_TYPE_CHANGED (glyphs)
535 #define MARK_SUBWINDOWS_CHANGED MARK_TYPE_CHANGED (subwindows)
536 #define MARK_SUBWINDOWS_STATE_CHANGED MARK_TYPE_CHANGED (subwindows_state)
537
538
539 #define CLASS_RESET_CHANGED_FLAGS(p) do {       \
540   (p)->buffers_changed = 0;                     \
541   (p)->clip_changed = 0;                        \
542   (p)->extents_changed = 0;                     \
543   (p)->faces_changed = 0;                       \
544   (p)->frame_changed = 0;                       \
545   (p)->frame_layout_changed = 0;                \
546   (p)->icon_changed = 0;                        \
547   (p)->menubar_changed = 0;                     \
548   (p)->modeline_changed = 0;                    \
549   (p)->point_changed = 0;                       \
550   (p)->toolbar_changed = 0;                     \
551   (p)->gutter_changed = 0;                      \
552   (p)->glyphs_changed = 0;                      \
553   (p)->subwindows_changed = 0;                  \
554   (p)->subwindows_state_changed = 0;            \
555   (p)->windows_changed = 0;                     \
556   (p)->windows_structure_changed = 0;           \
557 } while (0)
558
559 #define GLOBAL_RESET_CHANGED_FLAGS do {         \
560   buffers_changed = 0;                          \
561   clip_changed = 0;                             \
562   extents_changed = 0;                          \
563   frame_changed = 0;                            \
564   frame_layout_changed = 0;                     \
565   icon_changed = 0;                             \
566   menubar_changed = 0;                          \
567   modeline_changed = 0;                         \
568   point_changed = 0;                            \
569   toolbar_changed = 0;                          \
570   gutter_changed = 0;                           \
571   glyphs_changed = 0;                           \
572   subwindows_changed = 0;                       \
573   subwindows_state_changed = 0;                 \
574   windows_changed = 0;                          \
575   windows_structure_changed = 0;                \
576 } while (0)
577
578 #define CLASS_REDISPLAY_FLAGS_CHANGEDP(p)       \
579   ( (p)->buffers_changed ||                     \
580     (p)->clip_changed ||                        \
581     (p)->extents_changed ||                     \
582     (p)->faces_changed ||                       \
583     (p)->frame_changed ||                       \
584     (p)->frame_layout_changed ||                \
585     (p)->icon_changed ||                        \
586     (p)->menubar_changed ||                     \
587     (p)->modeline_changed ||                    \
588     (p)->point_changed ||                       \
589     (p)->toolbar_changed ||                     \
590     (p)->gutter_changed ||                      \
591     (p)->glyphs_changed ||                      \
592     (p)->size_changed ||                        \
593     (p)->subwindows_changed ||                  \
594     (p)->subwindows_state_changed ||            \
595     (p)->windows_changed ||                     \
596     (p)->windows_structure_changed )
597
598 #define GLOBAL_REDISPLAY_FLAGS_CHANGEDP         \
599   ( buffers_changed ||                          \
600     clip_changed ||                             \
601     extents_changed ||                          \
602     faces_changed ||                            \
603     frame_changed ||                            \
604     frame_layout_changed ||                     \
605     icon_changed ||                             \
606     menubar_changed ||                          \
607     modeline_changed ||                         \
608     point_changed ||                            \
609     toolbar_changed ||                          \
610     gutter_changed ||                           \
611     glyphs_changed ||                           \
612     size_changed ||                             \
613     subwindows_changed ||                       \
614     subwindows_state_changed ||                 \
615     windows_changed ||                          \
616     windows_structure_changed )
617
618
619 /* Anytime a console, device or frame is added or deleted we need to reset
620    these flags. */
621 #define RESET_CHANGED_SET_FLAGS do {    \
622   buffers_changed_set = 0;              \
623   clip_changed_set = 0;                 \
624   extents_changed_set = 0;              \
625   icon_changed_set = 0;                 \
626   menubar_changed_set = 0;              \
627   modeline_changed_set = 0;             \
628   point_changed_set = 0;                \
629   toolbar_changed_set = 0;              \
630   gutter_changed_set = 0;               \
631   glyphs_changed_set = 0;               \
632   subwindows_changed_set = 0;           \
633   subwindows_state_changed_set = 0;     \
634 } while (0)
635
636 \f
637 /*************************************************************************/
638 /*                       redisplay global variables                      */
639 /*************************************************************************/
640
641 /* redisplay structure used by various utility routines. */
642 extern display_line_dynarr *cmotion_display_lines;
643
644 /* Nonzero means truncate lines in all windows less wide than the frame. */
645 extern int truncate_partial_width_windows;
646
647 /* Nonzero if we're in a display critical section. */
648 extern int in_display;
649
650 /* Nonzero means no need to redraw the entire frame on resuming
651    a suspended Emacs.  This is useful on terminals with multiple pages,
652    where one page is used for Emacs and another for all else. */
653 extern int no_redraw_on_reenter;
654
655 /* Non-nil means flash the frame instead of ringing the bell.  */
656 extern Lisp_Object Vvisible_bell;
657
658 /* Thickness of shadow border around 3D modelines. */
659 extern Lisp_Object Vmodeline_shadow_thickness;
660
661 /* Scroll if point lands on the bottom line and that line is partially
662    clipped. */
663 extern int scroll_on_clipped_lines;
664
665 extern Lisp_Object Vglobal_mode_string;
666
667 /* The following two variables are defined in emacs.c and are used
668    to convey information discovered on the command line way early
669    (before *anything* is initialized). */
670
671 /* If non-zero, a window-system was specified on the command line.
672    Defined in emacs.c. */
673 extern int display_arg;
674
675 /* Type of display specified.  Defined in emacs.c. */
676 extern const char *display_use;
677
678 /* Nonzero means reading single-character input with prompt
679    so put cursor on minibuffer after the prompt.  */
680
681 extern int cursor_in_echo_area;
682
683 extern Lisp_Object Qbar_cursor, Qcursor_in_echo_area, Vwindow_system;
684
685 extern Lisp_Object Qtop_bottom;
686
687 \f
688 /*************************************************************************/
689 /*                     redisplay exported functions                      */
690 /*************************************************************************/
691 EXFUN (Fredraw_frame, 2);
692
693 int redisplay_text_width_string (struct window *w, int findex,
694                                  Bufbyte *nonreloc, Lisp_Object reloc,
695                                  Bytecount offset, Bytecount len);
696 int redisplay_frame_text_width_string (struct frame *f,
697                                        Lisp_Object face,
698                                        Bufbyte *nonreloc,
699                                        Lisp_Object reloc,
700                                        Bytecount offset, Bytecount len);
701 int redisplay_frame (struct frame *f, int preemption_check);
702 void redisplay (void);
703 struct display_block *get_display_block_from_line (struct display_line *dl,
704                                                    enum display_type type);
705 layout_bounds calculate_display_line_boundaries (struct window *w,
706                                                  int modeline);
707 Bufpos point_at_center (struct window *w, int type, Bufpos start,
708                         Bufpos point);
709 int line_at_center (struct window *w, int type, Bufpos start, Bufpos point);
710 int window_half_pixpos (struct window *w);
711 void redisplay_echo_area (void);
712 void free_display_structs (struct window_mirror *mir);
713 void free_display_lines (display_line_dynarr *dla);
714 void mark_redisplay_structs (display_line_dynarr *dla);
715 void generate_displayable_area (struct window *w, Lisp_Object disp_string,
716                                 int xpos, int ypos, int width, int height,
717                                 display_line_dynarr* dl,
718                                 Bufpos start_pos, face_index default_face);
719 /* `generate_title_string' in frame.c needs this */
720 void generate_formatted_string_db (Lisp_Object format_str,
721                                    Lisp_Object result_str,
722                                    struct window *w,
723                                    struct display_line *dl,
724                                    struct display_block *db,
725                                    face_index findex,
726                                    int min_pixpos, int max_pixpos, int type);
727 int real_current_modeline_height (struct window *w);
728 int pixel_to_glyph_translation (struct frame *f, int x_coord,
729                                 int y_coord, int *col, int *row,
730                                 int *obj_x, int *obj_y,
731                                 struct window **w, Bufpos *bufpos,
732                                 Bufpos *closest, Charcount *modeline_closest,
733                                 Lisp_Object *obj1, Lisp_Object *obj2);
734 void glyph_to_pixel_translation (struct window *w, int char_x,
735                                  int char_y, int *pix_x, int *pix_y);
736 void mark_redisplay (void);
737 int point_in_line_start_cache (struct window *w, Bufpos point,
738                                int min_past);
739 int point_would_be_visible (struct window *w, Bufpos startp,
740                     Bufpos point);
741 Bufpos start_of_last_line (struct window *w, Bufpos startp);
742 Bufpos end_of_last_line (struct window *w, Bufpos startp);
743 Bufpos start_with_line_at_pixpos (struct window *w, Bufpos point,
744                                   int pixpos);
745 Bufpos start_with_point_on_display_line (struct window *w, Bufpos point,
746                                          int line);
747 int redisplay_variable_changed (Lisp_Object sym, Lisp_Object *val,
748                                 Lisp_Object in_object, int flags);
749 void redisplay_glyph_changed (Lisp_Object glyph, Lisp_Object property,
750                               Lisp_Object locale);
751
752 #ifdef MEMORY_USAGE_STATS
753 int compute_display_line_dynarr_usage (display_line_dynarr *dyn,
754                                        struct overhead_stats *ovstats);
755 int compute_line_start_cache_dynarr_usage (line_start_cache_dynarr *dyn,
756                                            struct overhead_stats *ovstats);
757 #endif
758
759
760 /* defined in redisplay-output.c */
761 int get_next_display_block (layout_bounds bounds,
762                             display_block_dynarr *dba, int start_pos,
763                             int *next_start);
764 void redisplay_output_layout (Lisp_Object domain,
765                               Lisp_Object image_instance,
766                               struct display_box* db, struct display_glyph_area* dga,
767                               face_index findex, int cursor_start, int cursor_width,
768                               int cursor_height);
769 void redisplay_output_subwindow (struct window *w,
770                                  Lisp_Object image_instance,
771                                  struct display_box* db, struct display_glyph_area* dga,
772                                  face_index findex, int cursor_start, int cursor_width,
773                                  int cursor_height);
774 void redisplay_unmap_subwindows_maybe (struct frame* f, int x, int y, int width, int height);
775 void redisplay_output_pixmap (struct window *w,
776                               Lisp_Object image_instance,
777                               struct display_box* db, struct display_glyph_area* dga,
778                               face_index findex, int cursor_start, int cursor_width,
779                               int cursor_height, int offset_bitmap);
780 int redisplay_calculate_display_boxes (struct display_line *dl, int xpos,
781                                        int xoffset, int yoffset, int start_pixpos,
782                                        int width, struct display_box* dest,
783                                        struct display_glyph_area* src);
784 int redisplay_normalize_glyph_area (struct display_box* dest,
785                                     struct display_glyph_area* glyphsrc);
786 void redisplay_clear_to_window_end (struct window *w, int ypos1, int ypos2);
787 void redisplay_clear_region (Lisp_Object window, face_index findex, int x,
788                              int y, int width, int height);
789 void redisplay_clear_top_of_window (struct window *w);
790 void redisplay_clear_bottom_of_window (struct window *w,
791                                        display_line_dynarr *ddla,
792                                        int min_start, int max_end);
793 void redisplay_update_line (struct window *w, int first_line,
794                             int last_line, int update_values);
795 void redisplay_output_window (struct window *w);
796 void bevel_modeline (struct window *w, struct display_line *dl);
797 int redisplay_move_cursor (struct window *w, Bufpos new_point,
798                            int no_output_end);
799 void redisplay_redraw_cursor (struct frame *f, int run_begin_end_meths);
800 void output_display_line (struct window *w, display_line_dynarr *cdla,
801                           display_line_dynarr *ddla, int line,
802                           int force_start, int force_end);
803 void sync_display_line_structs (struct window *w, int line, int do_blocks,
804                                 display_line_dynarr *cdla,
805                                 display_line_dynarr *ddla);
806
807 #endif /* INCLUDED_redisplay_h_ */