Mercurial > hg > xemacs-beta
comparison src/redisplay.c @ 185:3d6bfa290dbd r20-3b19
Import from CVS: tag r20-3b19
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:55:28 +0200 |
parents | e121b013d1f0 |
children | b405438285a2 |
comparison
equal
deleted
inserted
replaced
184:bcd2674570bf | 185:3d6bfa290dbd |
---|---|
190 blocks. | 190 blocks. |
191 | 191 |
192 #### It's unclean that both Emchars and Bufbytes are here. | 192 #### It's unclean that both Emchars and Bufbytes are here. |
193 */ | 193 */ |
194 | 194 |
195 typedef struct prop_block prop_block; | |
195 struct prop_block | 196 struct prop_block |
196 { | 197 { |
197 enum prop_type type; | 198 enum prop_type type; |
198 | 199 |
199 union data | 200 union data |
217 face_index findex; | 218 face_index findex; |
218 } p_blank; | 219 } p_blank; |
219 } data; | 220 } data; |
220 }; | 221 }; |
221 | 222 |
222 typedef struct prop_block_dynarr_type | 223 typedef struct |
223 { | 224 { |
224 Dynarr_declare (struct prop_block); | 225 Dynarr_declare (prop_block); |
225 } prop_block_dynarr; | 226 } prop_block_dynarr; |
226 | 227 |
227 | 228 |
228 /* | 229 /* |
229 * Prototypes for all functions defined in redisplay.c. | 230 * Prototypes for all functions defined in redisplay.c. |
282 int overlay_width); | 283 int overlay_width); |
283 static void create_right_glyph_block (struct window *w, | 284 static void create_right_glyph_block (struct window *w, |
284 struct display_line *dl); | 285 struct display_line *dl); |
285 static void regenerate_window (struct window *w, Bufpos start_pos, | 286 static void regenerate_window (struct window *w, Bufpos start_pos, |
286 Bufpos point, int type); | 287 Bufpos point, int type); |
287 static void regenerate_window_point_center (struct window *w, Bufpos point, | 288 static Bufpos regenerate_window_point_center (struct window *w, Bufpos point, |
288 int type); | 289 int type); |
289 int window_half_pixpos (struct window *w); | 290 int window_half_pixpos (struct window *w); |
290 int line_at_center (struct window *w, int type, Bufpos start, Bufpos point); | 291 int line_at_center (struct window *w, int type, Bufpos start, Bufpos point); |
291 Bufpos point_at_center (struct window *w, int type, Bufpos start, | 292 Bufpos point_at_center (struct window *w, int type, Bufpos start, |
292 Bufpos point); | 293 Bufpos point); |
293 static void redisplay_window (Lisp_Object window, int skip_selected); | 294 static void redisplay_window (Lisp_Object window, int skip_selected); |
327 isn't any reason we need more than a single set. */ | 328 isn't any reason we need more than a single set. */ |
328 display_line_dynarr *cmotion_display_lines; | 329 display_line_dynarr *cmotion_display_lines; |
329 | 330 |
330 /* Used by generate_formatted_string. Global because they get used so | 331 /* Used by generate_formatted_string. Global because they get used so |
331 much that the dynamic allocation time adds up. */ | 332 much that the dynamic allocation time adds up. */ |
332 emchar_dynarr *formatted_string_emchar_dynarr; | 333 Emchar_dynarr *formatted_string_emchar_dynarr; |
333 struct display_line formatted_string_display_line; | 334 struct display_line formatted_string_display_line; |
334 /* We store the extents that we need to generate in a Dynarr and then | 335 /* We store the extents that we need to generate in a Dynarr and then |
335 frob them all on at the end of generating the string. We do it | 336 frob them all on at the end of generating the string. We do it |
336 this way rather than adding them as we generate the string because | 337 this way rather than adding them as we generate the string because |
337 we don't store the text into the resulting string until we're done | 338 we don't store the text into the resulting string until we're done |
338 (to avoid having to resize the string multiple times), and we don't | 339 (to avoid having to resize the string multiple times), and we don't |
339 want to go around adding extents to a string when the extents might | 340 want to go around adding extents to a string when the extents might |
340 stretch off the end of the string. */ | 341 stretch off the end of the string. */ |
341 extent_dynarr *formatted_string_extent_dynarr; | 342 EXTENT_dynarr *formatted_string_extent_dynarr; |
342 bytecount_dynarr *formatted_string_extent_start_dynarr; | 343 Bytecount_dynarr *formatted_string_extent_start_dynarr; |
343 bytecount_dynarr *formatted_string_extent_end_dynarr; | 344 Bytecount_dynarr *formatted_string_extent_end_dynarr; |
344 | 345 |
345 | 346 |
346 /* #### probably temporary */ | 347 /* #### probably temporary */ |
347 int cache_adjustment; | 348 int cache_adjustment; |
348 | 349 |
349 /* This holds a string representing the text corresponding to a single | 350 /* This holds a string representing the text corresponding to a single |
350 modeline % spec. */ | 351 modeline % spec. */ |
351 static bufbyte_dynarr *mode_spec_bufbyte_string; | 352 static Bufbyte_dynarr *mode_spec_bufbyte_string; |
352 | 353 |
353 int in_display; /* 1 if in redisplay. */ | 354 int in_display; /* 1 if in redisplay. */ |
354 | 355 |
355 int disable_preemption; /* Used for debugging redisplay and for | 356 int disable_preemption; /* Used for debugging redisplay and for |
356 force-redisplay. */ | 357 force-redisplay. */ |
507 return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (WINDOW_FRAME (w)))), | 508 return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (WINDOW_FRAME (w)))), |
508 text_width, (WINDOW_FACE_CACHEL (w, findex), | 509 text_width, (WINDOW_FACE_CACHEL (w, findex), |
509 str, len)); | 510 str, len)); |
510 } | 511 } |
511 | 512 |
512 static emchar_dynarr *rtw_emchar_dynarr; | 513 static Emchar_dynarr *rtw_emchar_dynarr; |
513 | 514 |
514 int | 515 int |
515 redisplay_text_width_string (struct window *w, int findex, | 516 redisplay_text_width_string (struct window *w, int findex, |
516 Bufbyte *nonreloc, Lisp_Object reloc, | 517 Bufbyte *nonreloc, Lisp_Object reloc, |
517 Bytecount offset, Bytecount len) | 518 Bytecount offset, Bytecount len) |
592 } | 593 } |
593 else | 594 else |
594 { | 595 { |
595 /* This line doesn't have any display blocks, so initialize the display | 596 /* This line doesn't have any display blocks, so initialize the display |
596 bock array. */ | 597 bock array. */ |
597 dl->display_blocks = Dynarr_new (struct display_block); | 598 dl->display_blocks = Dynarr_new (display_block); |
598 } | 599 } |
599 | 600 |
600 /* The line doesn't have a block of the desired type so go ahead and create | 601 /* The line doesn't have a block of the desired type so go ahead and create |
601 one and add it to the line. */ | 602 one and add it to the line. */ |
602 memset (&db, 0, sizeof (struct display_block)); | 603 memset (&db, 0, sizeof (struct display_block)); |
603 db.type = type; | 604 db.type = type; |
604 db.runes = Dynarr_new (struct rune); | 605 db.runes = Dynarr_new (rune); |
605 Dynarr_add (dl->display_blocks, db); | 606 Dynarr_add (dl->display_blocks, db); |
606 | 607 |
607 /* Return the newly added display block. */ | 608 /* Return the newly added display block. */ |
608 elt = Dynarr_length (dl->display_blocks) - 1; | 609 elt = Dynarr_length (dl->display_blocks) - 1; |
609 | 610 |
994 return ADD_FAILED; | 995 return ADD_FAILED; |
995 else | 996 else |
996 { | 997 { |
997 struct prop_block pb; | 998 struct prop_block pb; |
998 Bytecount len = end - pos; | 999 Bytecount len = end - pos; |
999 prop = Dynarr_new (struct prop_block); | 1000 prop = Dynarr_new (prop_block); |
1000 | 1001 |
1001 pb.type = PROP_STRING; | 1002 pb.type = PROP_STRING; |
1002 pb.data.p_string.str = | 1003 pb.data.p_string.str = xnew_array (Bufbyte, len); |
1003 (Bufbyte *) xmalloc (sizeof (Bufbyte) * len); | |
1004 strncpy ((char *) pb.data.p_string.str, (char *) pos, len); | 1004 strncpy ((char *) pb.data.p_string.str, (char *) pos, len); |
1005 pb.data.p_string.len = len; | 1005 pb.data.p_string.len = len; |
1006 | 1006 |
1007 Dynarr_add (prop, pb); | 1007 Dynarr_add (prop, pb); |
1008 return prop; | 1008 return prop; |
1106 { \ | 1106 { \ |
1107 if (add_failed || (add_failed = add_emchar_rune (data))) \ | 1107 if (add_failed || (add_failed = add_emchar_rune (data))) \ |
1108 { \ | 1108 { \ |
1109 struct prop_block pb; \ | 1109 struct prop_block pb; \ |
1110 if (!prop) \ | 1110 if (!prop) \ |
1111 prop = Dynarr_new (struct prop_block); \ | 1111 prop = Dynarr_new (prop_block); \ |
1112 \ | 1112 \ |
1113 pb.type = PROP_CHAR; \ | 1113 pb.type = PROP_CHAR; \ |
1114 pb.data.p_char.ch = data->ch; \ | 1114 pb.data.p_char.ch = data->ch; \ |
1115 pb.data.p_char.cursor_type = data->cursor_type; \ | 1115 pb.data.p_char.cursor_type = data->cursor_type; \ |
1116 Dynarr_add (prop, pb); \ | 1116 Dynarr_add (prop, pb); \ |
1241 | 1241 |
1242 if (add_emchar_rune (data)) | 1242 if (add_emchar_rune (data)) |
1243 { | 1243 { |
1244 struct prop_block pb; | 1244 struct prop_block pb; |
1245 if (!prop) | 1245 if (!prop) |
1246 prop = Dynarr_new (struct prop_block); | 1246 prop = Dynarr_new (prop_block); |
1247 | 1247 |
1248 pb.type = PROP_CHAR; | 1248 pb.type = PROP_CHAR; |
1249 pb.data.p_char.ch = data->ch; | 1249 pb.data.p_char.ch = data->ch; |
1250 pb.data.p_char.cursor_type = data->cursor_type; | 1250 pb.data.p_char.cursor_type = data->cursor_type; |
1251 Dynarr_add (prop, pb); | 1251 Dynarr_add (prop, pb); |
1714 gb->findex = data->findex; | 1714 gb->findex = data->findex; |
1715 | 1715 |
1716 if (pos_type == BEGIN_GLYPHS) | 1716 if (pos_type == BEGIN_GLYPHS) |
1717 { | 1717 { |
1718 if (!data->dl->left_glyphs) | 1718 if (!data->dl->left_glyphs) |
1719 data->dl->left_glyphs = Dynarr_new (struct glyph_block); | 1719 data->dl->left_glyphs = Dynarr_new (glyph_block); |
1720 Dynarr_add (data->dl->left_glyphs, *gb); | 1720 Dynarr_add (data->dl->left_glyphs, *gb); |
1721 return NULL; | 1721 return NULL; |
1722 } | 1722 } |
1723 else if (pos_type == END_GLYPHS) | 1723 else if (pos_type == END_GLYPHS) |
1724 { | 1724 { |
1725 if (!data->dl->right_glyphs) | 1725 if (!data->dl->right_glyphs) |
1726 data->dl->right_glyphs = Dynarr_new (struct glyph_block); | 1726 data->dl->right_glyphs = Dynarr_new (glyph_block); |
1727 Dynarr_add (data->dl->right_glyphs, *gb); | 1727 Dynarr_add (data->dl->right_glyphs, *gb); |
1728 return NULL; | 1728 return NULL; |
1729 } | 1729 } |
1730 else | 1730 else |
1731 abort (); /* there are no unknown types */ | 1731 abort (); /* there are no unknown types */ |
2298 assert (!(*prop)); | 2298 assert (!(*prop)); |
2299 | 2299 |
2300 if (prop_width) | 2300 if (prop_width) |
2301 { | 2301 { |
2302 struct prop_block pb; | 2302 struct prop_block pb; |
2303 *prop = Dynarr_new (struct prop_block); | 2303 *prop = Dynarr_new (prop_block); |
2304 | 2304 |
2305 pb.type = PROP_BLANK; | 2305 pb.type = PROP_BLANK; |
2306 pb.data.p_blank.width = prop_width; | 2306 pb.data.p_blank.width = prop_width; |
2307 pb.data.p_blank.findex = data.findex; | 2307 pb.data.p_blank.findex = data.findex; |
2308 Dynarr_add (*prop, pb); | 2308 Dynarr_add (*prop, pb); |
2915 int marker = 0; | 2915 int marker = 0; |
2916 int used_in, used_out; | 2916 int used_in, used_out; |
2917 | 2917 |
2918 elt = 0; | 2918 elt = 0; |
2919 used_in = used_out = 0; | 2919 used_in = used_out = 0; |
2920 ib = Dynarr_new (struct glyph_block); | 2920 ib = Dynarr_new (glyph_block); |
2921 while (elt < Dynarr_length (dl->left_glyphs)) | 2921 while (elt < Dynarr_length (dl->left_glyphs)) |
2922 { | 2922 { |
2923 struct glyph_block *gb = Dynarr_atp (dl->left_glyphs, elt); | 2923 struct glyph_block *gb = Dynarr_atp (dl->left_glyphs, elt); |
2924 | 2924 |
2925 if (NILP (gb->extent)) | 2925 if (NILP (gb->extent)) |
3234 int marker = 0; | 3234 int marker = 0; |
3235 int used_in, used_out; | 3235 int used_in, used_out; |
3236 | 3236 |
3237 elt = 0; | 3237 elt = 0; |
3238 used_in = used_out = 0; | 3238 used_in = used_out = 0; |
3239 ib = Dynarr_new (struct glyph_block); | 3239 ib = Dynarr_new (glyph_block); |
3240 while (elt < Dynarr_length (dl->right_glyphs)) | 3240 while (elt < Dynarr_length (dl->right_glyphs)) |
3241 { | 3241 { |
3242 struct glyph_block *gb = Dynarr_atp (dl->right_glyphs, elt); | 3242 struct glyph_block *gb = Dynarr_atp (dl->right_glyphs, elt); |
3243 | 3243 |
3244 if (NILP (gb->extent)) | 3244 if (NILP (gb->extent)) |
4160 | 4160 |
4161 /* #### Kludge or not a kludge. I tend towards the former. */ | 4161 /* #### Kludge or not a kludge. I tend towards the former. */ |
4162 int | 4162 int |
4163 real_current_modeline_height (struct window *w) | 4163 real_current_modeline_height (struct window *w) |
4164 { | 4164 { |
4165 Fset_marker (w->start[CMOTION_DISP], w->start[CURRENT_DISP], w->buffer); | 4165 Fset_marker (w->start[CMOTION_DISP], w->start[CURRENT_DISP], w->buffer); |
4166 Fset_marker (w->pointm[CMOTION_DISP], w->pointm[CURRENT_DISP], w->buffer); | 4166 Fset_marker (w->pointm[CMOTION_DISP], w->pointm[CURRENT_DISP], w->buffer); |
4167 | 4167 |
4168 if (ensure_modeline_generated (w, CMOTION_DISP)) | 4168 if (ensure_modeline_generated (w, CMOTION_DISP)) |
4169 { | 4169 { |
4170 display_line_dynarr *dla; | 4170 display_line_dynarr *dla = window_display_lines (w, CMOTION_DISP); |
4171 | |
4172 dla = window_display_lines (w, CMOTION_DISP); | |
4173 | 4171 |
4174 if (Dynarr_length (dla)) | 4172 if (Dynarr_length (dla)) |
4175 { | 4173 { |
4176 if (Dynarr_atp (dla, 0)->modeline) | 4174 if (Dynarr_atp (dla, 0)->modeline) |
4177 return (Dynarr_atp (dla, 0)->ascent + | 4175 return (Dynarr_atp (dla, 0)->ascent + |
4178 Dynarr_atp (dla, 0)->descent); | 4176 Dynarr_atp (dla, 0)->descent); |
4179 else | 4177 } |
4180 return 0; | 4178 } |
4181 } | 4179 return 0; |
4182 else | |
4183 return 0; | |
4184 } | |
4185 else | |
4186 return 0; | |
4187 } | 4180 } |
4188 | 4181 |
4189 | 4182 |
4190 /***************************************************************************/ | 4183 /***************************************************************************/ |
4191 /* */ | 4184 /* */ |
4246 && !echo_area_active (f) | 4239 && !echo_area_active (f) |
4247 && start_pos == BUF_BEGV (b)) | 4240 && start_pos == BUF_BEGV (b)) |
4248 { | 4241 { |
4249 struct prop_block pb; | 4242 struct prop_block pb; |
4250 Lisp_Object string; | 4243 Lisp_Object string; |
4251 prop = Dynarr_new (struct prop_block); | 4244 prop = Dynarr_new (prop_block); |
4252 | 4245 |
4253 string = concat2(Vminibuf_preprompt, Vminibuf_prompt); | 4246 string = concat2(Vminibuf_preprompt, Vminibuf_prompt); |
4254 pb.type = PROP_MINIBUF_PROMPT; | 4247 pb.type = PROP_MINIBUF_PROMPT; |
4255 pb.data.p_string.str = XSTRING_DATA(string); | 4248 pb.data.p_string.str = XSTRING_DATA(string); |
4256 pb.data.p_string.len = XSTRING_LENGTH(string); | 4249 pb.data.p_string.len = XSTRING_LENGTH(string); |
4795 /* Oh, well. */ | 4788 /* Oh, well. */ |
4796 return 0; | 4789 return 0; |
4797 } | 4790 } |
4798 | 4791 |
4799 /* Given a window and a point, update the given display lines such | 4792 /* Given a window and a point, update the given display lines such |
4800 that point is displayed in the middle of the window. */ | 4793 that point is displayed in the middle of the window. |
4801 | 4794 Return the window's new start position. */ |
4802 static void | 4795 |
4796 static Bufpos | |
4803 regenerate_window_point_center (struct window *w, Bufpos point, int type) | 4797 regenerate_window_point_center (struct window *w, Bufpos point, int type) |
4804 { | 4798 { |
4805 Bufpos startp; | 4799 Bufpos startp; |
4806 | 4800 |
4807 /* We need to make sure that the modeline is generated so that the | 4801 /* We need to make sure that the modeline is generated so that the |
4810 | 4804 |
4811 startp = start_with_line_at_pixpos (w, point, window_half_pixpos (w)); | 4805 startp = start_with_line_at_pixpos (w, point, window_half_pixpos (w)); |
4812 regenerate_window (w, startp, point, type); | 4806 regenerate_window (w, startp, point, type); |
4813 Fset_marker (w->start[type], make_int (startp), w->buffer); | 4807 Fset_marker (w->start[type], make_int (startp), w->buffer); |
4814 | 4808 |
4815 return; | 4809 return startp; |
4816 } | 4810 } |
4817 | 4811 |
4818 /* Given a window and a set of display lines, return a boolean | 4812 /* Given a window and a set of display lines, return a boolean |
4819 indicating whether the given point is contained within. */ | 4813 indicating whether the given point is contained within. */ |
4820 | 4814 |
5022 /* If the marker's buffer is not the window's buffer, then we need | 5016 /* If the marker's buffer is not the window's buffer, then we need |
5023 to find a new starting position. */ | 5017 to find a new starting position. */ |
5024 if (!MINI_WINDOW_P (w) | 5018 if (!MINI_WINDOW_P (w) |
5025 && !EQ (Fmarker_buffer (w->start[CURRENT_DISP]), w->buffer)) | 5019 && !EQ (Fmarker_buffer (w->start[CURRENT_DISP]), w->buffer)) |
5026 { | 5020 { |
5027 regenerate_window_point_center (w, pointm, DESIRED_DISP); | 5021 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP); |
5028 | 5022 |
5029 goto regeneration_done; | 5023 goto regeneration_done; |
5030 } | 5024 } |
5031 | 5025 |
5032 if (echo_active) | 5026 if (echo_active) |
5156 || (pointm == startp && | 5150 || (pointm == startp && |
5157 EQ (Fmarker_buffer (w->last_start[CURRENT_DISP]), w->buffer) && | 5151 EQ (Fmarker_buffer (w->last_start[CURRENT_DISP]), w->buffer) && |
5158 startp < marker_position (w->last_start[CURRENT_DISP])) | 5152 startp < marker_position (w->last_start[CURRENT_DISP])) |
5159 || (startp == BUF_ZV (b))) | 5153 || (startp == BUF_ZV (b))) |
5160 { | 5154 { |
5161 regenerate_window_point_center (w, pointm, DESIRED_DISP); | 5155 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP); |
5162 | 5156 |
5163 goto regeneration_done; | 5157 goto regeneration_done; |
5164 } | 5158 } |
5165 /* See if we can update the data structures locally based on | 5159 /* See if we can update the data structures locally based on |
5166 knowledge of what changed in the buffer. */ | 5160 knowledge of what changed in the buffer. */ |
5194 /* We still haven't gotten the window regenerated with point | 5188 /* We still haven't gotten the window regenerated with point |
5195 visible. Next we try scrolling a little and see if point comes | 5189 visible. Next we try scrolling a little and see if point comes |
5196 back onto the screen. */ | 5190 back onto the screen. */ |
5197 if (scroll_step) | 5191 if (scroll_step) |
5198 { | 5192 { |
5199 Bufpos bufpos; | 5193 startp = vmotion (w, startp, |
5200 | |
5201 bufpos = vmotion (w, startp, | |
5202 (pointm < startp) ? -scroll_step : scroll_step, 0); | 5194 (pointm < startp) ? -scroll_step : scroll_step, 0); |
5203 regenerate_window (w, bufpos, pointm, DESIRED_DISP); | 5195 regenerate_window (w, startp, pointm, DESIRED_DISP); |
5204 | 5196 |
5205 if (point_visible (w, pointm, DESIRED_DISP)) | 5197 if (point_visible (w, pointm, DESIRED_DISP)) |
5206 goto regeneration_done; | 5198 goto regeneration_done; |
5207 } | 5199 } |
5208 | 5200 |
5209 /* We still haven't managed to get the screen drawn with point on | 5201 /* We still haven't managed to get the screen drawn with point on |
5210 the screen, so just center it and be done with it. */ | 5202 the screen, so just center it and be done with it. */ |
5211 regenerate_window_point_center (w, pointm, DESIRED_DISP); | 5203 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP); |
5212 | 5204 |
5213 | 5205 |
5214 regeneration_done: | 5206 regeneration_done: |
5215 | 5207 |
5216 /* If the window's frame is changed then reset the current display | 5208 /* If the window's frame is changed then reset the current display |
5414 if (FRAME_TTY_P (f)) | 5406 if (FRAME_TTY_P (f)) |
5415 DEVMETH (d, output_end, (d)); | 5407 DEVMETH (d, output_end, (d)); |
5416 | 5408 |
5417 update_frame_title (f); | 5409 update_frame_title (f); |
5418 | 5410 |
5419 f->buffers_changed = 0; | 5411 f->buffers_changed = 0; |
5420 f->clip_changed = 0; | 5412 f->clip_changed = 0; |
5421 f->extents_changed = 0; | 5413 f->extents_changed = 0; |
5422 f->faces_changed = 0; | 5414 f->faces_changed = 0; |
5423 f->frame_changed = 0; | 5415 f->frame_changed = 0; |
5424 f->icon_changed = 0; | 5416 f->icon_changed = 0; |
5425 f->menubar_changed = 0; | 5417 f->menubar_changed = 0; |
5426 f->modeline_changed = 0; | 5418 f->modeline_changed = 0; |
5427 f->point_changed = 0; | 5419 f->point_changed = 0; |
5428 f->toolbar_changed = 0; | 5420 f->toolbar_changed = 0; |
5429 f->windows_changed = 0; | 5421 f->windows_changed = 0; |
5430 f->windows_structure_changed = 0; | 5422 f->windows_structure_changed = 0; |
5431 f->window_face_cache_reset = 0; | 5423 f->window_face_cache_reset = 0; |
5432 | 5424 |
5433 f->clear = 0; | 5425 f->clear = 0; |
5434 | 5426 |
5477 if (f->icon_changed || f->windows_changed) | 5469 if (f->icon_changed || f->windows_changed) |
5478 update_frame_icon (f); | 5470 update_frame_icon (f); |
5479 | 5471 |
5480 if (FRAME_REPAINT_P (f)) | 5472 if (FRAME_REPAINT_P (f)) |
5481 { | 5473 { |
5482 if (f->buffers_changed || f->clip_changed || f->extents_changed | 5474 if (f->buffers_changed || f->clip_changed || f->extents_changed || |
5483 || f->faces_changed || f->frame_changed || f->menubar_changed | 5475 f->faces_changed || f->frame_changed || f->menubar_changed || |
5484 || f->modeline_changed || f->point_changed || f->size_changed | 5476 f->modeline_changed || f->point_changed || f->size_changed || |
5485 || f->toolbar_changed || f->windows_changed | 5477 f->toolbar_changed || f->windows_changed || |
5486 || f->windows_structure_changed) | 5478 f->windows_structure_changed) |
5487 { | 5479 { |
5488 preempted = redisplay_frame (f, 0); | 5480 preempted = redisplay_frame (f, 0); |
5489 } | 5481 } |
5490 | 5482 |
5491 if (preempted) | 5483 if (preempted) |
5511 if (f->icon_changed || f->windows_changed) | 5503 if (f->icon_changed || f->windows_changed) |
5512 update_frame_icon (f); | 5504 update_frame_icon (f); |
5513 | 5505 |
5514 if (FRAME_REPAINT_P (f)) | 5506 if (FRAME_REPAINT_P (f)) |
5515 { | 5507 { |
5516 if (f->buffers_changed || f->clip_changed || f->extents_changed | 5508 if (f->buffers_changed || f->clip_changed || f->extents_changed || |
5517 || f->faces_changed || f->frame_changed || f->menubar_changed | 5509 f->faces_changed || f->frame_changed || f->menubar_changed || |
5518 || f->modeline_changed || f->point_changed || f->size_changed | 5510 f->modeline_changed || f->point_changed || f->size_changed || |
5519 || f->toolbar_changed || f->windows_changed | 5511 f->toolbar_changed || f->windows_changed || |
5520 || f->windows_structure_changed) | 5512 f->windows_structure_changed) |
5521 { | 5513 { |
5522 preempted = redisplay_frame (f, 0); | 5514 preempted = redisplay_frame (f, 0); |
5523 } | 5515 } |
5524 | 5516 |
5525 if (preempted) | 5517 if (preempted) |
5530 } | 5522 } |
5531 } | 5523 } |
5532 | 5524 |
5533 /* If we get here then we redisplayed all of our frames without | 5525 /* If we get here then we redisplayed all of our frames without |
5534 getting preempted so mark ourselves as clean. */ | 5526 getting preempted so mark ourselves as clean. */ |
5535 d->buffers_changed = 0; | 5527 d->buffers_changed = 0; |
5536 d->clip_changed = 0; | 5528 d->clip_changed = 0; |
5537 d->extents_changed = 0; | 5529 d->extents_changed = 0; |
5538 d->faces_changed = 0; | 5530 d->faces_changed = 0; |
5539 d->frame_changed = 0; | 5531 d->frame_changed = 0; |
5540 d->icon_changed = 0; | 5532 d->icon_changed = 0; |
5541 d->menubar_changed = 0; | 5533 d->menubar_changed = 0; |
5542 d->modeline_changed = 0; | 5534 d->modeline_changed = 0; |
5543 d->point_changed = 0; | 5535 d->point_changed = 0; |
5544 d->toolbar_changed = 0; | 5536 d->toolbar_changed = 0; |
5545 d->windows_changed = 0; | 5537 d->windows_changed = 0; |
5546 d->windows_structure_changed = 0; | 5538 d->windows_structure_changed = 0; |
5547 | 5539 |
5548 if (!size_change_failed) | 5540 if (!size_change_failed) |
5549 d->size_changed = 0; | 5541 d->size_changed = 0; |
5550 | 5542 |
5580 #endif /* WINDOWSNT */ | 5572 #endif /* WINDOWSNT */ |
5581 | 5573 |
5582 if (asynch_device_change_pending) | 5574 if (asynch_device_change_pending) |
5583 handle_asynch_device_change (); | 5575 handle_asynch_device_change (); |
5584 | 5576 |
5585 if (!buffers_changed && !clip_changed && !extents_changed && !faces_changed | 5577 if (!buffers_changed && !clip_changed && !extents_changed && |
5586 && !frame_changed && !icon_changed && !menubar_changed | 5578 !faces_changed && !frame_changed && !icon_changed && |
5587 && !modeline_changed && !point_changed && !size_changed | 5579 !menubar_changed && !modeline_changed && !point_changed && |
5588 && !toolbar_changed && !windows_changed && !windows_structure_changed | 5580 !size_changed && !toolbar_changed && !windows_changed && |
5589 && !disable_preemption && preemption_count < max_preempts) | 5581 !windows_structure_changed && !disable_preemption && |
5582 preemption_count < max_preempts) | |
5590 goto done; | 5583 goto done; |
5591 | 5584 |
5592 DEVICE_LOOP_NO_BREAK (devcons, concons) | 5585 DEVICE_LOOP_NO_BREAK (devcons, concons) |
5593 { | 5586 { |
5594 struct device *d = XDEVICE (XCAR (devcons)); | 5587 struct device *d = XDEVICE (XCAR (devcons)); |
5595 int preempted; | 5588 int preempted; |
5596 | 5589 |
5597 if (d->buffers_changed || d->clip_changed || d->extents_changed | 5590 if (d->buffers_changed || d->clip_changed || d->extents_changed || |
5598 || d->faces_changed || d->frame_changed | 5591 d->faces_changed || d->frame_changed || d->icon_changed || |
5599 || d->icon_changed || d->menubar_changed | 5592 d->menubar_changed || d->modeline_changed || d->point_changed || |
5600 || d->modeline_changed || d->point_changed || d->size_changed | 5593 d->size_changed || d->toolbar_changed || d->windows_changed || |
5601 || d->toolbar_changed || d->windows_changed | 5594 d->windows_structure_changed) |
5602 || d->windows_structure_changed) | |
5603 { | 5595 { |
5604 preempted = redisplay_device (d); | 5596 preempted = redisplay_device (d); |
5605 | 5597 |
5606 if (preempted) | 5598 if (preempted) |
5607 { | 5599 { |
5616 } | 5608 } |
5617 } | 5609 } |
5618 preemption_count = 0; | 5610 preemption_count = 0; |
5619 | 5611 |
5620 /* Mark redisplay as accurate */ | 5612 /* Mark redisplay as accurate */ |
5621 buffers_changed = 0; | 5613 buffers_changed = 0; |
5622 clip_changed = 0; | 5614 clip_changed = 0; |
5623 extents_changed = 0; | 5615 extents_changed = 0; |
5624 frame_changed = 0; | 5616 frame_changed = 0; |
5625 icon_changed = 0; | 5617 icon_changed = 0; |
5626 menubar_changed = 0; | 5618 menubar_changed = 0; |
5627 modeline_changed = 0; | 5619 modeline_changed = 0; |
5628 point_changed = 0; | 5620 point_changed = 0; |
5629 toolbar_changed = 0; | 5621 toolbar_changed = 0; |
5630 windows_changed = 0; | 5622 windows_changed = 0; |
5631 windows_structure_changed = 0; | 5623 windows_structure_changed = 0; |
5632 RESET_CHANGED_SET_FLAGS; | 5624 RESET_CHANGED_SET_FLAGS; |
5633 | 5625 |
5634 if (faces_changed) | 5626 if (faces_changed) |
5635 { | 5627 { |
5745 { | 5737 { |
5746 temp /= 10; | 5738 temp /= 10; |
5747 size++; | 5739 size++; |
5748 } | 5740 } |
5749 | 5741 |
5750 buf = (char *) alloca (size * sizeof (char)); | 5742 buf = alloca_array (char, size); |
5751 sprintf (buf, "%d", col); | 5743 sprintf (buf, "%d", col); |
5752 | 5744 |
5753 Dynarr_add_many (mode_spec_bufbyte_string, | 5745 Dynarr_add_many (mode_spec_bufbyte_string, |
5754 (CONST Bufbyte *) buf, strlen (buf)); | 5746 (CONST Bufbyte *) buf, strlen (buf)); |
5755 | 5747 |
5787 #ifdef HAVE_TTY | 5779 #ifdef HAVE_TTY |
5788 { | 5780 { |
5789 struct frame *f = XFRAME (w->frame); | 5781 struct frame *f = XFRAME (w->frame); |
5790 if (FRAME_TTY_P (f) && f->order_count > 1) | 5782 if (FRAME_TTY_P (f) && f->order_count > 1) |
5791 { | 5783 { |
5792 str = alloca (10); | 5784 str = (CONST char *) alloca (10); |
5793 sprintf (str, "-%d", f->order_count); | 5785 sprintf (str, "-%d", f->order_count); |
5794 } | 5786 } |
5795 } | 5787 } |
5796 #endif /* HAVE_TTY */ | 5788 #endif /* HAVE_TTY */ |
5797 break; | 5789 break; |
6010 | 6002 |
6011 Dynarr_free (db->runes); | 6003 Dynarr_free (db->runes); |
6012 } | 6004 } |
6013 | 6005 |
6014 Dynarr_free (dl->display_blocks); | 6006 Dynarr_free (dl->display_blocks); |
6015 dl->display_blocks = 0; | 6007 dl->display_blocks = NULL; |
6016 } | 6008 } |
6017 | 6009 |
6018 if (dl->left_glyphs) | 6010 if (dl->left_glyphs) |
6019 { | 6011 { |
6020 Dynarr_free (dl->left_glyphs); | 6012 Dynarr_free (dl->left_glyphs); |
6021 dl->left_glyphs = 0; | 6013 dl->left_glyphs = NULL; |
6022 } | 6014 } |
6023 | 6015 |
6024 if (dl->right_glyphs) | 6016 if (dl->right_glyphs) |
6025 { | 6017 { |
6026 Dynarr_free (dl->right_glyphs); | 6018 Dynarr_free (dl->right_glyphs); |
6027 dl->right_glyphs = 0; | 6019 dl->right_glyphs = NULL; |
6028 } | 6020 } |
6029 } | 6021 } |
6030 | 6022 |
6031 | 6023 |
6032 /* Given an array of display lines, free them and all data structures | 6024 /* Given an array of display lines, free them and all data structures |
6063 } | 6055 } |
6064 } | 6056 } |
6065 | 6057 |
6066 | 6058 |
6067 static void | 6059 static void |
6068 mark_redisplay_structs (display_line_dynarr *dla, | 6060 mark_glyph_block_dynarr (glyph_block_dynarr *gba, void (*markobj) (Lisp_Object)) |
6069 void (*markobj) (Lisp_Object)) | 6061 { |
6070 { | 6062 if (gba) |
6071 int line; | 6063 { |
6072 | 6064 glyph_block *gb = Dynarr_atp (gba, 0); |
6073 for (line = 0; line < Dynarr_length (dla); line++) | 6065 glyph_block *gb_last = Dynarr_atp (gba, Dynarr_length (gba)); |
6074 { | 6066 |
6075 int block, loop; | 6067 for (; gb < gb_last; gb++) |
6076 struct display_line *dl = Dynarr_atp (dla, line); | 6068 { |
6077 | 6069 if (!NILP (gb->glyph)) ((markobj) (gb->glyph)); |
6078 for (block = 0; block < Dynarr_length (dl->display_blocks); block++) | 6070 if (!NILP (gb->extent)) ((markobj) (gb->extent)); |
6079 { | 6071 } |
6080 int rune; | 6072 } |
6081 struct display_block *db = Dynarr_atp (dl->display_blocks, block); | 6073 } |
6082 | 6074 |
6083 for (rune = 0; rune < Dynarr_length (db->runes); rune++) | 6075 static void |
6084 { | 6076 mark_redisplay_structs (display_line_dynarr *dla, void (*markobj) (Lisp_Object)) |
6085 struct rune *rb = Dynarr_atp (db->runes, rune); | 6077 { |
6086 | 6078 display_line *dl = Dynarr_atp (dla, 0); |
6087 if (rb->type == RUNE_DGLYPH) | 6079 display_line *dl_last = Dynarr_atp (dla, Dynarr_length (dla)); |
6080 | |
6081 for (; dl < dl_last; dl++) | |
6082 { | |
6083 display_block_dynarr *dba = dl->display_blocks; | |
6084 display_block *db = Dynarr_atp (dba, 0); | |
6085 display_block *db_last = Dynarr_atp (dba, Dynarr_length (dba)); | |
6086 | |
6087 for (; db < db_last; db++) | |
6088 { | |
6089 rune_dynarr *ra = db->runes; | |
6090 rune *r = Dynarr_atp (ra, 0); | |
6091 rune *r_last = Dynarr_atp (ra, Dynarr_length (ra)); | |
6092 | |
6093 for (; r < r_last; r++) | |
6094 { | |
6095 if (r->type == RUNE_DGLYPH) | |
6088 { | 6096 { |
6089 if (!NILP (rb->object.dglyph.glyph)) | 6097 if (!NILP (r->object.dglyph.glyph)) |
6090 ((markobj) (rb->object.dglyph.glyph)); | 6098 ((markobj) (r->object.dglyph.glyph)); |
6091 if (!NILP (rb->object.dglyph.extent)) | 6099 if (!NILP (r->object.dglyph.extent)) |
6092 ((markobj) (rb->object.dglyph.extent)); | 6100 ((markobj) (r->object.dglyph.extent)); |
6093 } | 6101 } |
6094 } | 6102 } |
6095 } | 6103 } |
6096 | 6104 |
6097 for (loop = 0; loop < 2; loop++) | 6105 mark_glyph_block_dynarr (dl->left_glyphs, markobj); |
6098 { | 6106 mark_glyph_block_dynarr (dl->right_glyphs, markobj); |
6099 glyph_block_dynarr *gba = (loop | |
6100 ? dl->right_glyphs | |
6101 : dl->left_glyphs); | |
6102 | |
6103 if (gba != NULL) | |
6104 { | |
6105 for (block = 0; block < Dynarr_length (gba); block++) | |
6106 { | |
6107 struct glyph_block *gb = Dynarr_atp (gba, block); | |
6108 | |
6109 if (!NILP (gb->glyph)) | |
6110 ((markobj) (gb->glyph)); | |
6111 if (!NILP (gb->extent)) | |
6112 ((markobj) (gb->extent)); | |
6113 } | |
6114 } | |
6115 } | |
6116 } | 6107 } |
6117 } | 6108 } |
6118 | 6109 |
6119 static void | 6110 static void |
6120 mark_window_mirror (struct window_mirror *mir, void (*markobj)(Lisp_Object)) | 6111 mark_window_mirror (struct window_mirror *mir, void (*markobj)(Lisp_Object)) |
7187 *pix_x += (char_x * defwidth); | 7178 *pix_x += (char_x * defwidth); |
7188 *pix_x += (defwidth >> 1); | 7179 *pix_x += (defwidth >> 1); |
7189 } | 7180 } |
7190 | 7181 |
7191 if (*pix_x > w->pixel_left + w->pixel_width) | 7182 if (*pix_x > w->pixel_left + w->pixel_width) |
7192 *pix_x = w->pixel_left + w->pixel_width; | 7183 *pix_x = w->pixel_left + w->pixel_width; |
7193 if (*pix_y > w->pixel_top + w->pixel_height) | 7184 if (*pix_y > w->pixel_top + w->pixel_height) |
7194 *pix_y = w->pixel_top + w->pixel_height; | 7185 *pix_y = w->pixel_top + w->pixel_height; |
7195 | 7186 |
7196 *pix_x -= w->pixel_left; | 7187 *pix_x -= w->pixel_left; |
7197 *pix_y -= w->pixel_top; | 7188 *pix_y -= w->pixel_top; |
7198 } | 7189 } |
7199 | 7190 |
8083 preemption_count = 0; | 8074 preemption_count = 0; |
8084 max_preempts = INIT_MAX_PREEMPTS; | 8075 max_preempts = INIT_MAX_PREEMPTS; |
8085 | 8076 |
8086 if (!initialized) | 8077 if (!initialized) |
8087 { | 8078 { |
8088 cmotion_display_lines = Dynarr_new (struct display_line); | 8079 cmotion_display_lines = Dynarr_new (display_line); |
8089 mode_spec_bufbyte_string = Dynarr_new (Bufbyte); | 8080 mode_spec_bufbyte_string = Dynarr_new (Bufbyte); |
8090 formatted_string_emchar_dynarr = Dynarr_new (Emchar); | 8081 formatted_string_emchar_dynarr = Dynarr_new (Emchar); |
8091 formatted_string_extent_dynarr = Dynarr_new (struct extent *); | 8082 formatted_string_extent_dynarr = Dynarr_new (EXTENT); |
8092 formatted_string_extent_start_dynarr = Dynarr_new (Bytecount); | 8083 formatted_string_extent_start_dynarr = Dynarr_new (Bytecount); |
8093 formatted_string_extent_end_dynarr = Dynarr_new (Bytecount); | 8084 formatted_string_extent_end_dynarr = Dynarr_new (Bytecount); |
8094 internal_cache = Dynarr_new (struct line_start_cache); | 8085 internal_cache = Dynarr_new (line_start_cache); |
8095 memset (&formatted_string_display_line, 0, sizeof (struct display_line)); | 8086 memset (&formatted_string_display_line, 0, sizeof (struct display_line)); |
8096 } | 8087 } |
8097 | 8088 |
8098 /* window system is nil when in -batch mode */ | 8089 /* window system is nil when in -batch mode */ |
8099 if (!initialized || noninteractive) | 8090 if (!initialized || noninteractive) |
8190 */ , | 8181 */ , |
8191 redisplay_variable_changed); | 8182 redisplay_variable_changed); |
8192 horizontal_clip = 5; | 8183 horizontal_clip = 5; |
8193 | 8184 |
8194 DEFVAR_LISP ("global-mode-string", &Vglobal_mode_string /* | 8185 DEFVAR_LISP ("global-mode-string", &Vglobal_mode_string /* |
8195 String displayed by modeline-format's \"%m\" specification. | 8186 String displayed by modeline-format's "%m" specification. |
8196 */ ); | 8187 */ ); |
8197 Vglobal_mode_string = Qnil; | 8188 Vglobal_mode_string = Qnil; |
8198 | 8189 |
8199 DEFVAR_LISP_MAGIC ("overlay-arrow-position", &Voverlay_arrow_position /* | 8190 DEFVAR_LISP_MAGIC ("overlay-arrow-position", &Voverlay_arrow_position /* |
8200 Marker for where to display an arrow on top of the buffer text. | 8191 Marker for where to display an arrow on top of the buffer text. |