aboutsummaryrefslogtreecommitdiffstats
path: root/src/xdisp.c
diff options
context:
space:
mode:
authorGerd Möllmann2024-10-05 18:55:18 +0200
committerGerd Möllmann2024-10-05 18:55:18 +0200
commitbeb5b77123619758c1def6b9f227fa7568516775 (patch)
tree809e025df6a48b10f3022558f23840a8def6cbec /src/xdisp.c
parent069ecc9c4c3709246a6ff50d09af418444d427c3 (diff)
downloademacs-tty-child-frames.tar.gz
emacs-tty-child-frames.zip
Preview from my branch on githubtty-child-frames
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c76
1 files changed, 49 insertions, 27 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index c74e81a3933..f19706005ad 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -943,7 +943,7 @@ redisplay_trace (char const *fmt, ...)
943 { 943 {
944 va_list ap; 944 va_list ap;
945 va_start (ap, fmt); 945 va_start (ap, fmt);
946 vprintf (fmt, ap); 946 vfprintf (stderr, fmt, ap);
947 va_end (ap); 947 va_end (ap);
948 } 948 }
949} 949}
@@ -961,7 +961,7 @@ move_trace (char const *fmt, ...)
961 { 961 {
962 va_list ap; 962 va_list ap;
963 va_start (ap, fmt); 963 va_start (ap, fmt);
964 vprintf (fmt, ap); 964 vfprintf (stderr, fmt, ap);
965 va_end (ap); 965 va_end (ap);
966 } 966 }
967} 967}
@@ -3348,9 +3348,7 @@ init_iterator (struct it *it, struct window *w,
3348 of the iterator's frame, when set, suppresses their display - by 3348 of the iterator's frame, when set, suppresses their display - by
3349 default for tooltip frames and when set via the 'no-special-glyphs' 3349 default for tooltip frames and when set via the 'no-special-glyphs'
3350 frame parameter. */ 3350 frame parameter. */
3351#ifdef HAVE_WINDOW_SYSTEM 3351 if (!it->f->no_special_glyphs)
3352 if (!(FRAME_WINDOW_P (it->f) && it->f->no_special_glyphs))
3353#endif
3354 { 3352 {
3355 if (it->line_wrap == TRUNCATE) 3353 if (it->line_wrap == TRUNCATE)
3356 { 3354 {
@@ -13554,7 +13552,11 @@ echo_area_display (bool update_frame_p)
13554 flush_frame (f); 13552 flush_frame (f);
13555 } 13553 }
13556 else 13554 else
13557 update_frame (f, true, true); 13555 {
13556 update_frame (f, true, true);
13557 if (is_tty_frame (f))
13558 combine_updates_for_frame (f, true, true);
13559 }
13558 13560
13559 /* If cursor is in the echo area, make sure that the next 13561 /* If cursor is in the echo area, make sure that the next
13560 redisplay displays the minibuffer, so that the cursor will 13562 redisplay displays the minibuffer, so that the cursor will
@@ -17033,6 +17035,9 @@ redisplay_internal (void)
17033 if (face_change) 17035 if (face_change)
17034 windows_or_buffers_changed = 47; 17036 windows_or_buffers_changed = 47;
17035 17037
17038 /* FIXME/tty: can we do better for tty child frames? It could be
17039 a bit faster when we switch between child frames of the same
17040 root frame. OTOH, it's probably not a frequent use case. */
17036 if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)) 17041 if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf))
17037 && FRAME_TTY (sf)->previous_frame != sf) 17042 && FRAME_TTY (sf)->previous_frame != sf)
17038 { 17043 {
@@ -17055,6 +17060,7 @@ redisplay_internal (void)
17055 { 17060 {
17056 struct frame *f = XFRAME (frame); 17061 struct frame *f = XFRAME (frame);
17057 17062
17063 /* FRAME_REDISPLAY_P true basically means the frame is visible. */
17058 if (FRAME_REDISPLAY_P (f)) 17064 if (FRAME_REDISPLAY_P (f))
17059 { 17065 {
17060 ++number_of_visible_frames; 17066 ++number_of_visible_frames;
@@ -17198,7 +17204,6 @@ redisplay_internal (void)
17198 && !current_buffer->clip_changed 17204 && !current_buffer->clip_changed
17199 && !current_buffer->prevent_redisplay_optimizations_p 17205 && !current_buffer->prevent_redisplay_optimizations_p
17200 && FRAME_REDISPLAY_P (XFRAME (w->frame)) 17206 && FRAME_REDISPLAY_P (XFRAME (w->frame))
17201 && !FRAME_OBSCURED_P (XFRAME (w->frame))
17202 && !XFRAME (w->frame)->cursor_type_changed 17207 && !XFRAME (w->frame)->cursor_type_changed
17203 && !XFRAME (w->frame)->face_change 17208 && !XFRAME (w->frame)->face_change
17204 /* Make sure recorded data applies to current buffer, etc. */ 17209 /* Make sure recorded data applies to current buffer, etc. */
@@ -17447,22 +17452,19 @@ redisplay_internal (void)
17447 17452
17448 propagate_buffer_redisplay (); 17453 propagate_buffer_redisplay ();
17449 17454
17455 Lisp_Object tty_root_frames = Qnil;
17450 FOR_EACH_FRAME (tail, frame) 17456 FOR_EACH_FRAME (tail, frame)
17451 { 17457 {
17452 struct frame *f = XFRAME (frame); 17458 struct frame *f = XFRAME (frame);
17453 17459
17454 /* We don't have to do anything for unselected terminal 17460 if (is_tty_root_frame (f))
17455 frames. */ 17461 tty_root_frames = Fcons (frame, tty_root_frames);
17456 if ((FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
17457 && !EQ (FRAME_TTY (f)->top_frame, frame))
17458 continue;
17459 17462
17460 retry_frame: 17463 retry_frame:
17461 if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf) 17464 if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
17462 { 17465 {
17463 bool gcscrollbars 17466 /* Only GC scrollbars when we redisplay the whole frame. */
17464 /* Only GC scrollbars when we redisplay the whole frame. */ 17467 bool gcscrollbars = f->redisplay || !REDISPLAY_SOME_P ();
17465 = f->redisplay || !REDISPLAY_SOME_P ();
17466 bool f_redisplay_flag = f->redisplay; 17468 bool f_redisplay_flag = f->redisplay;
17467 17469
17468 /* The X error handler may have deleted that frame before 17470 /* The X error handler may have deleted that frame before
@@ -17479,7 +17481,7 @@ redisplay_internal (void)
17479 if (gcscrollbars && FRAME_TERMINAL (f)->condemn_scroll_bars_hook) 17481 if (gcscrollbars && FRAME_TERMINAL (f)->condemn_scroll_bars_hook)
17480 FRAME_TERMINAL (f)->condemn_scroll_bars_hook (f); 17482 FRAME_TERMINAL (f)->condemn_scroll_bars_hook (f);
17481 17483
17482 if (FRAME_REDISPLAY_P (f) && !FRAME_OBSCURED_P (f)) 17484 if (FRAME_REDISPLAY_P (f))
17483 { 17485 {
17484 /* Don't allow freeing images and faces for this 17486 /* Don't allow freeing images and faces for this
17485 frame as long as the frame's update wasn't 17487 frame as long as the frame's update wasn't
@@ -17505,7 +17507,9 @@ redisplay_internal (void)
17505 if (gcscrollbars && FRAME_TERMINAL (f)->judge_scroll_bars_hook) 17507 if (gcscrollbars && FRAME_TERMINAL (f)->judge_scroll_bars_hook)
17506 FRAME_TERMINAL (f)->judge_scroll_bars_hook (f); 17508 FRAME_TERMINAL (f)->judge_scroll_bars_hook (f);
17507 17509
17508 if (FRAME_REDISPLAY_P (f) && !FRAME_OBSCURED_P (f)) 17510 /* FIXME/tty: The FRAME_OBSCURE_P (f->visible == 2, :-()
17511 seems to be something for Windows. I'm ignoring it. */
17512 if (FRAME_REDISPLAY_P (f))
17509 { 17513 {
17510 /* If fonts changed on visible frame, display again. */ 17514 /* If fonts changed on visible frame, display again. */
17511 if (f->fonts_changed) 17515 if (f->fonts_changed)
@@ -17590,6 +17594,9 @@ redisplay_internal (void)
17590 } 17594 }
17591 } 17595 }
17592 17596
17597 if (CONSP (tty_root_frames))
17598 pending |= combine_updates (tty_root_frames, false, false);
17599
17593 eassert (EQ (XFRAME (selected_frame)->selected_window, selected_window)); 17600 eassert (EQ (XFRAME (selected_frame)->selected_window, selected_window));
17594 17601
17595 if (!pending) 17602 if (!pending)
@@ -17611,7 +17618,7 @@ redisplay_internal (void)
17611 } 17618 }
17612 } 17619 }
17613 } 17620 }
17614 else if (FRAME_REDISPLAY_P (sf) && !FRAME_OBSCURED_P (sf)) 17621 else if (FRAME_REDISPLAY_P (sf))
17615 { 17622 {
17616 sf->inhibit_clear_image_cache = true; 17623 sf->inhibit_clear_image_cache = true;
17617 displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents); 17624 displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents);
@@ -17662,7 +17669,7 @@ redisplay_internal (void)
17662 unrequest_sigio (); 17669 unrequest_sigio ();
17663 STOP_POLLING; 17670 STOP_POLLING;
17664 17671
17665 if (FRAME_REDISPLAY_P (sf) && !FRAME_OBSCURED_P (sf)) 17672 if (FRAME_REDISPLAY_P (sf))
17666 { 17673 {
17667 if (hscroll_retries <= MAX_HSCROLL_RETRIES 17674 if (hscroll_retries <= MAX_HSCROLL_RETRIES
17668 && hscroll_windows (selected_window)) 17675 && hscroll_windows (selected_window))
@@ -17673,6 +17680,10 @@ redisplay_internal (void)
17673 17680
17674 XWINDOW (selected_window)->must_be_updated_p = true; 17681 XWINDOW (selected_window)->must_be_updated_p = true;
17675 pending = update_frame (sf, false, false); 17682 pending = update_frame (sf, false, false);
17683
17684 if (is_tty_frame (sf))
17685 pending |= combine_updates_for_frame (sf, false, false);
17686
17676 sf->cursor_type_changed = false; 17687 sf->cursor_type_changed = false;
17677 sf->inhibit_clear_image_cache = false; 17688 sf->inhibit_clear_image_cache = false;
17678 } 17689 }
@@ -17685,10 +17696,13 @@ redisplay_internal (void)
17685 Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); 17696 Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
17686 struct frame *mini_frame = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); 17697 struct frame *mini_frame = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
17687 17698
17688 if (mini_frame != sf && FRAME_WINDOW_P (mini_frame)) 17699 /* FIXME/tty: is removing FRAME_WINDOW_P here right? */
17700 if (mini_frame != sf /*&& FRAME_WINDOW_P (mini_frame)*/)
17689 { 17701 {
17690 XWINDOW (mini_window)->must_be_updated_p = true; 17702 XWINDOW (mini_window)->must_be_updated_p = true;
17691 pending |= update_frame (mini_frame, false, false); 17703 pending |= update_frame (mini_frame, false, false);
17704 if (is_tty_frame (mini_frame))
17705 pending |= combine_updates_for_frame (mini_frame, false, false);
17692 mini_frame->cursor_type_changed = false; 17706 mini_frame->cursor_type_changed = false;
17693 if (!pending && hscroll_retries <= MAX_HSCROLL_RETRIES 17707 if (!pending && hscroll_retries <= MAX_HSCROLL_RETRIES
17694 && hscroll_windows (mini_window)) 17708 && hscroll_windows (mini_window))
@@ -23975,6 +23989,7 @@ extend_face_to_end_of_line (struct it *it)
23975 { 23989 {
23976 it->glyph_row->glyphs[TEXT_AREA][0] = space_glyph; 23990 it->glyph_row->glyphs[TEXT_AREA][0] = space_glyph;
23977 it->glyph_row->glyphs[TEXT_AREA][0].face_id = face->id; 23991 it->glyph_row->glyphs[TEXT_AREA][0].face_id = face->id;
23992 it->glyph_row->glyphs[TEXT_AREA][0].frame = f;
23978 it->glyph_row->used[TEXT_AREA] = 1; 23993 it->glyph_row->used[TEXT_AREA] = 1;
23979 } 23994 }
23980 /* Mode line and the header line don't have margins, and 23995 /* Mode line and the header line don't have margins, and
@@ -23994,6 +24009,7 @@ extend_face_to_end_of_line (struct it *it)
23994 it->glyph_row->glyphs[LEFT_MARGIN_AREA][0] = space_glyph; 24009 it->glyph_row->glyphs[LEFT_MARGIN_AREA][0] = space_glyph;
23995 it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id = 24010 it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id =
23996 default_face->id; 24011 default_face->id;
24012 it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].frame = f;
23997 it->glyph_row->used[LEFT_MARGIN_AREA] = 1; 24013 it->glyph_row->used[LEFT_MARGIN_AREA] = 1;
23998 } 24014 }
23999 if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 24015 if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0
@@ -24002,6 +24018,7 @@ extend_face_to_end_of_line (struct it *it)
24002 it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0] = space_glyph; 24018 it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0] = space_glyph;
24003 it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id = 24019 it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id =
24004 default_face->id; 24020 default_face->id;
24021 it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].frame = f;
24005 it->glyph_row->used[RIGHT_MARGIN_AREA] = 1; 24022 it->glyph_row->used[RIGHT_MARGIN_AREA] = 1;
24006 } 24023 }
24007 24024
@@ -24366,9 +24383,11 @@ highlight_trailing_whitespace (struct it *it)
24366 while (glyph >= start 24383 while (glyph >= start
24367 && BUFFERP (glyph->object) 24384 && BUFFERP (glyph->object)
24368 && (glyph->type == STRETCH_GLYPH 24385 && (glyph->type == STRETCH_GLYPH
24369 || (glyph->type == CHAR_GLYPH 24386 || (glyph->type == CHAR_GLYPH && glyph->u.ch == ' ')))
24370 && glyph->u.ch == ' '))) 24387 {
24371 (glyph--)->face_id = face_id; 24388 glyph->frame = it->f;
24389 (glyph--)->face_id = face_id;
24390 }
24372 } 24391 }
24373 else 24392 else
24374 { 24393 {
@@ -24377,7 +24396,10 @@ highlight_trailing_whitespace (struct it *it)
24377 && (glyph->type == STRETCH_GLYPH 24396 && (glyph->type == STRETCH_GLYPH
24378 || (glyph->type == CHAR_GLYPH 24397 || (glyph->type == CHAR_GLYPH
24379 && glyph->u.ch == ' '))) 24398 && glyph->u.ch == ' ')))
24380 (glyph++)->face_id = face_id; 24399 {
24400 glyph->frame = it->f;
24401 (glyph++)->face_id = face_id;
24402 }
24381 } 24403 }
24382 } 24404 }
24383 } 24405 }
@@ -27230,7 +27252,7 @@ display_menu_bar (struct window *w)
27230 27252
27231/* Deep copy of a glyph row, including the glyphs. */ 27253/* Deep copy of a glyph row, including the glyphs. */
27232static void 27254static void
27233deep_copy_glyph_row (struct glyph_row *to, struct glyph_row *from) 27255deep_copy_glyph_row (struct frame *f, struct glyph_row *to, struct glyph_row *from)
27234{ 27256{
27235 struct glyph *pointers[1 + LAST_AREA]; 27257 struct glyph *pointers[1 + LAST_AREA];
27236 int to_used = to->used[TEXT_AREA]; 27258 int to_used = to->used[TEXT_AREA];
@@ -27251,7 +27273,7 @@ deep_copy_glyph_row (struct glyph_row *to, struct glyph_row *from)
27251 /* If we filled only part of the TO row, fill the rest with 27273 /* If we filled only part of the TO row, fill the rest with
27252 space_glyph (which will display as empty space). */ 27274 space_glyph (which will display as empty space). */
27253 if (to_used > from->used[TEXT_AREA]) 27275 if (to_used > from->used[TEXT_AREA])
27254 fill_up_frame_row_with_spaces (to, to_used); 27276 fill_up_frame_row_with_spaces (f, to, to_used);
27255} 27277}
27256 27278
27257/* Display one menu item on a TTY, by overwriting the glyphs in the 27279/* Display one menu item on a TTY, by overwriting the glyphs in the
@@ -27300,7 +27322,7 @@ display_tty_menu_item (const char *item_text, int width, int face_id,
27300 it.last_visible_x = FRAME_COLS (f) - 1; 27322 it.last_visible_x = FRAME_COLS (f) - 1;
27301 row = it.glyph_row; 27323 row = it.glyph_row;
27302 /* Start with the row contents from the current matrix. */ 27324 /* Start with the row contents from the current matrix. */
27303 deep_copy_glyph_row (row, f->current_matrix->rows + y); 27325 deep_copy_glyph_row (f, row, f->current_matrix->rows + y);
27304 bool saved_width = row->full_width_p; 27326 bool saved_width = row->full_width_p;
27305 row->full_width_p = true; 27327 row->full_width_p = true;
27306 bool saved_reversed = row->reversed_p; 27328 bool saved_reversed = row->reversed_p;