aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2024-10-22 05:42:05 -0400
committerEli Zaretskii2024-10-22 05:42:05 -0400
commit4ef5ade5da60075418e0f6db1b91ec08a38bb884 (patch)
treefe4734605bd1fb81859cd1347278d58a6424e994 /src
parent9accfc24bcd82087d936cf7ee37470f86cac8ea7 (diff)
downloademacs-4ef5ade5da60075418e0f6db1b91ec08a38bb884.tar.gz
emacs-4ef5ade5da60075418e0f6db1b91ec08a38bb884.zip
Fix commenting conventions.
Diffstat (limited to 'src')
-rw-r--r--src/dispextern.h6
-rw-r--r--src/dispnew.c133
-rw-r--r--src/frame.c85
-rw-r--r--src/frame.h2
-rw-r--r--src/term.c4
-rw-r--r--src/xdisp.c6
6 files changed, 119 insertions, 117 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 468aee8d1ba..c368e665c61 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -482,9 +482,9 @@ struct glyph
482 continuation glyphs, or the overlay-arrow glyphs on TTYs. */ 482 continuation glyphs, or the overlay-arrow glyphs on TTYs. */
483 Lisp_Object object; 483 Lisp_Object object;
484 484
485 /* Frame on which the glyph was produced. The face_id of this glyph 485 /* Frame on which the glyph was produced. The face_id of this glyph
486 refers to the face_cache of this frame. This is used on tty frames 486 refers to the face_cache of this frame. This is used on tty
487 only. */ 487 frames only. */
488 struct frame *frame; 488 struct frame *frame;
489 489
490 /* Width in pixels. */ 490 /* Width in pixels. */
diff --git a/src/dispnew.c b/src/dispnew.c
index 26181c36399..200ffaaca21 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1177,8 +1177,8 @@ line_hash_code (struct frame *f, struct glyph_row *row)
1177 int c = glyph->u.ch; 1177 int c = glyph->u.ch;
1178 int face_id = glyph->face_id; 1178 int face_id = glyph->face_id;
1179 /* Struct frame can move with igc, and so on. But we need 1179 /* Struct frame can move with igc, and so on. But we need
1180 something that takes different frames into account. Use the 1180 something that takes different frames into account. Use the
1181 face_cache pointer for that which is malloc'd. */ 1181 face_cache pointer for that which is malloc'd. */
1182 if (glyph->frame && glyph->frame != f) 1182 if (glyph->frame && glyph->frame != f)
1183 face_id += (ptrdiff_t) glyph->frame->face_cache; 1183 face_id += (ptrdiff_t) glyph->frame->face_cache;
1184 if (FRAME_MUST_WRITE_SPACES (f)) 1184 if (FRAME_MUST_WRITE_SPACES (f))
@@ -3195,8 +3195,8 @@ redraw_frame (struct frame *f)
3195 future. */ 3195 future. */
3196 SET_FRAME_GARBAGED (f); 3196 SET_FRAME_GARBAGED (f);
3197 3197
3198 /* Clear_frame is actually a "clear_terminal", i.e. 3198 /* clear_frame is actually a "clear_terminal", i.e.
3199 is clears the entire screen. */ 3199 it clears the entire screen. */
3200 if (!FRAME_PARENT_FRAME (f)) 3200 if (!FRAME_PARENT_FRAME (f))
3201 clear_frame (f); 3201 clear_frame (f);
3202 clear_current_matrices (f); 3202 clear_current_matrices (f);
@@ -3238,37 +3238,37 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "",
3238 TTY Child Frames 3238 TTY Child Frames
3239 **********************************************************************/ 3239 **********************************************************************/
3240 3240
3241/* The new thing that child frames on ttys provide is that frames on a 3241/* Child frames on ttys break the assumption that frames on a tty
3242 tty no longer always occupy the whole terminal. They can overlap 3242 always occupy the whole terminal. They can overlap instead.
3243 instead.
3244 3243
3245 Let a "root" frame be a frame that has no parent frame. Such root 3244 Let a "root" frame be a frame that has no parent frame. Such root
3246 frames we require to be the size of the terminal screen. The current 3245 frames are required to be the size of the terminal screen. The
3247 glyph matrix of a root frame of a termimnal represents what is on the 3246 current glyph matrix of a root frame of a termimnal represents what
3248 screen. The desired matrix of a root frame represents what should be 3247 is on the screen. The desired matrix of a root frame represents
3249 one the screen. 3248 what should be one the screen.
3250 3249
3251 Building the desired matrix of root frame proceeds by 3250 Building the desired matrix of root frame proceeds by
3252 3251
3253 - building the desired matrix of the root frame itself which is 3252 - building the desired matrix of the root frame itself which is
3254 the bottommost frame in z-order, 3253 the bottommost frame in z-order;
3255 - building desired matrices of child frames in z-order, topmost last, 3254 - building desired matrices of child frames in z-order, topmost last;
3256 - copying the desired glyphs from child frames to the desired glyphs 3255 - copying the desired glyphs from child frames to the desired glyphs
3257 of the root frame 3256 of the root frame
3258 3257
3259 Updating the screen is then done using root frame matrices as it was 3258 Updating the screen is then done using root frame matrices as it
3260 before child frames were introduced. Child frame current matrices are 3259 was before child frames were introduced. Child frame's current
3261 updated by copying glyph contents of the current matrix of the root 3260 matrices are updated by copying glyph contents of the current
3262 frames to the current matrices of child frames. This imnplicitly 3261 matrix of the root frames to the current matrices of child
3263 also updates the glyph contents of their windows' current matrices. */ 3262 frames. This implicitly also updates the glyph contents of their
3263 windows' current matrices. */
3264 3264
3265struct rect 3265struct rect
3266{ 3266{
3267 int x, y, w, h; 3267 int x, y, w, h;
3268}; 3268};
3269 3269
3270/* Compute the intersection of R1 and R2 in R. Value is true if R1 and 3270/* Compute the intersection of R1 and R2 in R. Value is true if R1 and
3271 R2 intersect, false otherwise. */ 3271 R2 intersect, false otherwise. */
3272 3272
3273static bool 3273static bool
3274rect_intersect (struct rect *r, struct rect r1, struct rect r2) 3274rect_intersect (struct rect *r, struct rect r1, struct rect r2)
@@ -3285,7 +3285,7 @@ rect_intersect (struct rect *r, struct rect r1, struct rect r2)
3285 return true; 3285 return true;
3286} 3286}
3287 3287
3288/* Return the absolute position of frame F in *X and *Y. */ 3288/* Return the absolute position of frame F in *X and *Y. */
3289 3289
3290static void 3290static void
3291frame_pos_abs (struct frame *f, int *x, int *y) 3291frame_pos_abs (struct frame *f, int *x, int *y)
@@ -3298,7 +3298,8 @@ frame_pos_abs (struct frame *f, int *x, int *y)
3298 } 3298 }
3299} 3299}
3300 3300
3301/* Return the rectangle frame F occupies. X and Y are in absolute coordinates. */ 3301/* Return the rectangle frame F occupies. X and Y are in absolute
3302 coordinates. */
3302 3303
3303static struct rect 3304static struct rect
3304frame_rect_abs (struct frame *f) 3305frame_rect_abs (struct frame *f)
@@ -3308,9 +3309,9 @@ frame_rect_abs (struct frame *f)
3308 return (struct rect) { x, y, f->total_cols, f->total_lines }; 3309 return (struct rect) { x, y, f->total_cols, f->total_lines };
3309} 3310}
3310 3311
3311/* Return the root frame of frame F. Follow the parent_frame chain until 3312/* Return the root frame of frame F. Follow the parent_frame chain
3312 we reach a frame that has no parent. That is the root frame. Note 3313 until we reach a frame that has no parent. That is the root frame.
3313 that the root of a root frame is itself. */ 3314 Note that the root of a root frame is itself. */
3314 3315
3315struct frame * 3316struct frame *
3316root_frame (struct frame *f) 3317root_frame (struct frame *f)
@@ -3441,7 +3442,7 @@ tty_raise_lower_frame (struct frame *f, bool raise)
3441 f->z_order = raise ? i : 0; 3442 f->z_order = raise ? i : 0;
3442} 3443}
3443 3444
3444/* Return true if frame F is a tty frame. */ 3445/* Return true if frame F is a tty frame. */
3445 3446
3446bool 3447bool
3447is_tty_frame (struct frame *f) 3448is_tty_frame (struct frame *f)
@@ -3449,7 +3450,7 @@ is_tty_frame (struct frame *f)
3449 return FRAME_TERMCAP_P (f); 3450 return FRAME_TERMCAP_P (f);
3450} 3451}
3451 3452
3452/* Return true if frame F is a tty child frame. */ 3453/* Return true if frame F is a tty child frame. */
3453 3454
3454bool 3455bool
3455is_tty_child_frame (struct frame *f) 3456is_tty_child_frame (struct frame *f)
@@ -3457,7 +3458,7 @@ is_tty_child_frame (struct frame *f)
3457 return FRAME_PARENT_FRAME (f) && is_tty_frame (f); 3458 return FRAME_PARENT_FRAME (f) && is_tty_frame (f);
3458} 3459}
3459 3460
3460/* Return true if frame F is a tty root frame. */ 3461/* Return true if frame F is a tty root frame. */
3461 3462
3462bool 3463bool
3463is_tty_root_frame (struct frame *f) 3464is_tty_root_frame (struct frame *f)
@@ -3466,7 +3467,7 @@ is_tty_root_frame (struct frame *f)
3466} 3467}
3467 3468
3468/* Return the index of the first enabled row in MATRIX, or -1 if there 3469/* Return the index of the first enabled row in MATRIX, or -1 if there
3469 is none. */ 3470 is none. */
3470 3471
3471static int 3472static int
3472first_enabled_row (struct glyph_matrix *matrix) 3473first_enabled_row (struct glyph_matrix *matrix)
@@ -3478,7 +3479,7 @@ first_enabled_row (struct glyph_matrix *matrix)
3478} 3479}
3479 3480
3480/* On tty frame F, make desired matrix current, without writing 3481/* On tty frame F, make desired matrix current, without writing
3481 to the terminal. */ 3482 to the terminal. */
3482 3483
3483static void 3484static void
3484make_matrix_current (struct frame *f) 3485make_matrix_current (struct frame *f)
@@ -3496,8 +3497,8 @@ make_matrix_current (struct frame *f)
3496static struct glyph_row * 3497static struct glyph_row *
3497prepare_desired_root_row (struct frame *root, int y) 3498prepare_desired_root_row (struct frame *root, int y)
3498{ 3499{
3499 /* Start with the root's desired matrix row. If that hasn't 3500 /* Start with the root's desired matrix row. If that hasn't been
3500 been redisplayed, copy from the root's current matrix. */ 3501 redisplayed, copy from the root's current matrix. */
3501 struct glyph_row *root_row = MATRIX_ROW (root->desired_matrix, y); 3502 struct glyph_row *root_row = MATRIX_ROW (root->desired_matrix, y);
3502 if (!root_row->enabled_p) 3503 if (!root_row->enabled_p)
3503 { 3504 {
@@ -3509,9 +3510,9 @@ prepare_desired_root_row (struct frame *root, int y)
3509 return root_row; 3510 return root_row;
3510} 3511}
3511 3512
3512/* Produce glyphs for box character BOX in ROW. X ist the position in ROW 3513/* Produce glyphs for box character BOX in ROW. X is the position in
3513 where to start producing glyphs. N is the number of glyphs to produce. 3514 ROW where to start producing glyphs. N is the number of glyphs to
3514 CHILD is the frame to use for the face of the glyphs. */ 3515 produce. CHILD is the frame to use for the face of the glyphs. */
3515 3516
3516static void 3517static void
3517produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n, 3518produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n,
@@ -3534,7 +3535,7 @@ produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n,
3534 break; 3535 break;
3535 } 3536 }
3536 3537
3537 // FIXME/tty some face for the border. 3538 /* FIXME/tty: some face for the border. */
3538 int face_id = BORDER_FACE_ID; 3539 int face_id = BORDER_FACE_ID;
3539 GLYPH g; 3540 GLYPH g;
3540 SET_GLYPH (g, dflt, face_id); 3541 SET_GLYPH (g, dflt, face_id);
@@ -3546,7 +3547,7 @@ produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n,
3546 if (GLYPH_CODE_P (gc)) 3547 if (GLYPH_CODE_P (gc))
3547 { 3548 {
3548 SET_GLYPH_FROM_GLYPH_CODE (g, gc); 3549 SET_GLYPH_FROM_GLYPH_CODE (g, gc);
3549 /* Sorry, but I really don't care if the glyph has a face :-). */ 3550 /* Sorry, but I really don't care if the glyph has a face :-). */
3550 } 3551 }
3551 } 3552 }
3552 3553
@@ -3567,7 +3568,7 @@ produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n,
3567 3568
3568/* Produce box glyphs LEFT and RIGHT in ROOT_ROW. X and W are the start 3569/* Produce box glyphs LEFT and RIGHT in ROOT_ROW. X and W are the start
3569 and width of a range in ROOT_ROW before and after which to put the 3570 and width of a range in ROOT_ROW before and after which to put the
3570 box glyphs, if they fit. ROOT and CHILD are root and child frame we 3571 box glyphs, if they fit. ROOT and CHILD are root and child frame we
3571 are working on. ROOT is the root frame whose matrix dimensions 3572 are working on. ROOT is the root frame whose matrix dimensions
3572 determines if the box glyphs fit. CHILD is the frame whose faces to 3573 determines if the box glyphs fit. CHILD is the frame whose faces to
3573 use for the box glyphs. */ 3574 use for the box glyphs. */
@@ -3595,7 +3596,7 @@ produce_box_line (struct frame *root, struct frame *child, int x, int y, int w,
3595 root_row->hash = row_hash (root_row); 3596 root_row->hash = row_hash (root_row);
3596} 3597}
3597 3598
3598/* Copy to ROOT's desired matrix what we need from CHILD. */ 3599/* Copy to ROOT's desired matrix what we need from CHILD. */
3599 3600
3600static void 3601static void
3601copy_child_glyphs (struct frame *root, struct frame *child) 3602copy_child_glyphs (struct frame *root, struct frame *child)
@@ -3603,20 +3604,20 @@ copy_child_glyphs (struct frame *root, struct frame *child)
3603 eassert (!FRAME_PARENT_FRAME (root)); 3604 eassert (!FRAME_PARENT_FRAME (root));
3604 eassert (is_frame_ancestor (root, child)); 3605 eassert (is_frame_ancestor (root, child));
3605 3606
3606 /* Determine the intersection of the child frame rectangle with 3607 /* Determine the intersection of the child frame rectangle with the
3607 the root frame. This is basically clipping the child frame to 3608 root frame. This is basically clipping the child frame to the
3608 the root frame rectangle. */ 3609 root frame rectangle. */
3609 struct rect r; 3610 struct rect r;
3610 if (!rect_intersect (&r, frame_rect_abs (root), frame_rect_abs (child))) 3611 if (!rect_intersect (&r, frame_rect_abs (root), frame_rect_abs (child)))
3611 return; 3612 return;
3612 3613
3613 /* Build CHILD's current matrix which we need to copy from it. */ 3614 /* Build CHILD's current matrix which we need to copy from it. */
3614 make_matrix_current (child); 3615 make_matrix_current (child);
3615 3616
3616 /* Draw borders around the child frame. */ 3617 /* Draw borders around the child frame. */
3617 if (!FRAME_UNDECORATED (child)) 3618 if (!FRAME_UNDECORATED (child))
3618 { 3619 {
3619 /* Horizontal line above. */ 3620 /* Horizontal line above. */
3620 if (r.y > 0) 3621 if (r.y > 0)
3621 produce_box_line (root, child, r.x, r.y - 1, r.w, true); 3622 produce_box_line (root, child, r.x, r.y - 1, r.w, true);
3622 3623
@@ -3627,28 +3628,28 @@ copy_child_glyphs (struct frame *root, struct frame *child)
3627 root, child); 3628 root, child);
3628 } 3629 }
3629 3630
3630 /* Horizontal line below */ 3631 /* Horizontal line below. */
3631 if (r.y + r.h < root->desired_matrix->matrix_h) 3632 if (r.y + r.h < root->desired_matrix->matrix_h)
3632 produce_box_line (root, child, r.x, r.y + r.h, r.w, false); 3633 produce_box_line (root, child, r.x, r.y + r.h, r.w, false);
3633 } 3634 }
3634 3635
3635 /* First visible row/col, relative to the child frame. */ 3636 /* First visible row/col, relative to the child frame. */
3636 int child_x = child->left_pos < 0 ? - child->left_pos : 0; 3637 int child_x = child->left_pos < 0 ? - child->left_pos : 0;
3637 int child_y = child->top_pos < 0 ? - child->top_pos : 0; 3638 int child_y = child->top_pos < 0 ? - child->top_pos : 0;
3638 3639
3639 /* For all rows in the intersection, copy glyphs from the child's 3640 /* For all rows in the intersection, copy glyphs from the child's
3640 current matrix to the root's desired matrix, enabling those 3641 current matrix to the root's desired matrix, enabling those rows
3641 rows if they aren't already. */ 3642 if they aren't already. */
3642 for (int y = r.y; y < r.y + r.h; ++y, ++child_y) 3643 for (int y = r.y; y < r.y + r.h; ++y, ++child_y)
3643 { 3644 {
3644 struct glyph_row *root_row = prepare_desired_root_row (root, y); 3645 struct glyph_row *root_row = prepare_desired_root_row (root, y);
3645 3646
3646 /* Copy what's visible from the child's current row. */ 3647 /* Copy what's visible from the child's current row. */
3647 struct glyph_row *child_row = MATRIX_ROW (child->current_matrix, child_y); 3648 struct glyph_row *child_row = MATRIX_ROW (child->current_matrix, child_y);
3648 memcpy (root_row->glyphs[0] + r.x, child_row->glyphs[0] + child_x, 3649 memcpy (root_row->glyphs[0] + r.x, child_row->glyphs[0] + child_x,
3649 r.w * sizeof (struct glyph)); 3650 r.w * sizeof (struct glyph));
3650 3651
3651 /* Compute a new hash since we changed glyphs. */ 3652 /* Compute a new hash since we changed glyphs. */
3652 root_row->hash = row_hash (root_row); 3653 root_row->hash = row_hash (root_row);
3653 } 3654 }
3654} 3655}
@@ -3689,7 +3690,7 @@ update_bar_window (Lisp_Object window, Lisp_Object *current,
3689} 3690}
3690#endif 3691#endif
3691 3692
3692/* Update the tab-bar window of frame F, if present. */ 3693/* Update the tab-bar window of frame F, if present. */
3693 3694
3694static void 3695static void
3695update_tab_bar (struct frame *f) 3696update_tab_bar (struct frame *f)
@@ -3757,7 +3758,7 @@ abs_cursor_pos (struct frame *f, int *x, int *y)
3757 *y += w->cursor.y; 3758 *y += w->cursor.y;
3758} 3759}
3759 3760
3760/* Is the terminal cursor of frame F obscured by a child frame? */ 3761/* Is the terminal cursor of frame F obscured by a child frame? */
3761 3762
3762static bool 3763static bool
3763is_cursor_obscured (void) 3764is_cursor_obscured (void)
@@ -3771,17 +3772,17 @@ is_cursor_obscured (void)
3771 return cursor_glyph->frame != SELECTED_FRAME (); 3772 return cursor_glyph->frame != SELECTED_FRAME ();
3772} 3773}
3773 3774
3774/* Decide where to show the cursor, and if to hide it or not. 3775/* Decide where to show the cursor, and whether to hide it.
3775 3776
3776 This works very well for Vertico-Posframe, Transient-Posframe and 3777 This works very well for Vertico-Posframe, Transient-Posframe and
3777 Corfu, but it's debatable if it's the right thing for a general use 3778 Corfu, but it's debatable if it's the right thing for a general use
3778 of child frames of all sorts, nested and so on. But it is also debatable 3779 of child frames of all sorts, nested and so on. But it is also
3779 if that's a realistic use case from my POV. */ 3780 debatable if that's a realistic use case from my POV. */
3780 3781
3781static void 3782static void
3782terminal_cursor_magic (struct frame *root, struct frame *topmost_child) 3783terminal_cursor_magic (struct frame *root, struct frame *topmost_child)
3783{ 3784{
3784 /* By default, prevent the cursor "shining through" child frames. */ 3785 /* By default, prevent the cursor "shining through" child frames. */
3785 if (is_cursor_obscured ()) 3786 if (is_cursor_obscured ())
3786 tty_hide_cursor (FRAME_TTY (root)); 3787 tty_hide_cursor (FRAME_TTY (root));
3787 3788
@@ -3812,8 +3813,8 @@ combine_updates_for_frame (struct frame *f, bool force_p, bool inhibit_scrolling
3812 struct frame *root = root_frame (f); 3813 struct frame *root = root_frame (f);
3813 eassert (FRAME_VISIBLE_P (root)); 3814 eassert (FRAME_VISIBLE_P (root));
3814 3815
3815 /* Process child frames in reverse z-order, topmost last. For each 3816 /* Process child frames in reverse z-order, topmost last. For each
3816 child, copy what we need to the root's desired matrix. */ 3817 child, copy what we need to the root's desired matrix. */
3817 Lisp_Object z_order = frames_in_reverse_z_order (root, true); 3818 Lisp_Object z_order = frames_in_reverse_z_order (root, true);
3818 struct frame *topmost_child = NULL; 3819 struct frame *topmost_child = NULL;
3819 for (Lisp_Object tail = XCDR (z_order); CONSP (tail); tail = XCDR (tail)) 3820 for (Lisp_Object tail = XCDR (z_order); CONSP (tail); tail = XCDR (tail))
@@ -3830,7 +3831,7 @@ combine_updates_for_frame (struct frame *f, bool force_p, bool inhibit_scrolling
3830 3831
3831 /* If a child is displayed, and the cursor is displayed in another 3832 /* If a child is displayed, and the cursor is displayed in another
3832 frame, the child might lay above the cursor, so that it appers to 3833 frame, the child might lay above the cursor, so that it appers to
3833 "shine through" the child. Avoid that because it's confusing. */ 3834 "shine through" the child. Avoid that because it's confusing. */
3834 if (topmost_child) 3835 if (topmost_child)
3835 terminal_cursor_magic (root, topmost_child); 3836 terminal_cursor_magic (root, topmost_child);
3836 flush_terminal (root); 3837 flush_terminal (root);
@@ -3850,8 +3851,8 @@ combine_updates_for_frame (struct frame *f, bool force_p, bool inhibit_scrolling
3850 return paused; 3851 return paused;
3851} 3852}
3852 3853
3853/* Update on the screen all root frames ROOTS. Called from 3854/* Update on the screen all root frames ROOTS. Called from
3854 redisplay_internal as the last step of redisplaying. */ 3855 redisplay_internal as the last step of redisplaying. */
3855 3856
3856bool 3857bool
3857combine_updates (Lisp_Object roots, bool force_p, bool inhibit_scrolling) 3858combine_updates (Lisp_Object roots, bool force_p, bool inhibit_scrolling)
@@ -3926,8 +3927,8 @@ update_frame_with_menu (struct frame *f, int row, int col)
3926 /* Update the display. */ 3927 /* Update the display. */
3927 update_begin (f); 3928 update_begin (f);
3928 cursor_at_point_p = !(row >= 0 && col >= 0); 3929 cursor_at_point_p = !(row >= 0 && col >= 0);
3929 /* Do not stop due to pending input, and do not try scrolling. This 3930 /* Do not stop due to pending input, and do not try scrolling. This
3930 means that write_glyphs will always return false. */ 3931 means that write_glyphs will always return false. */
3931 write_matrix (f, 1, 1, cursor_at_point_p, true); 3932 write_matrix (f, 1, 1, cursor_at_point_p, true);
3932 make_matrix_current (f); 3933 make_matrix_current (f);
3933 clear_desired_matrices (f); 3934 clear_desired_matrices (f);
@@ -5576,7 +5577,7 @@ write_matrix (struct frame *f, bool force_p, bool inhibit_id_p,
5576 force_p |= scrolling (f); 5577 force_p |= scrolling (f);
5577 5578
5578 /* Update the individual lines as needed. Do bottom line first. This 5579 /* Update the individual lines as needed. Do bottom line first. This
5579 is done so that messages are made visible when pausing. */ 5580 is done so that messages are made visible when pausing. */
5580 int last_row = f->desired_matrix->nrows - 1; 5581 int last_row = f->desired_matrix->nrows - 1;
5581 if (MATRIX_ROW_ENABLED_P (f->desired_matrix, last_row)) 5582 if (MATRIX_ROW_ENABLED_P (f->desired_matrix, last_row))
5582 write_row (f, last_row, updating_menu_p); 5583 write_row (f, last_row, updating_menu_p);
diff --git a/src/frame.c b/src/frame.c
index 6b7f04aed80..0d45c2de197 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -197,10 +197,10 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
197 int olines = FRAME_MENU_BAR_LINES (f); 197 int olines = FRAME_MENU_BAR_LINES (f);
198 int nlines = TYPE_RANGED_FIXNUMP (int, value) ? XFIXNUM (value) : 0; 198 int nlines = TYPE_RANGED_FIXNUMP (int, value) ? XFIXNUM (value) : 0;
199 199
200 /* Menu bars on child frames don't work on all platforms, 200 /* Menu bars on child frames don't work on all platforms, which is
201 which is the reason why prepare_menu_bar does not update_menu_bar 201 the reason why prepare_menu_bar does not update_menu_bar for
202 for child frames (info from Martin Rudalics). This could be 202 child frames (info from Martin Rudalics). This could be
203 implemented in ttys, but it's probaly not worth it. */ 203 implemented in ttys, but it's probaly not worth it. */
204 if (is_tty_child_frame (f)) 204 if (is_tty_child_frame (f))
205 { 205 {
206 FRAME_MENU_BAR_LINES (f) = 0; 206 FRAME_MENU_BAR_LINES (f) = 0;
@@ -1297,10 +1297,10 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
1297 f = make_frame_without_minibuffer (Qnil, kb, Qnil); 1297 f = make_frame_without_minibuffer (Qnil, kb, Qnil);
1298 else if (EQ (mini, Qonly)) 1298 else if (EQ (mini, Qonly))
1299 { 1299 {
1300# if 0 /* No interest in this feature at the moment, */ 1300# if 0 /* No interest in this feature at the moment. */
1301 f = make_minibuffer_frame (); 1301 f = make_minibuffer_frame ();
1302 /* Not sure about this plus the unsplittable frame 1302 /* Not sure about this, plus the unsplittable frame
1303 paran. */ 1303 param. */
1304 f->no_split = true; 1304 f->no_split = true;
1305# endif 1305# endif
1306 } 1306 }
@@ -1345,10 +1345,10 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
1345 f->horizontal_scroll_bars = false; 1345 f->horizontal_scroll_bars = false;
1346#endif 1346#endif
1347 1347
1348 /* Menu bars on child frames don't work on all platforms, 1348 /* Menu bars on child frames don't work on all platforms, which is
1349 which is the reason why prepare_menu_bar does not update_menu_bar 1349 the reason why prepare_menu_bar does not update_menu_bar for
1350 for child frames (info from Martin Rudalics). This could be 1350 child frames (info from Martin Rudalics). This could be
1351 implemented in ttys, but it's unclear if it is worth it. */ 1351 implemented in ttys, but it's unclear if it is worth it. */
1352 if (NILP (parent)) 1352 if (NILP (parent))
1353 FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1; 1353 FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1;
1354 else 1354 else
@@ -1363,7 +1363,7 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
1363 - FRAME_TAB_BAR_HEIGHT (f); 1363 - FRAME_TAB_BAR_HEIGHT (f);
1364 1364
1365 /* Mark current topmost frame obscured if we make a new root frame. 1365 /* Mark current topmost frame obscured if we make a new root frame.
1366 Child frames don't completely obscure other frames. */ 1366 Child frames don't completely obscure other frames. */
1367 if (NILP (parent) && FRAMEP (FRAME_TTY (f)->top_frame)) 1367 if (NILP (parent) && FRAMEP (FRAME_TTY (f)->top_frame))
1368 { 1368 {
1369 struct frame *top = XFRAME (FRAME_TTY (f)->top_frame); 1369 struct frame *top = XFRAME (FRAME_TTY (f)->top_frame);
@@ -1427,8 +1427,8 @@ tty_child_size_param (struct frame *child, Lisp_Object key,
1427 val = XCDR (val); 1427 val = XCDR (val);
1428 if (CONSP (val)) 1428 if (CONSP (val))
1429 { 1429 {
1430 /* Width and height may look like (width text-pixels 1430 /* Width and height may look like (width text-pixels . PIXELS)
1431 . PIXELS) on window systems. Mimic that. */ 1431 on window systems. Mimic that. */
1432 val = XCDR (val); 1432 val = XCDR (val);
1433 if (EQ (val, Qtext_pixels)) 1433 if (EQ (val, Qtext_pixels))
1434 val = XCDR (val); 1434 val = XCDR (val);
@@ -1545,9 +1545,9 @@ affects all frames on the same terminal device. */)
1545 SAFE_FREE (); 1545 SAFE_FREE ();
1546 } 1546 }
1547 1547
1548 /* Make a new frame. We need to know upfront if if a parent frame is 1548 /* Make a new frame. We need to know up front if a parent frame is
1549 specified because we behave differently in this case, e.g. child 1549 specified because we behave differently in this case, e.g., child
1550 frames don't obscure other frames. */ 1550 frames don't obscure other frames. */
1551 Lisp_Object parent = Fcdr (Fassq (Qparent_frame, parms)); 1551 Lisp_Object parent = Fcdr (Fassq (Qparent_frame, parms));
1552 struct frame *f = make_terminal_frame (t, parent, parms); 1552 struct frame *f = make_terminal_frame (t, parent, parms);
1553 1553
@@ -1556,20 +1556,20 @@ affects all frames on the same terminal device. */)
1556 1556
1557 /* Visibility of root frames cannot be set with a frame parameter. 1557 /* Visibility of root frames cannot be set with a frame parameter.
1558 Their visibility solely depends on whether or not they are the 1558 Their visibility solely depends on whether or not they are the
1559 top_frame on the terminal. */ 1559 top_frame on the terminal. */
1560 if (FRAME_PARENT_FRAME (f)) 1560 if (FRAME_PARENT_FRAME (f))
1561 { 1561 {
1562 Lisp_Object visible = Fassq (Qvisibility, parms); 1562 Lisp_Object visible = Fassq (Qvisibility, parms);
1563 if (CONSP (visible)) 1563 if (CONSP (visible))
1564 SET_FRAME_VISIBLE (f, !NILP (visible)); 1564 SET_FRAME_VISIBLE (f, !NILP (visible));
1565 1565
1566 /* FIXME/tty: The only way to get borders on a tty is 1566 /* FIXME/tty: The only way, for now, to get borders on a tty is
1567 to allow decorations for now. */ 1567 to allow decorations. */
1568 Lisp_Object undecorated = Fassq (Qundecorated, parms); 1568 Lisp_Object undecorated = Fassq (Qundecorated, parms);
1569 if (CONSP (undecorated) && !NILP (XCDR (undecorated))) 1569 if (CONSP (undecorated) && !NILP (XCDR (undecorated)))
1570 f->undecorated = true; 1570 f->undecorated = true;
1571 1571
1572 /* Unused at present. */ 1572 /* Unused at present. */
1573 Lisp_Object no_focus = Fassq (Qno_accept_focus, parms); 1573 Lisp_Object no_focus = Fassq (Qno_accept_focus, parms);
1574 if (CONSP (no_focus) && !NILP (XCDR (no_focus))) 1574 if (CONSP (no_focus) && !NILP (XCDR (no_focus)))
1575 f->no_accept_focus = true; 1575 f->no_accept_focus = true;
@@ -1579,10 +1579,10 @@ affects all frames on the same terminal device. */)
1579 f->no_split = true; 1579 f->no_split = true;
1580 } 1580 }
1581 1581
1582 /* Determine width and height of the frame. For root frames use the 1582 /* Determine width and height of the frame. For root frames use the
1583 width/height of the terminal. For child frames, take it from frame 1583 width/height of the terminal. For child frames, take it from frame
1584 parameters. Note that a default (80x25) has been set in 1584 parameters. Note that a default (80x25) has been set in
1585 make_frame. We handle root frames in this way because otherwise we 1585 make_frame. We handle root frames in this way because otherwise we
1586 would end up needing glyph matrices for the terminal, which is both 1586 would end up needing glyph matrices for the terminal, which is both
1587 more work and has its downsides (think of clipping frames to the 1587 more work and has its downsides (think of clipping frames to the
1588 terminal size). */ 1588 terminal size). */
@@ -1742,7 +1742,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
1742 1742
1743 tty->top_frame = frame; 1743 tty->top_frame = frame;
1744 1744
1745 /* Why is it correct to set FrameCols/Rows? */ 1745 /* FIXME: Why is it correct to set FrameCols/Rows? */
1746 if (!FRAME_PARENT_FRAME (f)) 1746 if (!FRAME_PARENT_FRAME (f))
1747 { 1747 {
1748 /* If the new TTY frame changed dimensions, we need to 1748 /* If the new TTY frame changed dimensions, we need to
@@ -1796,32 +1796,32 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
1796 with your typing being interpreted in the new frame instead of 1796 with your typing being interpreted in the new frame instead of
1797 the one you're actually typing in. */ 1797 the one you're actually typing in. */
1798 1798
1799 /* FIXME/tty: I don't understand this. (The comment above is from 1799 /* FIXME/tty: I don't understand this. (The comment above is from
1800 Jim BLandy 1993 BTW, and the frame_ancestor_p from 2017.) 1800 Jim BLandy 1993 BTW, and the frame_ancestor_p from 2017.)
1801 1801
1802 Setting the last event frame to nil leads to switch-frame events 1802 Setting the last event frame to nil leads to switch-frame events
1803 being generated even if they normally wouldn't be because the frame 1803 being generated even if they normally wouldn't be because the frame
1804 in question equals selected-frame. See the places in keyboard.c 1804 in question equals selected-frame. See the places in keyboard.c
1805 where make_lispy_switch_frame is called. 1805 where make_lispy_switch_frame is called.
1806 1806
1807 This leads to problems at least on ttys. 1807 This leads to problems at least on ttys.
1808 1808
1809 Imagine that we have functions in post-command-hook that use 1809 Imagine that we have functions in post-command-hook that use
1810 select-frame in some way (e.g. with-selected-window). Let these 1810 select-frame in some way (e.g., with-selected-window). Let these
1811 functions select different frames during the execution of 1811 functions select different frames during the execution of
1812 post-command-hook in command_loop_1. Setting 1812 post-command-hook in command_loop_1. Setting
1813 internal_last_event_frame to nil here makes these select-frame 1813 internal_last_event_frame to nil here makes these select-frame
1814 calls (potentially, and reality) generate switch-frame events. (But 1814 calls (potentially and in reality) generate switch-frame events.
1815 only in one direction (frame_ancestor_p), which I also don't 1815 (But only in one direction (frame_ancestor_p), which I also don't
1816 understand). 1816 understand).
1817 1817
1818 These switch-frame events form an endless loop in 1818 These switch-frame events form an endless loop in
1819 command_loop_1. It runs post-command-hook, which generates 1819 command_loop_1. It runs post-command-hook, which generates
1820 switch-frame events, which command_loop_1 finds (bound to '#ignore) 1820 switch-frame events, which command_loop_1 finds (bound to '#ignore)
1821 and executes, which again runs post-command-hook etc. ad 1821 and executes, which again runs post-command-hook etc., ad
1822 infinitum. 1822 infinitum.
1823 1823
1824 Let's not do that for now on ttys. */ 1824 Let's not do that for now on ttys. */
1825 if (!is_tty_frame (f)) 1825 if (!is_tty_frame (f))
1826 if (!frame_ancestor_p (f, sf)) 1826 if (!frame_ancestor_p (f, sf))
1827 internal_last_event_frame = Qnil; 1827 internal_last_event_frame = Qnil;
@@ -3135,9 +3135,9 @@ displayed in the terminal. */)
3135 if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->frame_visible_invisible_hook) 3135 if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->frame_visible_invisible_hook)
3136 FRAME_TERMINAL (f)->frame_visible_invisible_hook (f, false); 3136 FRAME_TERMINAL (f)->frame_visible_invisible_hook (f, false);
3137 3137
3138 /* The Elisp info manual says that this "usually" makes child frames 3138 /* The ELisp manual says that this "usually" makes child frames
3139 invisible, too, but without saying when not. Since users can't rely 3139 invisible, too, but without saying when not. Since users can't
3140 on this, it's not implemented. */ 3140 rely on this, it's not implemented. */
3141 if (is_tty_frame (f)) 3141 if (is_tty_frame (f))
3142 SET_FRAME_VISIBLE (f, false); 3142 SET_FRAME_VISIBLE (f, false);
3143 3143
@@ -4503,10 +4503,11 @@ frame_float (struct frame *f, Lisp_Object val, enum frame_float_type what,
4503 } 4503 }
4504} 4504}
4505 4505
4506/* Handle frame parameter change with frame parameter handler. F is the 4506/* Handle frame parameter change with frame parameter handler.
4507 frame whose frame parameter was changed. PROP is the name of the 4507 F is the frame whose frame parameter was changed.
4508 frame parameter. VAL and OLD_VALUE are the current value and old 4508 PROP is the name of the frame parameter.
4509 value of the frame parameter. */ 4509 VAL and OLD_VALUE are the current and the old value of the
4510 frame parameter. */
4510 4511
4511static void 4512static void
4512handle_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val, 4513handle_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val,
diff --git a/src/frame.h b/src/frame.h
index 9a9d025e638..bf0a4169f21 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -734,7 +734,7 @@ struct frame
734 struct text_conversion_state conversion; 734 struct text_conversion_state conversion;
735# endif 735# endif
736 736
737 /* Z-order of child frames. */ 737 /* Z-order of child frames. */
738 int z_order; 738 int z_order;
739} GCALIGNED_STRUCT; 739} GCALIGNED_STRUCT;
740 740
diff --git a/src/term.c b/src/term.c
index 330da251e18..6379b4ce4a1 100644
--- a/src/term.c
+++ b/src/term.c
@@ -786,10 +786,10 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
786 /* Identify a run of glyphs with the same face. */ 786 /* Identify a run of glyphs with the same face. */
787 int face_id = string->face_id; 787 int face_id = string->face_id;
788 788
789 /* FIXME/tty: it happens that a single glyph's frame is NULL. It 789 /* FIXME/tty: it happens that a single glyph's frame is NULL. It
790 might depend on a tab bar line being present, then switching 790 might depend on a tab bar line being present, then switching
791 from a buffer without header line to one with header line and 791 from a buffer without header line to one with header line and
792 opening a child frame. */ 792 opening a child frame. */
793 struct frame *face_id_frame = string->frame ? string->frame : f; 793 struct frame *face_id_frame = string->frame ? string->frame : f;
794 794
795 for (n = 1; n < stringlen; ++n) 795 for (n = 1; n < stringlen; ++n)
diff --git a/src/xdisp.c b/src/xdisp.c
index 935c75a8230..bd3e8f3138d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -17035,9 +17035,9 @@ redisplay_internal (void)
17035 if (face_change) 17035 if (face_change)
17036 windows_or_buffers_changed = 47; 17036 windows_or_buffers_changed = 47;
17037 17037
17038 /* Can we do better for tty child frames? It could be 17038 /* FIXME: Can we do better for tty child frames? It could be
17039 a bit faster when we switch between child frames of the same 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. */ 17040 root frame. OTOH, it's probably not a frequent use case. */
17041 if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)) 17041 if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf))
17042 && FRAME_TTY (sf)->previous_frame != sf) 17042 && FRAME_TTY (sf)->previous_frame != sf)
17043 { 17043 {
@@ -17463,7 +17463,7 @@ redisplay_internal (void)
17463 if (!FRAME_VISIBLE_P (root_frame (f))) 17463 if (!FRAME_VISIBLE_P (root_frame (f)))
17464 continue; 17464 continue;
17465 17465
17466 /* Remember tty root frames seen. */ 17466 /* Remember tty root frames which we've seen. */
17467 if (!FRAME_PARENT_FRAME (f)) 17467 if (!FRAME_PARENT_FRAME (f))
17468 { 17468 {
17469 Lisp_Object found; 17469 Lisp_Object found;