aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann1999-08-21 19:29:02 +0000
committerGerd Moellmann1999-08-21 19:29:02 +0000
commitb96fd3e81f4a8c8b9e68df026a022d9ac23c2bfc (patch)
treefc5ed6ff2ad5f37561dea3aee07c4dcc141269d7
parent3f7267e7f3218bb3e316dc58ff0895bc892cfb07 (diff)
downloademacs-b96fd3e81f4a8c8b9e68df026a022d9ac23c2bfc.tar.gz
emacs-b96fd3e81f4a8c8b9e68df026a022d9ac23c2bfc.zip
(do_pending_window_change): Add parameter `safe'.
(change_frame_size): Ditto. (change_frame_size_1): Ditto. Deley size changes if redisplaying and not called from a safe place. (window_change_signal): Call change_frame_size with new parameter. (set_window_cursor_after_update): Do the cursor_in_echo_area case only for a mini-window showing a message. Don't let cursor end up after the end of a row. (adjust_frame_message_buffer): Removed references to echo_area_glyphs and previous_echo_glyphs. (direct_output_for_insert): Check for mini-window displaying echo area message differently. (update_frame): Likewise. (set_window_cursor_after_update): Likewise. In echo area, don't try to set cursor on rows that aren't enabled.
-rw-r--r--src/dispnew.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 55c56a9361c..487e2f1d8c6 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -126,7 +126,7 @@ struct glyph_matrix *new_glyph_matrix P_ ((struct glyph_pool *));
126static void free_glyph_matrix P_ ((struct glyph_matrix *)); 126static void free_glyph_matrix P_ ((struct glyph_matrix *));
127static void adjust_glyph_matrix P_ ((struct window *, struct glyph_matrix *, 127static void adjust_glyph_matrix P_ ((struct window *, struct glyph_matrix *,
128 int, int, struct dim)); 128 int, int, struct dim));
129static void change_frame_size_1 P_ ((struct frame *, int, int, int, int)); 129static void change_frame_size_1 P_ ((struct frame *, int, int, int, int, int));
130static void swap_glyphs_in_rows P_ ((struct glyph_row *, struct glyph_row *)); 130static void swap_glyphs_in_rows P_ ((struct glyph_row *, struct glyph_row *));
131static void swap_glyph_pointers P_ ((struct glyph_row *, struct glyph_row *)); 131static void swap_glyph_pointers P_ ((struct glyph_row *, struct glyph_row *));
132static int glyph_row_slice_p P_ ((struct glyph_row *, struct glyph_row *)); 132static int glyph_row_slice_p P_ ((struct glyph_row *, struct glyph_row *));
@@ -155,8 +155,10 @@ static void make_current P_ ((struct glyph_matrix *, struct glyph_matrix *,
155 int)); 155 int));
156static void mirror_make_current P_ ((struct window *, int)); 156static void mirror_make_current P_ ((struct window *, int));
157void check_window_matrix_pointers P_ ((struct window *)); 157void check_window_matrix_pointers P_ ((struct window *));
158#if GLYPH_DEBUG
158static void check_matrix_pointers P_ ((struct glyph_matrix *, 159static void check_matrix_pointers P_ ((struct glyph_matrix *,
159 struct glyph_matrix *)); 160 struct glyph_matrix *));
161#endif
160static void mirror_line_dance P_ ((struct window *, int, int, int *, char *)); 162static void mirror_line_dance P_ ((struct window *, int, int, int *, char *));
161static int update_window_tree P_ ((struct window *, int)); 163static int update_window_tree P_ ((struct window *, int));
162static int update_window P_ ((struct window *, int)); 164static int update_window P_ ((struct window *, int));
@@ -2096,10 +2098,6 @@ adjust_frame_glyphs_for_window_redisplay (f)
2096 2098
2097/* Adjust/ allocate message buffer of frame F. 2099/* Adjust/ allocate message buffer of frame F.
2098 2100
2099 The global variables echo_area_glyphs and previous_echo_area_glyphs
2100 may be pointing to the frames message buffer and must be relocated
2101 if the buffer is reallocated.
2102
2103 Note that the message buffer is never freed. Since I could not 2101 Note that the message buffer is never freed. Since I could not
2104 find a free in 19.34, I assume that freeing it would be 2102 find a free in 19.34, I assume that freeing it would be
2105 problematic in some way and don't do it either. 2103 problematic in some way and don't do it either.
@@ -2117,12 +2115,6 @@ adjust_frame_message_buffer (f)
2117 { 2115 {
2118 char *buffer = FRAME_MESSAGE_BUF (f); 2116 char *buffer = FRAME_MESSAGE_BUF (f);
2119 char *new_buffer = (char *) xrealloc (buffer, size); 2117 char *new_buffer = (char *) xrealloc (buffer, size);
2120
2121 if (buffer == echo_area_glyphs)
2122 echo_area_glyphs = new_buffer;
2123 if (buffer == previous_echo_glyphs)
2124 previous_echo_glyphs = new_buffer;
2125
2126 FRAME_MESSAGE_BUF (f) = new_buffer; 2118 FRAME_MESSAGE_BUF (f) = new_buffer;
2127 } 2119 }
2128 else 2120 else
@@ -3028,8 +3020,7 @@ direct_output_for_insert (g)
3028 /* Give up if buffer appears in two places. */ 3020 /* Give up if buffer appears in two places. */
3029 || buffer_shared > 1 3021 || buffer_shared > 1
3030 /* Give up if w is mini-buffer and a message is being displayed there */ 3022 /* Give up if w is mini-buffer and a message is being displayed there */
3031 || (MINI_WINDOW_P (w) 3023 || (MINI_WINDOW_P (w) && !NILP (echo_area_buffer[0]))
3032 && (echo_area_glyphs || STRINGP (echo_area_message)))
3033 /* Give up for hscrolled mini-buffer because display of the prompt 3024 /* Give up for hscrolled mini-buffer because display of the prompt
3034 is handled specially there (see display_line). */ 3025 is handled specially there (see display_line). */
3035 || (MINI_WINDOW_P (w) && XFASTINT (w->hscroll)) 3026 || (MINI_WINDOW_P (w) && XFASTINT (w->hscroll))
@@ -3586,12 +3577,14 @@ update_window (w, force_p)
3586 struct window *w; 3577 struct window *w;
3587 int force_p; 3578 int force_p;
3588{ 3579{
3589 struct frame *f = XFRAME (WINDOW_FRAME (w));
3590 struct glyph_matrix *desired_matrix = w->desired_matrix; 3580 struct glyph_matrix *desired_matrix = w->desired_matrix;
3591 int paused_p; 3581 int paused_p;
3592 int preempt_count = baud_rate / 2400 + 1; 3582 int preempt_count = baud_rate / 2400 + 1;
3593 extern int input_pending; 3583 extern int input_pending;
3584#if GLYPH_DEBUG
3585 struct frame *f = XFRAME (WINDOW_FRAME (w));
3594 extern struct frame *updating_frame; 3586 extern struct frame *updating_frame;
3587#endif
3595 3588
3596 /* Check that W's frame doesn't have glyph matrices. */ 3589 /* Check that W's frame doesn't have glyph matrices. */
3597 xassert (FRAME_WINDOW_P (f)); 3590 xassert (FRAME_WINDOW_P (f));
@@ -4019,13 +4012,12 @@ set_window_cursor_after_update (w)
4019 /* Not intended for frame matrix updates. */ 4012 /* Not intended for frame matrix updates. */
4020 xassert (FRAME_WINDOW_P (f)); 4013 xassert (FRAME_WINDOW_P (f));
4021 4014
4022 if ((cursor_in_echo_area 4015 if (cursor_in_echo_area
4023 /* If we are showing a message instead of the mini-buffer, 4016 && !NILP (echo_area_buffer[0])
4024 show the cursor for the message instead of for the 4017 /* If we are showing a message instead of the mini-buffer,
4025 (now hidden) mini-buffer contents. */ 4018 show the cursor for the message instead. */
4026 || (XWINDOW (minibuf_window) == w 4019 && XWINDOW (minibuf_window) == w
4027 && EQ (minibuf_window, echo_area_window) 4020 && EQ (minibuf_window, echo_area_window)
4028 && (echo_area_glyphs || STRINGP (echo_area_message))))
4029 /* These cases apply only to the frame that contains 4021 /* These cases apply only to the frame that contains
4030 the active mini-buffer window. */ 4022 the active mini-buffer window. */
4031 && FRAME_HAS_MINIBUF_P (f) 4023 && FRAME_HAS_MINIBUF_P (f)
@@ -4044,7 +4036,9 @@ set_window_cursor_after_update (w)
4044 int yb = window_text_bottom_y (w); 4036 int yb = window_text_bottom_y (w);
4045 4037
4046 last_row = NULL; 4038 last_row = NULL;
4047 for (row = MATRIX_ROW (w->current_matrix, 0);; ++row) 4039 for (row = MATRIX_ROW (w->current_matrix, 0);
4040 row->enabled_p;
4041 ++row)
4048 { 4042 {
4049 if (row->used[TEXT_AREA] 4043 if (row->used[TEXT_AREA]
4050 && row->glyphs[TEXT_AREA][0].charpos >= 0) 4044 && row->glyphs[TEXT_AREA][0].charpos >= 0)
@@ -4057,9 +4051,9 @@ set_window_cursor_after_update (w)
4057 if (last_row) 4051 if (last_row)
4058 { 4052 {
4059 struct glyph *start = row->glyphs[TEXT_AREA]; 4053 struct glyph *start = row->glyphs[TEXT_AREA];
4060 struct glyph *last = start + row->used[TEXT_AREA]; 4054 struct glyph *last = start + row->used[TEXT_AREA] - 1;
4061 4055
4062 while (last > start && (last - 1)->charpos < 0) 4056 while (last > start && last->charpos < 0)
4063 --last; 4057 --last;
4064 4058
4065 for (glyph = start; glyph < last; ++glyph) 4059 for (glyph = start; glyph < last; ++glyph)
@@ -4529,7 +4523,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
4529 (now hidden) mini-buffer contents. */ 4523 (now hidden) mini-buffer contents. */
4530 || (EQ (minibuf_window, selected_window) 4524 || (EQ (minibuf_window, selected_window)
4531 && EQ (minibuf_window, echo_area_window) 4525 && EQ (minibuf_window, echo_area_window)
4532 && (echo_area_glyphs || STRINGP (echo_area_message)))) 4526 && !NILP (echo_area_buffer[0])))
4533 /* These cases apply only to the frame that contains 4527 /* These cases apply only to the frame that contains
4534 the active mini-buffer window. */ 4528 the active mini-buffer window. */
4535 && FRAME_HAS_MINIBUF_P (f) 4529 && FRAME_HAS_MINIBUF_P (f)
@@ -4561,7 +4555,6 @@ update_frame_1 (f, force_p, inhibit_id_p)
4561 { 4555 {
4562 /* Frame rows are filled up with spaces that 4556 /* Frame rows are filled up with spaces that
4563 must be ignored here. */ 4557 must be ignored here. */
4564 int i;
4565 struct glyph_row *r = MATRIX_ROW (current_matrix, 4558 struct glyph_row *r = MATRIX_ROW (current_matrix,
4566 row); 4559 row);
4567 struct glyph *start = r->glyphs[TEXT_AREA]; 4560 struct glyph *start = r->glyphs[TEXT_AREA];
@@ -5186,7 +5179,7 @@ window_change_signal (signalnum) /* If we don't have an argument, */
5186 { 5179 {
5187 if (FRAME_TERMCAP_P (XFRAME (frame))) 5180 if (FRAME_TERMCAP_P (XFRAME (frame)))
5188 { 5181 {
5189 change_frame_size (XFRAME (frame), height, width, 0, 1); 5182 change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
5190 break; 5183 break;
5191 } 5184 }
5192 } 5185 }
@@ -5198,12 +5191,18 @@ window_change_signal (signalnum) /* If we don't have an argument, */
5198#endif /* SIGWINCH */ 5191#endif /* SIGWINCH */
5199 5192
5200 5193
5201/* Do any change in frame size that was requested by a signal. */ 5194/* Do any change in frame size that was requested by a signal. SAFE
5195 non-zero means this function is called from a place where it is
5196 safe to change frame sizes while a redisplay is in progress. */
5202 5197
5203void 5198void
5204do_pending_window_change () 5199do_pending_window_change (safe)
5200 int safe;
5205{ 5201{
5206 /* If window_change_signal should have run before, run it now. */ 5202 /* If window_change_signal should have run before, run it now. */
5203 if (redisplaying_p && !safe)
5204 return;
5205
5207 while (delayed_size_change) 5206 while (delayed_size_change)
5208 { 5207 {
5209 Lisp_Object tail, frame; 5208 Lisp_Object tail, frame;
@@ -5218,7 +5217,7 @@ do_pending_window_change ()
5218 int width = FRAME_NEW_WIDTH (f); 5217 int width = FRAME_NEW_WIDTH (f);
5219 5218
5220 if (height != 0 || width != 0) 5219 if (height != 0 || width != 0)
5221 change_frame_size (f, height, width, 0, 0); 5220 change_frame_size (f, height, width, 0, 0, safe);
5222 } 5221 }
5223 } 5222 }
5224} 5223}
@@ -5230,12 +5229,15 @@ do_pending_window_change ()
5230 If DELAY is non-zero, then assume we're being called from a signal 5229 If DELAY is non-zero, then assume we're being called from a signal
5231 handler, and queue the change for later - perhaps the next 5230 handler, and queue the change for later - perhaps the next
5232 redisplay. Since this tries to resize windows, we can't call it 5231 redisplay. Since this tries to resize windows, we can't call it
5233 from a signal handler. */ 5232 from a signal handler.
5233
5234 SAFE non-zero means this function is called from a place where it's
5235 safe to change frame sizes while a redisplay is in progress. */
5234 5236
5235void 5237void
5236change_frame_size (f, newheight, newwidth, pretend, delay) 5238change_frame_size (f, newheight, newwidth, pretend, delay, safe)
5237 register struct frame *f; 5239 register struct frame *f;
5238 int newheight, newwidth, pretend, delay; 5240 int newheight, newwidth, pretend, delay, safe;
5239{ 5241{
5240 Lisp_Object tail, frame; 5242 Lisp_Object tail, frame;
5241 5243
@@ -5246,23 +5248,22 @@ change_frame_size (f, newheight, newwidth, pretend, delay)
5246 FOR_EACH_FRAME (tail, frame) 5248 FOR_EACH_FRAME (tail, frame)
5247 if (! FRAME_WINDOW_P (XFRAME (frame))) 5249 if (! FRAME_WINDOW_P (XFRAME (frame)))
5248 change_frame_size_1 (XFRAME (frame), newheight, newwidth, 5250 change_frame_size_1 (XFRAME (frame), newheight, newwidth,
5249 pretend, delay); 5251 pretend, delay, safe);
5250 } 5252 }
5251 else 5253 else
5252 change_frame_size_1 (f, newheight, newwidth, pretend, delay); 5254 change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe);
5253} 5255}
5254 5256
5255static void 5257static void
5256change_frame_size_1 (f, newheight, newwidth, pretend, delay) 5258change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
5257 register struct frame *f; 5259 register struct frame *f;
5258 int newheight, newwidth, pretend, delay; 5260 int newheight, newwidth, pretend, delay, safe;
5259{ 5261{
5260 int new_frame_window_width; 5262 int new_frame_window_width;
5261 unsigned int total_glyphs;
5262 int count = specpdl_ptr - specpdl; 5263 int count = specpdl_ptr - specpdl;
5263 5264
5264 /* If we can't deal with the change now, queue it for later. */ 5265 /* If we can't deal with the change now, queue it for later. */
5265 if (delay) 5266 if (delay || (redisplaying_p && !safe))
5266 { 5267 {
5267 FRAME_NEW_HEIGHT (f) = newheight; 5268 FRAME_NEW_HEIGHT (f) = newheight;
5268 FRAME_NEW_WIDTH (f) = newwidth; 5269 FRAME_NEW_WIDTH (f) = newwidth;