aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Möllmann2024-11-10 16:19:40 +0100
committerGerd Möllmann2024-11-10 20:03:58 +0100
commit437ccbe612b377fd5ac492572702978ec75ea0df (patch)
tree14de808fb86b3794e73bb7f827efc0d4bee5dcd0 /src
parent582ebedd33ed957b9ad409e35ed7ba9dafa42c01 (diff)
downloademacs-437ccbe612b377fd5ac492572702978ec75ea0df.tar.gz
emacs-437ccbe612b377fd5ac492572702978ec75ea0df.zip
Change interface of prepare_desired_root_row
* src/dispnew.c (prepare_desired_root_row): Return NULL if we can't prepare the row. (produce_box_line, copy_child_glyphs): Callers changed accordingly.
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 4758aabe967..06d1ae3e6c6 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3519,28 +3519,32 @@ make_matrix_current (struct frame *f)
3519 make_current (f, NULL, i); 3519 make_current (f, NULL, i);
3520} 3520}
3521 3521
3522/* Prepare ROOT's desired row at index Y for copying child 3522/* Prepare ROOT's desired row at index Y for copying child frame
3523 frame contents to it. */ 3523 contents to it. Value is the prepared desired row or NULL if we
3524 don't have, and can't contruct a desired row. */
3524 3525
3525static struct glyph_row * 3526static struct glyph_row *
3526prepare_desired_root_row (struct frame *root, int y) 3527prepare_desired_root_row (struct frame *root, int y)
3527{ 3528{
3528 /* Start with the root's desired matrix row. If that hasn't been 3529 /* If we have a desired row that has been displayed, use that. */
3529 redisplayed, copy from the root's current matrix. */ 3530 struct glyph_row *desired_row = MATRIX_ROW (root->desired_matrix, y);
3530 struct glyph_row *root_row = MATRIX_ROW (root->desired_matrix, y); 3531 if (desired_row->enabled_p)
3532 return desired_row;
3533
3534 /* If we have a current row that is up to date, copy that to the
3535 desired row and use that. */
3531 /* Don't copy rows that aren't enabled, in particuler because they 3536 /* Don't copy rows that aren't enabled, in particuler because they
3532 might not have the 'frame' member of glyphs set. */ 3537 might not have the 'frame' member of glyphs set. */
3533 if (!root_row->enabled_p) 3538 struct glyph_row *current_row = MATRIX_ROW (root->current_matrix, y);
3539 if (current_row->enabled_p)
3534 { 3540 {
3535 struct glyph_row *from = MATRIX_ROW (root->current_matrix, y); 3541 memcpy (desired_row->glyphs[0], current_row->glyphs[0],
3536 if (from->enabled_p) 3542 root->current_matrix->matrix_w * sizeof (struct glyph));
3537 { 3543 desired_row->enabled_p = true;
3538 memcpy (root_row->glyphs[0], from->glyphs[0], 3544 return desired_row;
3539 root->current_matrix->matrix_w * sizeof (struct glyph));
3540 root_row->enabled_p = true;
3541 }
3542 } 3545 }
3543 return root_row; 3546
3547 return NULL;
3544} 3548}
3545 3549
3546/* Change GLYPH to be a space glyph. */ 3550/* Change GLYPH to be a space glyph. */
@@ -3667,6 +3671,8 @@ produce_box_line (struct frame *root, struct frame *child, int x, int y, int w,
3667 bool first) 3671 bool first)
3668{ 3672{
3669 struct glyph_row *root_row = prepare_desired_root_row (root, y); 3673 struct glyph_row *root_row = prepare_desired_root_row (root, y);
3674 if (root_row == NULL)
3675 return;
3670 if (first) 3676 if (first)
3671 produce_box_sides (BOX_DOWN_RIGHT, BOX_DOWN_LEFT, root_row, x, w, root, child); 3677 produce_box_sides (BOX_DOWN_RIGHT, BOX_DOWN_LEFT, root_row, x, w, root, child);
3672 else 3678 else
@@ -3703,8 +3709,9 @@ copy_child_glyphs (struct frame *root, struct frame *child)
3703 for (int y = r.y; y < r.y + r.h; ++y) 3709 for (int y = r.y; y < r.y + r.h; ++y)
3704 { 3710 {
3705 struct glyph_row *root_row = prepare_desired_root_row (root, y); 3711 struct glyph_row *root_row = prepare_desired_root_row (root, y);
3706 produce_box_sides (BOX_VERTICAL, BOX_VERTICAL, root_row, r.x, r.w, 3712 if (root_row)
3707 root, child); 3713 produce_box_sides (BOX_VERTICAL, BOX_VERTICAL, root_row, r.x, r.w,
3714 root, child);
3708 } 3715 }
3709 3716
3710 /* Horizontal line below. */ 3717 /* Horizontal line below. */
@@ -3722,6 +3729,8 @@ copy_child_glyphs (struct frame *root, struct frame *child)
3722 for (int y = r.y; y < r.y + r.h; ++y, ++child_y) 3729 for (int y = r.y; y < r.y + r.h; ++y, ++child_y)
3723 { 3730 {
3724 struct glyph_row *root_row = prepare_desired_root_row (root, y); 3731 struct glyph_row *root_row = prepare_desired_root_row (root, y);
3732 if (root_row == NULL)
3733 continue;
3725 3734
3726 /* Deal with wide characters unless already done as part of 3735 /* Deal with wide characters unless already done as part of
3727 drawing a box around the child frame. */ 3736 drawing a box around the child frame. */