comparison src/redisplay.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 84b14dcb0985
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
857 struct window *w = XWINDOW (data->window); 857 struct window *w = XWINDOW (data->window);
858 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex); 858 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex);
859 Lisp_Object font_instance = 859 Lisp_Object font_instance =
860 ensure_face_cachel_contains_charset (cachel, data->window, 860 ensure_face_cachel_contains_charset (cachel, data->window,
861 charset); 861 charset);
862 struct Lisp_Font_Instance *fi; 862 Lisp_Font_Instance *fi;
863 863
864 if (EQ (font_instance, Vthe_null_font_instance)) 864 if (EQ (font_instance, Vthe_null_font_instance))
865 { 865 {
866 font_instance = FACE_CACHEL_FONT (cachel, Vcharset_ascii); 866 font_instance = FACE_CACHEL_FONT (cachel, Vcharset_ascii);
867 data->font_is_bogus = 1; 867 data->font_is_bogus = 1;
1339 add_disp_table_entry_runes (pos_data *data, Lisp_Object entry) 1339 add_disp_table_entry_runes (pos_data *data, Lisp_Object entry)
1340 { 1340 {
1341 prop_block_dynarr *prop = NULL; 1341 prop_block_dynarr *prop = NULL;
1342 if (VECTORP (entry)) 1342 if (VECTORP (entry))
1343 { 1343 {
1344 struct Lisp_Vector *de = XVECTOR (entry); 1344 Lisp_Vector *de = XVECTOR (entry);
1345 EMACS_INT len = vector_length (de); 1345 EMACS_INT len = vector_length (de);
1346 int elt; 1346 int elt;
1347 1347
1348 for (elt = 0; elt < len; elt++) 1348 for (elt = 0; elt < len; elt++)
1349 { 1349 {
1522 add_glyph_rune (pos_data *data, struct glyph_block *gb, int pos_type, 1522 add_glyph_rune (pos_data *data, struct glyph_block *gb, int pos_type,
1523 int allow_cursor, struct glyph_cachel *cachel) 1523 int allow_cursor, struct glyph_cachel *cachel)
1524 { 1524 {
1525 struct window *w = XWINDOW (data->window); 1525 struct window *w = XWINDOW (data->window);
1526 1526
1527 /* If window faces changed, and glyph instance is text, then
1528 glyph sizes might have changed too */
1529 invalidate_glyph_geometry_maybe (gb->glyph, w);
1530
1527 /* A nil extent indicates a special glyph (ex. truncator). */ 1531 /* A nil extent indicates a special glyph (ex. truncator). */
1528 if (NILP (gb->extent) 1532 if (NILP (gb->extent)
1529 || (pos_type == BEGIN_GLYPHS && 1533 || (pos_type == BEGIN_GLYPHS &&
1530 extent_begin_glyph_layout (XEXTENT (gb->extent)) == GL_TEXT) 1534 extent_begin_glyph_layout (XEXTENT (gb->extent)) == GL_TEXT)
1531 || (pos_type == END_GLYPHS && 1535 || (pos_type == END_GLYPHS &&
3892 *offset -= size; 3896 *offset -= size;
3893 else 3897 else
3894 { 3898 {
3895 CONST Bufbyte *tmp_str = charptr_n_addr (str, *offset); 3899 CONST Bufbyte *tmp_str = charptr_n_addr (str, *offset);
3896 3900
3897 /* ### NOTE: I don't understand why a tmp_max is not 3901 /* #### NOTE: I don't understand why a tmp_max is not
3898 computed and used here as in the plain string case 3902 computed and used here as in the plain string case
3899 above. -- dv */ 3903 above. -- dv */
3900 pos = add_string_to_fstring_db_runes (data, tmp_str, 3904 pos = add_string_to_fstring_db_runes (data, tmp_str,
3901 pos, pos, 3905 pos, pos,
3902 max_pos); 3906 max_pos);
3938 *offset -= size; 3942 *offset -= size;
3939 else 3943 else
3940 { 3944 {
3941 CONST Bufbyte *tmp_str = charptr_n_addr (str, *offset); 3945 CONST Bufbyte *tmp_str = charptr_n_addr (str, *offset);
3942 3946
3943 /* ### NOTE: I don't understand why a tmp_max is not 3947 /* #### NOTE: I don't understand why a tmp_max is not
3944 computed and used here as in the plain string case 3948 computed and used here as in the plain string case
3945 above. -- dv */ 3949 above. -- dv */
3946 pos = add_string_to_fstring_db_runes (data, tmp_str, pos, 3950 pos = add_string_to_fstring_db_runes (data, tmp_str, pos,
3947 min_pos, max_pos); 3951 min_pos, max_pos);
3948 *offset = 0; 3952 *offset = 0;
4133 else 4137 else
4134 { 4138 {
4135 CONST Bufbyte *tmp_str = 4139 CONST Bufbyte *tmp_str =
4136 charptr_n_addr ((CONST Bufbyte *) str, *offset); 4140 charptr_n_addr ((CONST Bufbyte *) str, *offset);
4137 4141
4138 /* ### NOTE: I don't understand why a tmp_max is not computed and 4142 /* #### NOTE: I don't understand why a tmp_max is not computed and
4139 used here as in the plain string case above. -- dv */ 4143 used here as in the plain string case above. -- dv */
4140 pos = add_string_to_fstring_db_runes (data, tmp_str, pos, 4144 pos = add_string_to_fstring_db_runes (data, tmp_str, pos,
4141 min_pos, max_pos); 4145 min_pos, max_pos);
4142 *offset = 0; 4146 *offset = 0;
4143 } 4147 }
4279 etc), its just the buffer text that we do not use. However, it 4283 etc), its just the buffer text that we do not use. However, it
4280 seems to be possible for buffer to be nil sometimes so protect 4284 seems to be possible for buffer to be nil sometimes so protect
4281 against this case. */ 4285 against this case. */
4282 struct buffer *b = BUFFERP (w->buffer) ? XBUFFER (w->buffer) : 0; 4286 struct buffer *b = BUFFERP (w->buffer) ? XBUFFER (w->buffer) : 0;
4283 struct device *d = XDEVICE (f->device); 4287 struct device *d = XDEVICE (f->device);
4284 struct Lisp_String* s = XSTRING (disp_string); 4288 Lisp_String* s = XSTRING (disp_string);
4285 4289
4286 /* we're working with these a lot so precalculate them */ 4290 /* we're working with these a lot so precalculate them */
4287 Bytecount slen = XSTRING_LENGTH (disp_string); 4291 Bytecount slen = XSTRING_LENGTH (disp_string);
4288 Bytecount bi_string_zv = slen; 4292 Bytecount bi_string_zv = slen;
4289 Bytind bi_start_pos = charcount_to_bytecount (string_data (s), start_pos); 4293 Bytind bi_start_pos = charcount_to_bytecount (string_data (s), start_pos);
5929 5933
5930 /* Ditto the glyph cache elements, although we do *not* invalidate 5934 /* Ditto the glyph cache elements, although we do *not* invalidate
5931 the cache purely because glyphs have changed - this is now 5935 the cache purely because glyphs have changed - this is now
5932 handled by the dirty flag.*/ 5936 handled by the dirty flag.*/
5933 if ((!echo_active && b != window_display_buffer (w)) 5937 if ((!echo_active && b != window_display_buffer (w))
5934 || !Dynarr_length (w->glyph_cachels)) 5938 || !Dynarr_length (w->glyph_cachels) || f->faces_changed)
5935 reset_glyph_cachels (w); 5939 reset_glyph_cachels (w);
5936 else 5940 else
5937 mark_glyph_cachels_as_not_updated (w); 5941 mark_glyph_cachels_as_not_updated (w);
5938 5942
5939 /* If the marker's buffer is not the window's buffer, then we need 5943 /* If the marker's buffer is not the window's buffer, then we need
6420 6424
6421 map_windows (f, call_redisplay_end_triggers, 0); 6425 map_windows (f, call_redisplay_end_triggers, 0);
6422 return 0; 6426 return 0;
6423 } 6427 }
6424 6428
6425 /* Ensure that all frames on the given device are correctly displayed. */ 6429 /* Ensure that all frames on the given device are correctly displayed.
6430 If AUTOMATIC is non-zero, and the device implementation indicates
6431 no automatic redisplay, as printers do, then the device is not
6432 redisplayed. AUTOMATIC is set to zero when called from lisp
6433 functions (redraw-device) and (redisplay-device), and to non-zero
6434 when called from "lazy" redisplay();
6435 */
6426 6436
6427 static int 6437 static int
6428 redisplay_device (struct device *d) 6438 redisplay_device (struct device *d, int automatic)
6429 { 6439 {
6430 Lisp_Object frame, frmcons; 6440 Lisp_Object frame, frmcons;
6431 int preempted = 0; 6441 int preempted = 0;
6432 int size_change_failed = 0; 6442 int size_change_failed = 0;
6433 struct frame *f; 6443 struct frame *f;
6444
6445 if (automatic
6446 && (MAYBE_INT_DEVMETH (d, device_implementation_flags, ())
6447 & XDEVIMPF_NO_AUTO_REDISPLAY))
6448 return 0;
6434 6449
6435 if (DEVICE_STREAM_P (d)) /* nothing to do */ 6450 if (DEVICE_STREAM_P (d)) /* nothing to do */
6436 return 0; 6451 return 0;
6437 6452
6438 /* It is possible that redisplay has been called before the 6453 /* It is possible that redisplay has been called before the
6544 struct device *d = XDEVICE (XCAR (devcons)); 6559 struct device *d = XDEVICE (XCAR (devcons));
6545 int preempted; 6560 int preempted;
6546 6561
6547 if (CLASS_REDISPLAY_FLAGS_CHANGEDP (d)) 6562 if (CLASS_REDISPLAY_FLAGS_CHANGEDP (d))
6548 { 6563 {
6549 preempted = redisplay_device (d); 6564 preempted = redisplay_device (d, 1);
6550 6565
6551 if (preempted) 6566 if (preempted)
6552 { 6567 {
6553 preemption_count++; 6568 preemption_count++;
6554 RESET_CHANGED_SET_FLAGS; 6569 RESET_CHANGED_SET_FLAGS;
8916 8931
8917 DEVICE_FRAME_LOOP (frmcons, d) 8932 DEVICE_FRAME_LOOP (frmcons, d)
8918 { 8933 {
8919 XFRAME (XCAR (frmcons))->clear = 1; 8934 XFRAME (XCAR (frmcons))->clear = 1;
8920 } 8935 }
8921 redisplay_device (d); 8936 redisplay_device (d, 0);
8922 8937
8923 return unbind_to (count, Qnil); 8938 return unbind_to (count, Qnil);
8924 } 8939 }
8925 8940
8926 DEFUN ("redisplay-device", Fredisplay_device, 0, 2, 0, /* 8941 DEFUN ("redisplay-device", Fredisplay_device, 0, 2, 0, /*
8943 record_unwind_protect (restore_disable_preemption_value, 8958 record_unwind_protect (restore_disable_preemption_value,
8944 make_int (disable_preemption)); 8959 make_int (disable_preemption));
8945 disable_preemption++; 8960 disable_preemption++;
8946 } 8961 }
8947 8962
8948 redisplay_device (d); 8963 redisplay_device (d, 0);
8949 8964
8950 return unbind_to (count, Qnil); 8965 return unbind_to (count, Qnil);
8951 } 8966 }
8952 8967
8953 /* Big lie. Big lie. This will force all modelines to be updated 8968 /* Big lie. Big lie. This will force all modelines to be updated
9123 9138
9124 #ifndef PDUMP 9139 #ifndef PDUMP
9125 if (!initialized) 9140 if (!initialized)
9126 #endif 9141 #endif
9127 { 9142 {
9128 cmotion_display_lines = Dynarr_new (display_line); 9143 if (!cmotion_display_lines)
9129 mode_spec_bufbyte_string = Dynarr_new (Bufbyte); 9144 cmotion_display_lines = Dynarr_new (display_line);
9130 formatted_string_extent_dynarr = Dynarr_new (EXTENT); 9145 if (!mode_spec_bufbyte_string)
9131 formatted_string_extent_start_dynarr = Dynarr_new (Bytecount); 9146 mode_spec_bufbyte_string = Dynarr_new (Bufbyte);
9132 formatted_string_extent_end_dynarr = Dynarr_new (Bytecount); 9147 if (!formatted_string_extent_dynarr)
9133 internal_cache = Dynarr_new (line_start_cache); 9148 formatted_string_extent_dynarr = Dynarr_new (EXTENT);
9149 if (!formatted_string_extent_start_dynarr)
9150 formatted_string_extent_start_dynarr = Dynarr_new (Bytecount);
9151 if (!formatted_string_extent_end_dynarr)
9152 formatted_string_extent_end_dynarr = Dynarr_new (Bytecount);
9153 if (!internal_cache)
9154 internal_cache = Dynarr_new (line_start_cache);
9134 } 9155 }
9135 9156
9136 /* window system is nil when in -batch mode */ 9157 /* window system is nil when in -batch mode */
9137 if (!initialized || noninteractive) 9158 if (!initialized || noninteractive)
9138 return; 9159 return;