annotate src/redisplay-output.c @ 510:5bdbc721d46a

[xemacs-hg @ 2001-05-06 08:33:35 by ben] implement printing the selection when it's selected. force redisplay when set-charset-ccl-program called. if bytecomp or byte-optimize need recompiling, then load the .el version of them first, recompile them, and reload the .elc versions to recompile everything else (so we won't be waiting until the cows come home).
author ben
date Sun, 06 May 2001 08:33:41 +0000
parents 0784d089fdc9
children 373ced43e288
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Synchronize redisplay structures and output changes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1995, 1996 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1996 Chuck Thompson.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 Copyright (C) 1999 Andy Piper.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 /* This file has been Mule-ized. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 /* Author: Chuck Thompson */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 /* Heavily hacked for modularity, gutter and subwindow support by Andy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 Piper. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "device.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "glyphs.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "redisplay.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #include "faces.h"
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
43 #include "gutter.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 static int compare_runes (struct window *w, struct rune *crb,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 struct rune *drb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 static void redraw_cursor_in_window (struct window *w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 int run_end_begin_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 static void redisplay_output_display_block (struct window *w, struct display_line *dl,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 int block, int start, int end, int start_pixpos,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
51 int cursor_start, int cursor_width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 int cursor_height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
53 static void redisplay_normalize_display_box (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 struct display_glyph_area* src);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 static int redisplay_display_boxes_in_window_p (struct window* w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 struct display_box* db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 struct display_glyph_area* dga);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
58 static void redisplay_clear_clipped_region (Lisp_Object locale, face_index findex,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
59 struct display_box* dest,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
60 struct display_glyph_area* glyphsrc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 int fullheight_p, Lisp_Object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 sync_rune_structs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 Synchronize the given rune blocks.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 sync_rune_structs (struct window *w, rune_dynarr *cra, rune_dynarr *dra)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 int rune_elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 int max_move = ((Dynarr_length (dra) > Dynarr_largest (cra))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 ? Dynarr_largest (cra)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 : Dynarr_length (dra));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 if (max_move)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 /* #### Doing this directly breaks the encapsulation. But, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 running time of this function has a measurable impact on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 redisplay performance so avoiding all excess overhead is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 good thing. Is all of this true? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 memcpy (cra->base, dra->base, sizeof (struct rune) * max_move);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 Dynarr_set_size (cra, max_move);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 Dynarr_reset (cra);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 for (rune_elt = max_move; rune_elt < Dynarr_length (dra); rune_elt++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 struct rune rb, *crb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 struct rune *drb = Dynarr_atp (dra, rune_elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 crb = &rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 memcpy (crb, drb, sizeof (struct rune));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 Dynarr_add (cra, *crb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 sync_display_line_structs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 For the given LINE in window W, make the current display line equal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 the desired display line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 ****************************************************************************/
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
105 void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 sync_display_line_structs (struct window *w, int line, int do_blocks,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 display_line_dynarr *cdla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 display_line_dynarr *ddla)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 int cdla_len = Dynarr_length (cdla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 struct display_line dl, *clp, *dlp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 int db_elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 dlp = Dynarr_atp (ddla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 if (line >= Dynarr_largest (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 clp = &dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 clp->display_blocks = Dynarr_new (display_block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 clp = Dynarr_atp (cdla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 if (clp->display_blocks)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 Dynarr_reset (clp->display_blocks);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 if (clp->left_glyphs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 Dynarr_free (clp->left_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 clp->left_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 if (clp->right_glyphs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 Dynarr_free (clp->right_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 clp->right_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 display_block_dynarr *tdb = clp->display_blocks;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 memcpy (clp, dlp, sizeof (struct display_line));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 clp->display_blocks = tdb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 clp->left_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 clp->right_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 if (!do_blocks && line >= cdla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 Dynarr_add (cdla, *clp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 for (db_elt = 0; db_elt < Dynarr_length (dlp->display_blocks); db_elt++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 struct display_block db, *cdb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 struct display_block *ddb = Dynarr_atp (dlp->display_blocks, db_elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 if (db_elt >= Dynarr_largest (clp->display_blocks))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 cdb = &db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 memcpy (cdb, ddb, sizeof (struct display_block));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 cdb->runes = Dynarr_new (rune);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 Dynarr_add (clp->display_blocks, *cdb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 rune_dynarr *tr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 cdb = Dynarr_atp (clp->display_blocks, db_elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 tr = cdb->runes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 memcpy (cdb, ddb, sizeof (struct display_block));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 cdb->runes = tr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 Dynarr_increment (clp->display_blocks);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 sync_rune_structs (w, cdb->runes, ddb->runes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 if (line >= cdla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 Dynarr_add (cdla, *clp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 compare_runes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
185 Compare two runes to see if each of their fields is equal. If so,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 return true otherwise return false.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 compare_runes (struct window *w, struct rune *crb, struct rune *drb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 /* Do not compare the values of bufpos and endpos. They do not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 affect the display characteristics. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 /* Note: (hanoi 6) spends 95% of its time in redisplay, and about
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 30% here. Not using bitfields for rune.type alone gives a redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 speed up of 10%.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 #### In profile arcs run of a normal Gnus session this function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 is run 6.76 million times, only to return 1 in 6.73 million of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 those.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 In addition a quick look GCC sparc assembly shows that GCC is not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 doing a good job here.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 1. The function is not inlined (too complicated?)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 2. It seems to be reloading the crb and drb variables all the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 3. It doesn't seem to notice that the second half of these if's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 are really a switch statement.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 So I (JV) conjecture
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 #### It would really be worth it to arrange for this function to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 be (almost) a single call to memcmp. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
214
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
215 if (crb->xpos != drb->xpos)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 else if (crb->width != drb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 else if (crb->cursor_type != drb->cursor_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 else if (crb->type != drb->type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 else if (crb->type == RUNE_CHAR &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 (crb->object.chr.ch != drb->object.chr.ch))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 else if (crb->type == RUNE_HLINE &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 (crb->object.hline.thickness != drb->object.hline.thickness ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 crb->object.hline.yoffset != drb->object.hline.yoffset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 return 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
230 else if (crb->type == RUNE_DGLYPH &&
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 /* Only check dirtiness if we know something has changed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 else if (crb->type == RUNE_DGLYPH &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
237 (XGLYPH_DIRTYP (crb->object.dglyph.glyph) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
238 crb->findex != drb->findex))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
240 /* We need some way of telling redisplay_output_layout () that the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
241 only reason we are outputting it is because something has
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
242 changed internally. That way we can optimize whether we need
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
243 to clear the layout first and also only output the components
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
244 that have changed. The image_instance dirty flag and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
245 display_hash are no good to us because these will invariably
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
246 have been set anyway if the layout has changed. So it looks
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
247 like we need yet another change flag that we can set here and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
248 then clear in redisplay_output_layout (). */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
249 Lisp_Object window, image;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
250 Lisp_Image_Instance* ii;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
251 XSETWINDOW (window, w);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
252 image = glyph_image_instance (crb->object.dglyph.glyph,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
253 window, ERROR_ME_NOT, 1);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
254
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
255 if (!IMAGE_INSTANCEP (image))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
256 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
257 ii = XIMAGE_INSTANCE (image);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
258
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
259 if (TEXT_IMAGE_INSTANCEP (image) &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
260 (crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
261 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 return 0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
263
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
264 /* It is quite common for the two glyphs to be EQ since in many
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
265 cases they will actually be the same object. This does not
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
266 mean, however, that nothing has changed. We therefore need to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
267 check the current hash of the glyph against the last recorded
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
268 display hash and the pending display items. See
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
269 update_subwindow (). */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
270 if (image_instance_changed (image) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
271 crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
272 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
273 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
274 /* We now now we are going to re-output the glyph, but since
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
275 this is for some internal reason not related to geometry
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
276 changes, send a hint to the output routines that they can
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
277 take some short cuts. This is most useful for
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
278 layouts. This flag should get reset by the output
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
279 routines.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
280
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
281 #### It is possible for us to get here when the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
282 face_cachel is dirty. I do not know what the implications
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
283 of this are.*/
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
284 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (ii) = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
285 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
286 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
287 else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
290 /* We now do this last so that glyph checks can do their own thing
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
291 for face changes. Face changes quite often happen when we are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
292 trying to output something in the gutter, this would normally
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
293 lead to a lot of flashing. The indices can quite often be
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
294 different and yet the faces are the same, we do not want to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
295 re-output in this instance. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
296 else if (crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
297 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
298 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 get_next_display_block
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 Return the next display starting at or overlapping START_POS. Return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 the start of the next region in NEXT_START.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 get_next_display_block (layout_bounds bounds, display_block_dynarr *dba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 int start_pos, int *next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 int next_display_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 int priority = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 int block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 /* If we don't find a display block covering or starting at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 start_pos, then we return the starting point of the next display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 block or the next division boundary, whichever is closer to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 start_pos. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 if (next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 if (start_pos >= bounds.left_out && start_pos < bounds.left_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 *next_start = bounds.left_in;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 else if (start_pos < bounds.left_white)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 *next_start = bounds.left_white;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 else if (start_pos < bounds.right_white)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 *next_start = bounds.right_white;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 else if (start_pos < bounds.right_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 *next_start = bounds.right_in;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 else if (start_pos <= bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 *next_start = bounds.right_out;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 for (block = 0; block < Dynarr_length (dba); block++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 struct display_block *db = Dynarr_atp (dba, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 if (db->start_pos <= start_pos && db->end_pos > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 if ((int) db->type > priority)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 priority = db->type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 next_display_block = block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 if (next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 *next_start = db->end_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 else if (next_start && db->start_pos > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 if (db->start_pos < *next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 *next_start = db->start_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 return next_display_block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 get_cursor_size_and_location
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 Return the information defining the pixel location of the cursor.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 get_cursor_size_and_location (struct window *w, struct display_block *db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 int cursor_location,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 int *cursor_start, int *cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 int *cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 int defheight, defwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 if (Dynarr_length (db->runes) <= cursor_location)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 rb = Dynarr_atp (db->runes, cursor_location);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 *cursor_start = rb->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 default_face_height_and_width (window, &defheight, &defwidth);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 *cursor_height = defheight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 if (rb->type == RUNE_BLANK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 *cursor_width = defwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 *cursor_width = rb->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 compare_display_blocks
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 Given two display blocks, output only those areas where they differ.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 compare_display_blocks (struct window *w, struct display_line *cdl,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 struct display_line *ddl, int c_block, int d_block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 int start_pixpos, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 struct display_block *cdb, *ddb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 int start_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 int stop_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 int force = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 int block_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 cdb = Dynarr_atp (cdl->display_blocks, c_block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 ddb = Dynarr_atp (ddl->display_blocks, d_block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 assert (cdb->type == ddb->type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 start_pos = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 stop_pos = min (Dynarr_length (cdb->runes), Dynarr_length (ddb->runes));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 block_end =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (!Dynarr_length (ddb->runes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 ? 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 : (Dynarr_atp (ddb->runes, Dynarr_length (ddb->runes) - 1)->xpos +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 Dynarr_atp (ddb->runes, Dynarr_length (ddb->runes) - 1)->width));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 /* If the new block type is not text and the cursor status is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 changing and it overlaps the position of this block then force a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 full redraw of the block in order to make sure that the cursor is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 updated properly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 if (ddb->type != TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 /* I'm not sure exactly what this code wants to do, but it's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 * not right--it doesn't update when cursor_elt changes from, e.g.,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 * 0 to 8, and the new or old cursor loc overlaps this block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 * I've replaced it with the more conservative test below.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 * -dkindred@cs.cmu.edu 23-Mar-1997 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 && ((cdl->cursor_elt == -1 && ddl->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 || (cdl->cursor_elt != -1 && ddl->cursor_elt == -1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 && (ddl->cursor_elt == -1 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 (cursor_start
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 && cursor_width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 && (cursor_start + cursor_width) >= start_pixpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 && cursor_start <= block_end))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 && (cdl->cursor_elt != ddl->cursor_elt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 force = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 if (f->windows_structure_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 /* #### Why is this so? We have face cachels so that we don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 have to recalculate all the display blocks when faces
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 change. I have fixed this for glyphs and am inclined to think
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 that faces should "Just Work", but I'm not feeling brave
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 today. Maybe its because the face cachels represent merged
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 faces rather than simply instantiations in a particular
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 domain. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 f->faces_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 cdl->clip != ddl->clip ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 force)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 start_pos = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 force = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 int elt = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 while (start_pos < 0 && elt < stop_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 if (!compare_runes (w, Dynarr_atp (cdb->runes, elt),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 Dynarr_atp (ddb->runes, elt)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 start_pos = elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 elt++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 /* If nothing has changed in the area where the blocks overlap, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 there are new blocks in the desired block, then adjust the start
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 point accordingly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 if (elt == stop_pos && stop_pos < Dynarr_length (ddb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 start_pos = stop_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 if (start_pos >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 if ((Dynarr_length (ddb->runes) != Dynarr_length (cdb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 || force)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 stop_pos = Dynarr_length (ddb->runes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 /* If the lines have the same number of runes and we are not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 forcing a full redraw because the display line has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 changed position then we try and optimize how much of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 line we actually redraw by scanning backwards from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 end for the first changed rune. This optimization is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 almost always triggered by face changes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 int elt = Dynarr_length (ddb->runes) - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 while (elt > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 if (!compare_runes (w, Dynarr_atp (cdb->runes, elt),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 Dynarr_atp (ddb->runes, elt)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 elt--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 stop_pos = elt + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 redisplay_output_display_block (w, ddl, d_block, start_pos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 stop_pos, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 clear_left_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 Clear the lefthand outside border.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 clear_left_border (struct window *w, int y, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 redisplay_clear_region (window, DEFAULT_INDEX,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 FRAME_LEFT_BORDER_START (f), y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 FRAME_BORDER_WIDTH (f), height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 clear_right_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 Clear the righthand outside border.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 clear_right_border (struct window *w, int y, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 redisplay_clear_region (window, DEFAULT_INDEX,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 FRAME_RIGHT_BORDER_START (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 y, FRAME_BORDER_WIDTH (f), height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 output_display_line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 Ensure that the contents of the given display line is correct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 on-screen. The force_ parameters are used by redisplay_move_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 to correctly update cursor locations and only cursor locations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 output_display_line (struct window *w, display_line_dynarr *cdla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 display_line_dynarr *ddla, int line, int force_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 int force_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 struct buffer *b = XBUFFER (w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 struct buffer *old_b = window_display_buffer (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 struct display_line *cdl, *ddl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 display_block_dynarr *cdba, *ddba;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 int start_pixpos, end_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 int cursor_start, cursor_width, cursor_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 int force = (force_start >= 0 || force_end >= 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 int clear_border = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 int must_sync = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 if (cdla && line < Dynarr_length (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 cdl = Dynarr_atp (cdla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 cdba = cdl->display_blocks;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 cdl = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 cdba = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 ddl = Dynarr_atp (ddla, line); /* assert line < Dynarr_length (ddla) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 ddba = ddl->display_blocks;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 if (force_start >= 0 && force_start >= ddl->bounds.left_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 start_pixpos = force_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 start_pixpos = ddl->bounds.left_out;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 if (force_end >= 0 && force_end < ddl->bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 end_pixpos = force_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 end_pixpos = ddl->bounds.right_out;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 /* Get the cursor parameters. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 if (ddl->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 /* If the lines cursor parameter is not -1 then it indicates
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 which rune in the TEXT block contains the cursor. This means
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 that there must be at least one display block. The TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 block, if present, must always be the first display block. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 assert (Dynarr_length (ddba) != 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 db = Dynarr_atp (ddba, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 assert (db->type == TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 get_cursor_size_and_location (w, db, ddl->cursor_elt, &cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 &cursor_width, &cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 cursor_start = cursor_width = cursor_height = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 /* The modeline should only have a single block and it had better be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 a TEXT block. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 if (ddl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 /* The shadow thickness check is necessary if only the sign of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 the size changed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 if (cdba && !w->shadow_thickness_changed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 must_sync |= compare_display_blocks (w, cdl, ddl, 0, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 start_pixpos, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 redisplay_output_display_block (w, ddl, 0, 0, -1, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 if (must_sync)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 clear_border = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 while (!ddl->modeline && start_pixpos < end_pixpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 int block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 int next_start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 block = get_next_display_block (ddl->bounds, ddba, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 &next_start_pixpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 /* If we didn't find a block then we should blank the area
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 between start_pos and next_start if necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 if (block == NO_BLOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 /* We only erase those areas which were actually previously
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 covered by a display block unless the window structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 changed. In that case we clear all areas since the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 structures may actually represent a different buffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 while (start_pixpos < next_start_pixpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 int block_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 int old_block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 if (cdba)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 old_block = get_next_display_block (ddl->bounds, cdba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 start_pixpos, &block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 old_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 block_end = next_start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 if (!cdba || old_block != NO_BLOCK || b != old_b ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 f->windows_structure_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 f->faces_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 force ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 (cdl && (cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 cdl->top_clip != ddl->top_clip ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 cdl->clip != ddl->clip)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 face_index findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 x = start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 y = DISPLAY_LINE_YPOS (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 width = min (next_start_pixpos, block_end) - x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 height = DISPLAY_LINE_HEIGHT (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 if (x < ddl->bounds.left_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 findex = ddl->left_margin_findex ?
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
709 ddl->left_margin_findex
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 : get_builtin_face_cache_index (w, Vleft_margin_face);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 else if (x < ddl->bounds.right_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 /* no check here because DEFAULT_INDEX == 0 anyway */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 findex = ddl->default_findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 else if (x < ddl->bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 findex = ddl->right_margin_findex ?
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
720 ddl->right_margin_findex
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 : get_builtin_face_cache_index (w, Vright_margin_face);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 findex = (face_index) -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 if (findex != (face_index) -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 /* Clear the empty area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 redisplay_clear_region (window, findex, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 /* Mark that we should clear the border. This is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 necessary because italic fonts may leave
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 droppings in the border. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 clear_border = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 start_pixpos = min (next_start_pixpos, block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 struct display_block *cdb, *ddb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 int block_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 int old_block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 if (cdba)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 old_block = get_next_display_block (ddl->bounds, cdba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 start_pixpos, &block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 old_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 ddb = Dynarr_atp (ddba, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 cdb = (old_block != NO_BLOCK ? Dynarr_atp (cdba, old_block) : 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 /* If there was formerly no block over the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 region or if it was a block of a different type, then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 output the entire ddb. Otherwise, compare cdb and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 ddb and output only the changed region. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
764 if (!force && cdb && ddb->type == cdb->type
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 /* If there was no buffer being display before the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 compare anyway as we might be outputting a gutter. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
767 &&
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 (b == old_b || !old_b))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 must_sync |= compare_display_blocks (w, cdl, ddl, old_block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 block, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 int elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 int first_elt = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 int last_elt = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 for (elt = 0; elt < Dynarr_length (ddb->runes); elt++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 struct rune *rb = Dynarr_atp (ddb->runes, elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 if (start_pixpos >= rb->xpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 && start_pixpos < rb->xpos + rb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 first_elt = elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 if (end_pixpos > rb->xpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 && end_pixpos <= rb->xpos + rb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 last_elt = elt + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 if (last_elt > Dynarr_length (ddb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 last_elt = Dynarr_length (ddb->runes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 redisplay_output_display_block (w, ddl, block, first_elt,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 last_elt,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
806
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 start_pixpos = next_start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 /* Clear the internal border if we are next to it and the window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 structure or frame size has changed or if something caused
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 clear_border to be tripped. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 /* #### Doing this on f->clear sucks but is necessary because of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 window-local background values. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 if (f->windows_structure_changed || f->faces_changed || clear_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 || f->clear)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 int y = DISPLAY_LINE_YPOS (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 int height = DISPLAY_LINE_HEIGHT (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 /* If we are in the gutter then we musn't clear the borders. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 if (y >= WINDOW_TEXT_TOP (w) && (y + height) <= WINDOW_TEXT_BOTTOM (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 if (ddl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 y -= MODELINE_SHADOW_THICKNESS (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 height += (2 * MODELINE_SHADOW_THICKNESS (w));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
830
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 if (window_is_leftmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 clear_left_border (w, y, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 if (window_is_rightmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 clear_right_border (w, y, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 if (cdla)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 sync_display_line_structs (w, line, must_sync, cdla, ddla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 redisplay_move_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 For the given window W, move the cursor to NEW_POINT. Returns a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 boolean indicating success or failure.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 #define ADJ_BUFPOS (rb->bufpos + dl->offset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 #define ADJ_ENDPOS (rb->endpos + dl->offset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 redisplay_move_cursor (struct window *w, Bufpos new_point, int no_output_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 display_line_dynarr *cla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 struct display_line *dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 int x = w->last_point_x[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 int y = w->last_point_y[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 * Bail if cursor_in_echo_area is non-zero and we're fiddling with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 * the cursor in a non-active minibuffer window, since that is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 * special case that is handled elsewhere and this function need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 * not handle it. Return 1 so the caller will assume we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 * succeeded.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 if (cursor_in_echo_area && MINI_WINDOW_P (w) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 w != XWINDOW (FRAME_SELECTED_WINDOW (f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 if (y < 0 || y >= Dynarr_length (cla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 dl = Dynarr_atp (cla, y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 db = get_display_block_from_line (dl, TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 if (x < 0 || x >= Dynarr_length (db->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 rb = Dynarr_atp (db->runes, x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 if (rb->cursor_type == CURSOR_OFF)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 else if (ADJ_BUFPOS == new_point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 || (ADJ_ENDPOS && (new_point >= ADJ_BUFPOS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 && (new_point <= ADJ_ENDPOS)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 w->last_point_x[CURRENT_DISP] = x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894 w->last_point_y[CURRENT_DISP] = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 Fset_marker (w->last_point[CURRENT_DISP], make_int (ADJ_BUFPOS),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 dl->cursor_elt = x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
902 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
903 MAYBE_DEVMETH (d, frame_output_begin, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
904 MAYBE_DEVMETH (d, window_output_begin, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
905 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
906 rb->cursor_type = CURSOR_OFF;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 dl->cursor_elt = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 output_display_line (w, 0, cla, y, rb->xpos, rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 w->last_point_x[CURRENT_DISP] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 w->last_point_y[CURRENT_DISP] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 Fset_marker (w->last_point[CURRENT_DISP], Qnil, w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 /* If this isn't the selected frame, then erasing the old cursor is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 all we actually had to do. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 if (w != XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
920 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
921 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
922 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
923 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 /* This should only occur in the minibuffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 if (new_point == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 w->last_point_x[CURRENT_DISP] = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 w->last_point_y[CURRENT_DISP] = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 Fset_marker (w->last_point[CURRENT_DISP], Qzero, w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 rb = Dynarr_atp (db->runes, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 rb->cursor_type = CURSOR_ON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 dl->cursor_elt = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 output_display_line (w, 0, cla, y, rb->xpos, rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
942 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
943 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
944 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
945 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 int cur_rb = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 int first = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 int cur_dl, up;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 if (ADJ_BUFPOS < new_point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 up = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 cur_rb = x + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 cur_dl = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 else /* (rb->bufpos + dl->offset) > new_point */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962 up = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 if (!x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 cur_dl = y - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 first = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 cur_rb = x - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 cur_dl = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 first = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
977 while (up ? (cur_dl < Dynarr_length (cla)) : (cur_dl >= 0))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 dl = Dynarr_atp (cla, cur_dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 db = get_display_block_from_line (dl, TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 if (!up && !first)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 cur_rb = Dynarr_length (db->runes) - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 while ((!scroll_on_clipped_lines || !dl->clip) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 (up ? (cur_rb < Dynarr_length (db->runes)) : (cur_rb >= 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 rb = Dynarr_atp (db->runes, cur_rb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 if (rb->cursor_type != IGNORE_CURSOR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 && rb->cursor_type != NO_CURSOR &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 (ADJ_BUFPOS == new_point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 || (ADJ_ENDPOS && (new_point >= ADJ_BUFPOS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 && (new_point <= ADJ_BUFPOS))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 rb->cursor_type = CURSOR_ON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 dl->cursor_elt = cur_rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 output_display_line (w, 0, cla, cur_dl, rb->xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 w->last_point_x[CURRENT_DISP] = cur_rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 w->last_point_y[CURRENT_DISP] = cur_dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 Fset_marker (w->last_point[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 make_int (ADJ_BUFPOS), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1009 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1010 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1011 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1012 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 (up ? cur_rb++ : cur_rb--);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 (up ? (cur_rb = 0) : (first = 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 (up ? cur_dl++ : cur_dl--);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1025 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1026 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1027 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1028 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 #undef ADJ_BUFPOS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 #undef ADJ_ENDPOS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 redraw_cursor_in_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 For the given window W, redraw the cursor if it is contained within
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 the window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 redraw_cursor_in_window (struct window *w, int run_end_begin_meths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 display_line_dynarr *dla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 struct display_line *dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 int x = w->last_point_x[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 int y = w->last_point_y[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 if (cursor_in_echo_area && MINI_WINDOW_P (w) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 !echo_area_active (f) && minibuf_level == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 MAYBE_DEVMETH (d, set_final_cursor_coords, (f, w->pixel_top, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 if (y < 0 || y >= Dynarr_length (dla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 if (MINI_WINDOW_P (w) && f != device_selected_frame (d) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 !is_surrogate_for_selected_frame (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 dl = Dynarr_atp (dla, y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 db = get_display_block_from_line (dl, TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 if (x < 0 || x >= Dynarr_length (db->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 rb = Dynarr_atp (db->runes, x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 /* Don't call the output routine if the block isn't actually the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 cursor. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 if (rb->cursor_type == CURSOR_ON)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 MAYBE_DEVMETH (d, set_final_cursor_coords,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 (f, dl->ypos - 1, rb->xpos));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 if (run_end_begin_meths)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1083 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1084 MAYBE_DEVMETH (d, frame_output_begin, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1085 MAYBE_DEVMETH (d, window_output_begin, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1086 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 output_display_line (w, 0, dla, y, rb->xpos, rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 if (run_end_begin_meths)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1091 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1092 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1093 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1094 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 redisplay_redraw_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 For the given frame F, redraw the cursor on the selected window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 This is used to update the cursor after focus changes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 redisplay_redraw_cursor (struct frame *f, int run_end_begin_meths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 if (!cursor_in_echo_area)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 window = FRAME_SELECTED_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 else if (FRAME_HAS_MINIBUF_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 window = FRAME_MINIBUF_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 redraw_cursor_in_window (XWINDOW (window), run_end_begin_meths);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 redisplay_output_display_block
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 Given a display line, a block number for that start line, output all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 runes between start and end in the specified display block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 redisplay_output_display_block (struct window *w, struct display_line *dl, int block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 int start, int end, int start_pixpos, int cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 int cursor_width, int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 struct device *d = XDEVICE (f->device);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1132 /* Temporarily disabled until generalization is done. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1133 #if 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 rune_dynarr *rba = db->runes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 int xpos, width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 rb = Dynarr_atp (rba, start);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 if (!rb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 /* Nothing to do so don't do anything. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 xpos = max (start_pixpos, rb->xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 if (end < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 end = Dynarr_length (rba);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 rb = Dynarr_atp (rba, end - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 width = rb->xpos + rb->width - xpos;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1151 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 /* now actually output the block. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 DEVMETH (d, output_display_block, (w, dl, block, start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 end, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 cursor_height));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 redisplay_unmap_subwindows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 Remove subwindows from the area in the box defined by the given
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 parameters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 ****************************************************************************/
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1165 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1166 redisplay_unmap_subwindows (struct frame* f, int x, int y, int width, int height,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1167 Lisp_Object ignored_window)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1169 Lisp_Object rest;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1171 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1172 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1173 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1174 if (IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1176 IMAGE_INSTANCE_DISPLAY_X (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1177 + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) > x
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1179 IMAGE_INSTANCE_DISPLAY_X (ii) < x + width
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1180 &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1181 IMAGE_INSTANCE_DISPLAY_Y (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1182 + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) > y
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1183 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1184 IMAGE_INSTANCE_DISPLAY_Y (ii) < y + height
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1185 &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1186 !EQ (XCAR (rest), ignored_window))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1188 unmap_subwindow (XCAR (rest));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 redisplay_unmap_subwindows_maybe
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 Potentially subwindows from the area in the box defined by the given
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 parameters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 void redisplay_unmap_subwindows_maybe (struct frame* f, int x, int y, int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1201 if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 redisplay_unmap_subwindows (f, x, y, width, height, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1207 static void redisplay_unmap_subwindows_except_us (struct frame* f, int x, int y, int width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 int height, Lisp_Object subwindow)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1210 if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 redisplay_unmap_subwindows (f, x, y, width, height, subwindow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217 redisplay_output_subwindow
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 output a subwindow. This code borrows heavily from the pixmap stuff,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 although is much simpler not needing to account for partial
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 pixmaps, backgrounds etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1224 redisplay_output_subwindow (struct window *w,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 struct display_box* db, struct display_glyph_area* dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 face_index findex, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1230 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 struct display_glyph_area sdga;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1234 dga->height = IMAGE_INSTANCE_HEIGHT (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1235 dga->width = IMAGE_INSTANCE_WIDTH (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1236
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1237 /* The first thing we are going to do is update the display
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1238 characteristics of the subwindow. This also clears the dirty
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1239 flags as a side effect. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1240 redisplay_subwindow (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 /* Clear the area the subwindow is going into. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249 redisplay_clear_clipped_region (window, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 db, dga, 0, image_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 redisplay_normalize_display_box (db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256 /* if we can't view the whole window we can't view any of it. We
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257 have to be careful here since we may be being asked to display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 part of a subwindow, the rest of which is on-screen as well. We
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259 need to allow this case and map the entire subwindow. We also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 need to be careful since the subwindow could be outside the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261 window in the gutter or modeline - we also need to allow these
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 cases.*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263 sdga.xoffset = -dga->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 sdga.yoffset = -dga->yoffset;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1265 sdga.height = IMAGE_INSTANCE_HEIGHT (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1266 sdga.width = IMAGE_INSTANCE_WIDTH (p);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1267
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1268 if (redisplay_display_boxes_in_window_p (w, db, &sdga) == 0
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1269 ||
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1270 /* We only want to do full subwindow display for windows that
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1271 are completely in the gutter, otherwise we must clip to be
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1272 safe. */
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1273 display_boxes_in_gutter_p (XFRAME (w->frame), db, &sdga) <= 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275 map_subwindow (image_instance, db->xpos, db->ypos, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279 sdga.xoffset = sdga.yoffset = 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1280 map_subwindow (image_instance, db->xpos - dga->xoffset,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 db->ypos - dga->yoffset, &sdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286 redisplay_output_layout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 Output a widget hierarchy. This can safely call itself recursively.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1289
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1290 The complexity of outputting layouts is deciding whether to do it or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1291 not. Consider a layout enclosing some text, the text changes and is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1292 marked as dirty, but the enclosing layout has not been marked as
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1293 dirty so no updates occur and the text will potentially be truncated.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1294 Alternatively we hold a back pointer in the image instance to the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1295 parent and mark the parent as dirty. But the layout code assumes that
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1296 if the layout is dirty then the whole layout should be redisplayed,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1297 so we then get lots of flashing even though only the text has changed
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1298 size. Of course if the text shrinks in size then we do actually need
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1299 to redisplay the layout to repaint the exposed area. So what happens
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1300 if we make a non-structural change like changing color? Either we
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1301 redisplay everything, or we redisplay nothing. These are exactly the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1302 issues lwlib has to grapple with. We really need to know what has
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1303 actually changed and make a layout decision based on that. We also
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1304 really need to know what has changed so that we can only make the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1305 necessary changes in update_subwindow. This has all now been
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1306 implemented, Viva la revolution!
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1309 redisplay_output_layout (Lisp_Object domain,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 struct display_box* db, struct display_glyph_area* dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 face_index findex, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1315 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1316 Lisp_Object rest, window = DOMAIN_WINDOW (domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317 Emchar_dynarr *buf = Dynarr_new (Emchar);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1318 struct window *w = XWINDOW (window);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1319 struct device *d = DOMAIN_XDEVICE (domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 int layout_height, layout_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1322 layout_height = glyph_height (image_instance, domain);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1323 layout_width = glyph_width (image_instance, domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325 dga->height = layout_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1326 dga->width = layout_width;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1327 #ifdef DEBUG_WIDGET_OUTPUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1328 printf ("outputing layout glyph %p\n", p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1329 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 /* Highly dodgy optimization. We want to only output the whole
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335 layout if we really have to. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1336 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1337 || IMAGE_INSTANCE_LAYOUT_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1338 || IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1339 || IMAGE_INSTANCE_SIZE_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1340 || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 /* First clear the area we are drawing into. This is the easiest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 thing to do since we have many gaps that we have to make sure are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 filled in. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 redisplay_clear_clipped_region (window, findex, db, dga, 1, Qnil);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1346
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 /* Output a border if required */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 if (!NILP (IMAGE_INSTANCE_LAYOUT_BORDER (p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 int edges = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 enum edge_style style;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 int ypos = db->ypos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 int height = dga->height;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1354
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 if (dga->xoffset >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356 edges |= EDGE_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 if (dga->width - dga->xoffset == layout_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 edges |= EDGE_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 if (dga->yoffset >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 edges |= EDGE_TOP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 if (dga->height - dga->yoffset == layout_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 edges |= EDGE_BOTTOM;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1363
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365 style = EDGE_ETCHED_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 style = EDGE_ETCHED_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qbevel_in))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369 style = EDGE_BEVEL_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 else if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 style = EDGE_ETCHED_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 if (edges & EDGE_TOP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 ypos += XINT (IMAGE_INSTANCE_LAYOUT_BORDER (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 height -= XINT (IMAGE_INSTANCE_LAYOUT_BORDER (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 style = EDGE_BEVEL_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1382 MAYBE_DEVMETH (d, bevel_area,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 (w, findex, db->xpos,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1384 ypos,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 dga->width, height, 2, edges, style));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1388
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 redisplay_normalize_display_box (db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1392
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 /* Flip through the widgets in the layout displaying as necessary */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 LIST_LOOP (rest, IMAGE_INSTANCE_LAYOUT_CHILDREN (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1396 Lisp_Object child = glyph_image_instance (XCAR (rest), image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1397 ERROR_ME_NOT, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 struct display_box cdb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400 /* For losing HP-UX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401 cdb.xpos = db->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1402 cdb.ypos = db->ypos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 cdb.width = db->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 cdb.height = db->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406 /* First determine if the image is visible at all */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 if (IMAGE_INSTANCEP (child))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1409 Lisp_Image_Instance* childii = XIMAGE_INSTANCE (child);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1410
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411 /* The enclosing layout offsets are +ve at this point */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1412 struct display_glyph_area cdga;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1413 cdga.xoffset = IMAGE_INSTANCE_XOFFSET (childii) - dga->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 cdga.yoffset = IMAGE_INSTANCE_YOFFSET (childii) - dga->yoffset;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1415 cdga.width = glyph_width (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1416 cdga.height = glyph_height (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1417
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1418 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1419 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1421 /* Although normalization is done by the output routines
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1422 we have to do it here so that they don't try and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1423 clear all of db. This is true below also. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 if (redisplay_normalize_glyph_area (&cdb, &cdga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1426 redisplay_normalize_display_box (&cdb, &cdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1427 /* Since the display boxes will now be totally in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1428 window if they are visible at all we can now check this easily. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 if (cdb.xpos < db->xpos || cdb.ypos < db->ypos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 || cdb.xpos + cdb.width > db->xpos + db->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 || cdb.ypos + cdb.height > db->ypos + db->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1432 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433 /* We have to invert the offset here as normalization
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 will have made them positive which the output
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1435 routines will treat as a truly +ve offset. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1436 cdga.xoffset = -cdga.xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437 cdga.yoffset = -cdga.yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1438
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439 switch (IMAGE_INSTANCE_TYPE (childii))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 case IMAGE_TEXT:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 /* #### This is well hacked and could use some
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 generalisation.*/
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1445 if (redisplay_normalize_glyph_area (&cdb, &cdga)
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1446 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1447 (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1448 IMAGE_INSTANCE_DIRTYP (childii)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 struct display_line dl; /* this is fake */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451 Lisp_Object string =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1452 IMAGE_INSTANCE_TEXT_STRING (childii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1453 unsigned char charsets[NUM_LEADING_BYTES];
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1454 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1455
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1456 find_charsets_in_bufbyte_string (charsets,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1457 XSTRING_DATA (string),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1458 XSTRING_LENGTH (string));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1459 ensure_face_cachel_complete (cachel, window, charsets);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1460
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1461 convert_bufbyte_string_into_emchar_dynarr
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1462 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1463
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1464 redisplay_normalize_display_box (&cdb, &cdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1465 /* Offsets are now +ve again so be careful
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1466 when fixing up the display line. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1467 xzero (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1468 /* Munge boxes into display lines. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1469 dl.ypos = (cdb.ypos - cdga.yoffset)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1470 + glyph_ascent (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1471 dl.ascent = glyph_ascent (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1472 dl.descent = glyph_descent (child, image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1473 dl.top_clip = cdga.yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1474 dl.clip = (dl.ypos + dl.descent) - (cdb.ypos + cdb.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 /* output_string doesn't understand offsets in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 the same way as other routines - we have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 add the offset to the width so that we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478 output the full string. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1479 MAYBE_DEVMETH (d, output_string, (w, &dl, buf, cdb.xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480 cdga.xoffset, cdb.xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 cdga.width + cdga.xoffset,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1482 findex, 0, 0, 0, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1483 Dynarr_reset (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1486 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1487
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488 case IMAGE_MONO_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1489 case IMAGE_COLOR_PIXMAP:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1490 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1491 || IMAGE_INSTANCE_DIRTYP (childii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492 redisplay_output_pixmap (w, child, &cdb, &cdga, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1495
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 case IMAGE_WIDGET:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1497 if (EQ (IMAGE_INSTANCE_WIDGET_TYPE (childii), Qlayout))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1498 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1499 redisplay_output_layout (image_instance, child, &cdb, &cdga, findex,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1500 0, 0, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1501 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1502 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 case IMAGE_SUBWINDOW:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1504 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1505 IMAGE_INSTANCE_DIRTYP (childii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 redisplay_output_subwindow (w, child, &cdb, &cdga, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1509
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 case IMAGE_NOTHING:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511 /* nothing is as nothing does */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1513
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 case IMAGE_POINTER:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1515 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1516 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1519 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1521 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1522
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1523 /* Update any display properties. I'm not sure whether this actually
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1524 does anything for layouts except clear the changed flags. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1525 redisplay_subwindow (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1526
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527 Dynarr_free (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 redisplay_output_pixmap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534 output a pixmap.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1537 redisplay_output_pixmap (struct window *w,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 struct display_box* db, struct display_glyph_area* dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540 face_index findex, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541 int cursor_height, int offset_bitmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 struct device *d = XDEVICE (f->device);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1545 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 dga->height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 dga->width = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 /* Clear the area the pixmap is going into. The pixmap itself will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 always take care of the full width. We don't want to clear where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 it is going to go in order to avoid flicker. So, all we have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 take care of is any area above or below the pixmap. If the pixmap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560 has a mask in which case we have to clear the whole damn thing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 since we can't yet clear just the area not included in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 mask. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 if (!offset_bitmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 redisplay_clear_clipped_region (window, findex,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1566 db, dga,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1567 (IMAGE_INSTANCE_PIXMAP_MASK (p) != 0),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1568 Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1569
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1570 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 redisplay_normalize_display_box (db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574 assert (db->xpos >= 0 && db->ypos >= 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576 MAYBE_DEVMETH (d, output_pixmap, (w, image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577 db, dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 findex, cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 cursor_width, cursor_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 offset_bitmap));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 redisplay_clear_region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 Clear the area in the box defined by the given parameters using the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 given face. This has been generalised so that subwindows can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 coped with effectively.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 redisplay_clear_region (Lisp_Object locale, face_index findex, int x, int y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 struct window *w = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 struct frame *f = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 struct device *d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597 Lisp_Object background_pixmap = Qunbound;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598 Lisp_Object fcolor = Qnil, bcolor = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1600 if (!width || !height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1601 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 if (WINDOWP (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 w = XWINDOW (locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1606 f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608 else if (FRAMEP (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1610 w = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 f = XFRAME (locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616 d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 /* if we have subwindows in the region we have to unmap them */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 redisplay_unmap_subwindows_maybe (f, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1620
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621 /* #### This isn't quite right for when this function is called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622 from the toolbar code. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1623
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 /* Don't use a backing pixmap in the border area */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1625 if (x >= FRAME_LEFT_BORDER_END (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1626 && x < FRAME_RIGHT_BORDER_START (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627 && y >= FRAME_TOP_BORDER_END (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 && y < FRAME_BOTTOM_BORDER_START (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630 Lisp_Object temp;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1631
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1632 if (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1633 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1634 temp = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, findex);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1635
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636 if (IMAGE_INSTANCEP (temp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1637 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 /* #### maybe we could implement such that a string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 can be a background pixmap? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 background_pixmap = temp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646 temp = FACE_BACKGROUND_PIXMAP (Vdefault_face, locale);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1647
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648 if (IMAGE_INSTANCEP (temp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1649 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1651 background_pixmap = temp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1652 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1654 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1656 if (!UNBOUNDP (background_pixmap) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1657 XIMAGE_INSTANCE_PIXMAP_DEPTH (background_pixmap) == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1659 if (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1660 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 fcolor = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662 bcolor = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1664 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1665 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1666 fcolor = FACE_FOREGROUND (Vdefault_face, locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1667 bcolor = FACE_BACKGROUND (Vdefault_face, locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1668 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 fcolor = (w ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673 WINDOW_FACE_CACHEL_BACKGROUND (w, findex) :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 FACE_BACKGROUND (Vdefault_face, locale));
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1675
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1676 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1677
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1678 if (UNBOUNDP (background_pixmap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679 background_pixmap = Qnil;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1680
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1681 DEVMETH (d, clear_region,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1682 (locale, d, f, findex, x, y, width, height, fcolor, bcolor, background_pixmap));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1686 redisplay_clear_clipped_region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1687
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1688 Clear the area in the dest display_box not covered by the src
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1689 display_glyph_area using the given face. This is a common occurrence
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1690 for images shorter than the display line. Clipping can be played
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1691 around with by altering these. glyphsrc should be normalized.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1692 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1693 static void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1694 redisplay_clear_clipped_region (Lisp_Object window, face_index findex,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1695 struct display_box* dest, struct display_glyph_area* glyphsrc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1696 int fullheight_p, Lisp_Object ignored_subwindow)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1697 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1698 /* assume dest->xpos >= 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1699 int clear_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1700 struct frame* f = XFRAME (XWINDOW (window)->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1701
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1702 if (glyphsrc->xoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1703 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 clear_x = dest->xpos + glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708 clear_x = dest->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 /* If we need the whole height cleared then just do it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1712 if (fullheight_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 redisplay_clear_region (window, findex, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715 glyphsrc->width, dest->height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 {
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1719 int yoffset = (glyphsrc->yoffset > 0 ? glyphsrc->yoffset : 0);
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1720
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721 /* We need to make sure that subwindows are unmapped from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 whole area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1723 redisplay_unmap_subwindows_except_us (f, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1724 glyphsrc->width, dest->height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 ignored_subwindow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1726 /* first the top box */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 if (yoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 redisplay_clear_region (window, findex, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730 glyphsrc->width, yoffset);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1731
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 /* Then the bottom box */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734 if (yoffset + glyphsrc->height < dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1735 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1736 redisplay_clear_region (window, findex, clear_x,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1737 dest->ypos + yoffset + glyphsrc->height,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1738 glyphsrc->width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 dest->height - (yoffset + glyphsrc->height));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1743 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1744
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1745 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746 redisplay_normalize_glyph_area
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1747 redisplay_normalize_display_box
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749 Calculate the visible box for displaying src in dest.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1750 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1751 int
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1752 redisplay_normalize_glyph_area (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753 struct display_glyph_area* glyphsrc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1754 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 if (dest->xpos + glyphsrc->xoffset > dest->xpos + dest->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1756 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1757 dest->ypos + glyphsrc->yoffset > dest->ypos + dest->height
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1758 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1759 -glyphsrc->xoffset >= glyphsrc->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1760 ||
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1761 -glyphsrc->yoffset >= glyphsrc->height
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1762 ||
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1763 /* #### Not sure why this wasn't coped with before but normalizing
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1764 to zero width or height is definitely wrong. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1765 (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1766 &&
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1767 dest->width - glyphsrc->xoffset <= 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1768 ||
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1769 (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1770 &&
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1771 dest->height - glyphsrc->yoffset <= 0))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773 /* It's all clipped out */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1774 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1776
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777 /* Horizontal offsets. This works because xoffset can be -ve as well as +ve */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778 if (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1779 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1780 if (glyphsrc->xoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781 glyphsrc->width = dest->width - glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1782 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1783 glyphsrc->width = dest->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1785
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1786 if (glyphsrc->xoffset < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787 glyphsrc->width += glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1788
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1789 /* Vertical offsets. This works because yoffset can be -ve as well as +ve */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790 if (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 if (glyphsrc->yoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1793 glyphsrc->height = dest->height - glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 glyphsrc->height = dest->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1797
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1798 if (glyphsrc->yoffset < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1799 glyphsrc->height += glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1800
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1801 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1802 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1803
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1804 static void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1805 redisplay_normalize_display_box (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1806 struct display_glyph_area* glyphsrc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 /* Adjust the destination area. At the end of this the destination
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809 area will exactly enclose the glyph area. The only remaining
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1810 adjustment will be offsets into the glyph area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1811
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1812 /* Horizontal adjustment. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813 if (glyphsrc->xoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1814 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1815 dest->xpos += glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1816 dest->width -= glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1817 glyphsrc->xoffset = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1818 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1819 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1820 glyphsrc->xoffset = -glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822 if (glyphsrc->width < dest->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1823 dest->width = glyphsrc->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1824
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1825 /* Vertical adjustment. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826 if (glyphsrc->yoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 dest->ypos += glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1829 dest->height -= glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1830 glyphsrc->yoffset = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1831 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1832 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1833 glyphsrc->yoffset = -glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1834
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835 if (glyphsrc->height < dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1836 dest->height = glyphsrc->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 redisplay_display_boxes_in_window_p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1842 Determine whether the required display_glyph_area is completely inside
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1843 the window. -1 means the display_box is not in the window. 1 means the
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1844 display_box and the display_glyph_area are in the window. 0 means
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 the display_box is in the window but the display_glyph_area is not.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 redisplay_display_boxes_in_window_p (struct window* w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849 struct display_box* db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1850 struct display_glyph_area* dga)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1851 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 int left = WINDOW_TEXT_LEFT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853 int right = WINDOW_TEXT_RIGHT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 int top = WINDOW_TEXT_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 int bottom = WINDOW_TEXT_BOTTOM (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857 if (db->xpos < left || db->ypos < top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858 || db->xpos + db->width > right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 || db->ypos + db->height > bottom)
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1860 /* We are not displaying in a window at all */
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1861 return -1;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1862
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1863 if (db->xpos + dga->xoffset >= left
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865 db->ypos + dga->yoffset >= top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 db->xpos + dga->xoffset + dga->width <= right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 db->ypos + dga->yoffset + dga->height <= bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1871
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1872 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1874
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1875 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876 redisplay_calculate_display_boxes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878 Convert from rune/display_line co-ordinates to display_box
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1879 co-ordinates.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1880 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1881 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1882 redisplay_calculate_display_boxes (struct display_line *dl, int xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 int xoffset, int start_pixpos, int width,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1884 struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1885 struct display_glyph_area* src)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1886 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887 dest->xpos = xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1888 dest->ypos = DISPLAY_LINE_YPOS (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1889 dest->width = width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890 dest->height = DISPLAY_LINE_HEIGHT (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1892 src->xoffset = -xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1893 src->yoffset = -dl->top_clip;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894 src->width = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 src->height = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897 if (start_pixpos >=0 && start_pixpos > xpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1899 /* Oops, we're asking for a start outside of the displayable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 if (start_pixpos > xpos + width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1903 dest->xpos = start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 dest->width -= (start_pixpos - xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 /* Offsets are -ve when we want to clip pixels off the displayed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 glyph. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 src->xoffset -= (start_pixpos - xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914 redisplay_clear_top_of_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916 If window is topmost, clear the internal border above it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1917 ****************************************************************************/
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1918 void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 redisplay_clear_top_of_window (struct window *w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1922 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924 if (!NILP (Fwindow_highest_p (window)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 x = w->pixel_left;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 width = w->pixel_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 if (window_is_leftmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934 x -= FRAME_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 width += FRAME_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 if (window_is_rightmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938 width += FRAME_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 y = FRAME_TOP_BORDER_START (f) - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 height = FRAME_BORDER_HEIGHT (f) + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943 redisplay_clear_region (window, DEFAULT_INDEX, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 redisplay_clear_to_window_end
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1950 Clear the area between ypos1 and ypos2. Each margin area and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1951 text area is handled separately since they may each have their own
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1952 background color.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1953 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1954 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1955 redisplay_clear_to_window_end (struct window *w, int ypos1, int ypos2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1956 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1957 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1958 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1959
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 if (HAS_DEVMETH_P (d, clear_to_window_end))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1961 DEVMETH (d, clear_to_window_end, (w, ypos1, ypos2));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1962 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1963 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1964 int height = ypos2 - ypos1;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1965
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1966 if (height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 int bflag = 0 ; /* (window_needs_vertical_divider (w) ? 0 : 1);*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970 layout_bounds bounds;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1971
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 bounds = calculate_display_line_boundaries (w, bflag);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975 if (window_is_leftmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977 ypos1, FRAME_BORDER_WIDTH (f), height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1978
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1979 if (bounds.left_in - bounds.left_out > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980 redisplay_clear_region (window,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 get_builtin_face_cache_index (w, Vleft_margin_face),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 bounds.left_out, ypos1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983 bounds.left_in - bounds.left_out, height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1984
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985 if (bounds.right_in - bounds.left_in > 0)
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1986 redisplay_clear_region (window,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987 DEFAULT_INDEX,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988 bounds.left_in, ypos1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 bounds.right_in - bounds.left_in, height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1990
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 if (bounds.right_out - bounds.right_in > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992 redisplay_clear_region (window,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993 get_builtin_face_cache_index (w, Vright_margin_face),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994 bounds.right_in, ypos1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 bounds.right_out - bounds.right_in, height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1996
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 if (window_is_rightmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1998 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 ypos1, FRAME_BORDER_WIDTH (f), height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2003
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2004 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2005 redisplay_clear_bottom_of_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007 Clear window from right below the last display line to right above
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2008 the modeline. The calling function can limit the area actually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2009 erased by setting min_start and/or max_end to positive values.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2012 redisplay_clear_bottom_of_window (struct window *w, display_line_dynarr *ddla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2013 int min_start, int max_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2016 int ypos1, ypos2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2017 int ddla_len = Dynarr_length (ddla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2018
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2019 ypos2 = WINDOW_TEXT_BOTTOM (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2020 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2021 /* This adjustment is to catch the intersection of any scrollbars. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2022 if (f->windows_structure_changed && NILP (w->scrollbar_on_top_p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023 ypos2 += window_scrollbar_height (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2025
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2026 if (ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2028 if (ddla_len == 1 && Dynarr_atp (ddla, 0)->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2029 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2030 ypos1 = WINDOW_TEXT_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2032 /* This adjustment is to catch the intersection of any scrollbars. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2033 if (f->windows_structure_changed && !NILP (w->scrollbar_on_top_p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2034 ypos1 -= window_scrollbar_height (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2035 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2036 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2037 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2038 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2039 struct display_line *dl = Dynarr_atp (ddla, ddla_len - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2040 ypos1 = dl->ypos + dl->descent - dl->clip;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2041 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2042 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2043 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2044 ypos1 = WINDOW_TEXT_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2045
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2046 /* #### See if this can be made conditional on the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2047 changing size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2048 if (MINI_WINDOW_P (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2049 ypos2 += FRAME_BORDER_HEIGHT (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2050
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2051 if (min_start >= 0 && ypos1 < min_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2052 ypos1 = min_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2053 if (max_end >= 0 && ypos2 > max_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2054 ypos2 = max_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2055
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2056 if (ypos2 <= ypos1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2057 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2058
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2059 redisplay_clear_to_window_end (w, ypos1, ypos2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2060 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2061
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2062 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2063 redisplay_update_line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2064
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2065 This is used during incremental updates to update a single line and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2066 correct the offsets on all lines below it. At the moment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2067 update_values is false if we are only updating the modeline.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2068 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2069 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2070 redisplay_update_line (struct window *w, int first_line, int last_line,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2071 int update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2072 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2073 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2074 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2075
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2076 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2077 display_line_dynarr *ddla = window_display_lines (w, DESIRED_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2078
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2079 MAYBE_DEVMETH (d, window_output_begin, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2080
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2081 while (first_line <= last_line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2082 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2083 Charcount old_len = (Dynarr_atp (cdla, first_line)->end_bufpos -
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2084 Dynarr_atp (cdla, first_line)->bufpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2085 Charcount new_len = (Dynarr_atp (ddla, first_line)->end_bufpos -
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2086 Dynarr_atp (ddla, first_line)->bufpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2087
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2088 assert (Dynarr_length (cdla) == Dynarr_length (ddla));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2089
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2090 /* Output the changes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2091 output_display_line (w, cdla, ddla, first_line, -1, -1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2092
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2093 /* Update the offsets. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2094 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2095 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2096 int cur_line = first_line + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2097 while (cur_line < Dynarr_length (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2098 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2099 Dynarr_atp (cdla, cur_line)->offset += (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2100 Dynarr_atp (ddla, cur_line)->offset += (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2101 cur_line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2102 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2103 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2105 /* Update the window_end_pos and other settings. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2106 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2107 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2108 w->window_end_pos[CURRENT_DISP] -= (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2110 if (Dynarr_atp (ddla, first_line)->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2111 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2112 w->last_point_x[CURRENT_DISP] = w->last_point_x[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2113 w->last_point_y[CURRENT_DISP] = w->last_point_y[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2114 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2115 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2117 first_line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2118 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2120 /* Update the window max line length. We have to scan the entire
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2121 set of display lines otherwise we might not detect if the max is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2122 supposed to shrink. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2123 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2124 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2125 int line = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2127 w->max_line_len = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2128 while (line < Dynarr_length (ddla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2129 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2130 struct display_line *dl = Dynarr_atp (ddla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2132 if (!dl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2133 w->max_line_len = max (dl->num_chars, w->max_line_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2135 line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2136 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2137 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2139 w->last_modified[CURRENT_DISP] = w->last_modified[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2140 w->last_facechange[CURRENT_DISP] = w->last_facechange[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2141 Fset_marker (w->last_point[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2142 Fmarker_position (w->last_point[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2143 Fset_marker (w->last_start[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2144 Fmarker_position (w->last_start[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2146 /* We don't bother updating the vertical scrollbars here. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2147 gives us a performance increase while having minimal loss of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2148 quality to the scrollbar slider size and position since when this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2149 function is called we know that the changes to the buffer were
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2150 very localized. We have to update the horizontal scrollbars,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2151 though, because this routine could cause a change which has a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2152 larger impact on their sizing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2153 /* #### See if we can get away with only calling this if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2154 max_line_len is greater than the window_char_width. */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
2155 /* #### BILL!!! Should we do this for GTK as well? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2156 #if defined(HAVE_SCROLLBARS) && defined(HAVE_X_WINDOWS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2157 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2158 extern int stupid_vertical_scrollbar_drag_hack;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2159
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2160 update_window_scrollbars (w, NULL, 1, stupid_vertical_scrollbar_drag_hack);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2161 stupid_vertical_scrollbar_drag_hack = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2162 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2163 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2164
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2165 redisplay_redraw_cursor (f, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2166 MAYBE_DEVMETH (d, window_output_end, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2167 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2169 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2170 redisplay_output_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2172 For the given window W, ensure that the current display lines are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2173 equal to the desired display lines, outputing changes as necessary.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2175 #### Fuck me. This just isn't going to cut it for tty's. The output
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2176 decisions for them must be based on the contents of the entire frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2177 because that is how the available output capabilities think. The
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2178 solution is relatively simple. Create redisplay_output_frame. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2179 will basically merge all of the separate window display structs into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2180 a single one for the frame. This combination structure will be able
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2181 to be passed to the same output_display_line which works for windows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2182 on X frames and the right things will happen. It just takes time to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2183 do.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2184 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2185 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2186 redisplay_output_window (struct window *w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2187 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2188 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2189 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2191 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2192 display_line_dynarr *ddla = window_display_lines (w, DESIRED_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2193
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2194 int cdla_len = Dynarr_length (cdla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2195 int ddla_len = Dynarr_length (ddla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2196
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2197 int line;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2198 int need_to_clear_bottom = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2199 int need_to_clear_start = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2200 int need_to_clear_end = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2201
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2202 /* Backgrounds may have changed or windows may have gone away
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2203 leaving dividers lying around. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2204 if (f->faces_changed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2205 || f->windows_structure_changed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2206 || w->shadow_thickness_changed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2207 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2209 /* The first thing we do is determine if we are going to need to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2210 clear the bottom of the window. We only need to do this if the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2211 bottom of the current display lines is below the bottom of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2212 desired display lines. Note that the number of lines is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2213 irrelevant. Only the position matters. We also clear to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2214 bottom of the window if the modeline has shifted position. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2215 /* #### We can't blindly not clear the bottom if f->clear is true
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2216 since there might be a window-local background. However, for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2217 those cases where there isn't, clearing the end of the window in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2218 this case sucks. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2219 if (!need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2220 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2221 struct display_line *cdl, *ddl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2222
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2223 /* If the modeline has changed position or size, clear the bottom
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2224 of the window. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2225 if (!need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2226 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2227 cdl = ddl = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2228
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2229 if (cdla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2230 cdl = Dynarr_atp (cdla, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2231 if (ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2232 ddl = Dynarr_atp (ddla, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2233
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2234 if (!cdl || !ddl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2235 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2236 else if ((!cdl->modeline && ddl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2237 || (cdl->modeline && !ddl->modeline))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2238 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2239 else if (cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2240 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2241 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2242 cdl->clip != ddl->clip)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2243 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2244
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2245 /* #### This kludge is to make sure the modeline shadows get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2246 redrawn if the modeline position shifts. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2247 if (need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2248 w->shadow_thickness_changed = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2249 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2250
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2251 if (!need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2252 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2253 cdl = ddl = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2254
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2255 if (cdla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2256 cdl = Dynarr_atp (cdla, cdla_len - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2257 if (ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2258 ddl = Dynarr_atp (ddla, ddla_len - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2259
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2260 if (!cdl || !ddl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2261 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2262 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2263 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2264 int cdl_bottom, ddl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2266 cdl_bottom = cdl->ypos + cdl->descent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2267 ddl_bottom = ddl->ypos + ddl->descent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2269 if (cdl_bottom > ddl_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2270 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2271 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2272 need_to_clear_start = ddl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2273 need_to_clear_end = cdl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2274 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2275 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2276 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2277 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2279 /* Perform any output initialization. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2280 MAYBE_DEVMETH (d, window_output_begin, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2282 /* If the window's structure has changed clear the internal border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2283 above it if it is topmost (the function will check). */
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2284 if (f->windows_structure_changed || f->faces_changed)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2285 redisplay_clear_top_of_window (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2287 /* Output each line. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2288 for (line = 0; line < Dynarr_length (ddla); line++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2289 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2290 output_display_line (w, cdla, ddla, line, -1, -1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2291 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2293 /* If the number of display lines has shrunk, adjust. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2294 if (cdla_len > ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2295 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2296 Dynarr_length (cdla) = ddla_len;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2297 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2299 /* Output a vertical divider between windows, if necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2300 if (window_needs_vertical_divider (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2301 && (f->windows_structure_changed || f->clear))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2302 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2303 MAYBE_DEVMETH (d, output_vertical_divider, (w, f->windows_structure_changed));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2304 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2306 /* Clear the rest of the window, if necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2307 if (need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2308 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2309 redisplay_clear_bottom_of_window (w, ddla, need_to_clear_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2310 need_to_clear_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2311 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2313 w->window_end_pos[CURRENT_DISP] = w->window_end_pos[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2314 Fset_marker (w->start[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2315 make_int (marker_position (w->start[DESIRED_DISP])),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2316 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2317 Fset_marker (w->pointm[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2318 make_int (marker_position (w->pointm[DESIRED_DISP])),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2319 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2320 w->last_modified[CURRENT_DISP] = w->last_modified[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2321 w->last_facechange[CURRENT_DISP] = w->last_facechange[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2322 Fset_marker (w->last_start[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2323 Fmarker_position (w->last_start[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2324 Fset_marker (w->last_point[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2325 Fmarker_position (w->last_point[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2326 w->last_point_x[CURRENT_DISP] = w->last_point_x[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2327 w->last_point_y[CURRENT_DISP] = w->last_point_y[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2328 w->shadow_thickness_changed = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2330 set_window_display_buffer (w, XBUFFER (w->buffer));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2331 find_window_mirror (w)->truncate_win = window_truncation_on (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2333 /* Overkill on invalidating the cache. It is very bad for it to not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2334 get invalidated when it should be. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2335 INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2336
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2337 redisplay_redraw_cursor (f, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2338 MAYBE_DEVMETH (d, window_output_end, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2340 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2341 update_window_scrollbars (w, NULL, !MINI_WINDOW_P (w), 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2342 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2343 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2344
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2345 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2346 bevel_modeline
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2348 Draw a 3d border around the modeline on window W.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2349 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2350 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2351 bevel_modeline (struct window *w, struct display_line *dl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2352 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2353 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2354 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2355 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2356 int shadow_thickness = MODELINE_SHADOW_THICKNESS (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2357 enum edge_style style;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2358
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2359 x = WINDOW_MODELINE_LEFT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2360 width = WINDOW_MODELINE_RIGHT (w) - x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2361 y = dl->ypos - dl->ascent - shadow_thickness;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2362 height = dl->ascent + dl->descent + 2 * shadow_thickness;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2364 if (XINT (w->modeline_shadow_thickness) < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2365 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2366 style = EDGE_BEVEL_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2367 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2368 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2369 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2370 style = EDGE_BEVEL_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2371 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2372
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2373 MAYBE_DEVMETH (d, bevel_area,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2374 (w, MODELINE_INDEX, x, y, width, height, shadow_thickness,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2375 EDGE_ALL, style));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2376 }