diff options
| author | Gerd Möllmann | 2025-12-21 08:20:08 +0100 |
|---|---|---|
| committer | Gerd Möllmann | 2025-12-22 15:00:42 +0100 |
| commit | 575dc8e534abc2a31d2326ac4f9254d2f74bb662 (patch) | |
| tree | e78eff4bd3bac00a04becf4283f5ee96602e61f2 /src | |
| parent | acb91f501c6a734b9330c5426e1c48c79f205621 (diff) | |
| download | emacs-575dc8e534abc2a31d2326ac4f9254d2f74bb662.tar.gz emacs-575dc8e534abc2a31d2326ac4f9254d2f74bb662.zip | |
Fix handling of border face on tty child frames (bug#80043)
* src/dispnew.c (box_from_display_table, box_default,
box_glyph): New functions, extracted from produce_box_glyphs.
(box_from_display_table): Merge face nwith glyph's face.
(box_default): Lookup face.
(produce_box_glyphs): Use new functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 65 |
1 files changed, 46 insertions, 19 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index d65a7cbc1f1..4ec6e22ea46 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3622,13 +3622,32 @@ neutralize_wide_char (struct frame *root, struct glyph_row *row, int x) | |||
| 3622 | } | 3622 | } |
| 3623 | } | 3623 | } |
| 3624 | 3624 | ||
| 3625 | /* Produce glyphs for box character BOX in ROW. X is the position in | 3625 | /* Fill *G with the code and face for box character BOX on frame F |
| 3626 | ROW where to start producing glyphs. N is the number of glyphs to | 3626 | Value is true if a standard display table entry for BOX exists. */ |
| 3627 | produce. CHILD is the frame to use for the face of the glyphs. */ | 3627 | |
| 3628 | static bool | ||
| 3629 | box_from_display_table (struct frame *f, enum box box, GLYPH *g) | ||
| 3630 | { | ||
| 3631 | if (DISP_TABLE_P (Vstandard_display_table)) | ||
| 3632 | { | ||
| 3633 | struct Lisp_Char_Table *dp = XCHAR_TABLE (Vstandard_display_table); | ||
| 3634 | Lisp_Object gc = dp->extras[box]; | ||
| 3635 | if (GLYPH_CODE_P (gc)) | ||
| 3636 | { | ||
| 3637 | SET_GLYPH_FROM_GLYPH_CODE (*g, gc); | ||
| 3638 | spec_glyph_lookup_face (XWINDOW (f->root_window), g); | ||
| 3639 | if (GLYPH_FACE (*g) == 0) | ||
| 3640 | SET_GLYPH_FACE (*g, BORDER_FACE_ID); | ||
| 3641 | return true; | ||
| 3642 | } | ||
| 3643 | } | ||
| 3644 | return false; | ||
| 3645 | } | ||
| 3646 | |||
| 3647 | /* Fill *G with the default code and face for box BOX on frame F. */ | ||
| 3628 | 3648 | ||
| 3629 | static void | 3649 | static void |
| 3630 | produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n, | 3650 | box_default (struct frame *f, enum box box, GLYPH *g) |
| 3631 | struct frame *child) | ||
| 3632 | { | 3651 | { |
| 3633 | int dflt; | 3652 | int dflt; |
| 3634 | switch (box) | 3653 | switch (box) |
| @@ -3641,7 +3660,7 @@ produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n, | |||
| 3641 | break; | 3660 | break; |
| 3642 | case BOX_DOWN_RIGHT: | 3661 | case BOX_DOWN_RIGHT: |
| 3643 | case BOX_DOWN_LEFT: | 3662 | case BOX_DOWN_LEFT: |
| 3644 | case BOX_UP_RIGHT: | 3663 | case BOX_UP_RIGHT: |
| 3645 | case BOX_UP_LEFT: | 3664 | case BOX_UP_LEFT: |
| 3646 | dflt = '+'; | 3665 | dflt = '+'; |
| 3647 | break; | 3666 | break; |
| @@ -3654,22 +3673,30 @@ produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n, | |||
| 3654 | emacs_abort (); | 3673 | emacs_abort (); |
| 3655 | } | 3674 | } |
| 3656 | 3675 | ||
| 3657 | /* FIXME/tty: some face for the border. */ | 3676 | int face_id = lookup_basic_face (NULL, f, BORDER_FACE_ID); |
| 3658 | int face_id = BORDER_FACE_ID; | 3677 | SET_GLYPH (*g, dflt, face_id); |
| 3678 | } | ||
| 3679 | |||
| 3680 | /* Return the glyph for displaying BOX on frame F. */ | ||
| 3681 | |||
| 3682 | static GLYPH | ||
| 3683 | box_glyph (struct frame *f, enum box box) | ||
| 3684 | { | ||
| 3659 | GLYPH g; | 3685 | GLYPH g; |
| 3660 | SET_GLYPH (g, dflt, face_id); | 3686 | if (!box_from_display_table (f, box, &g)) |
| 3687 | box_default (f, box, &g); | ||
| 3688 | return g; | ||
| 3689 | } | ||
| 3661 | 3690 | ||
| 3662 | if (DISP_TABLE_P (Vstandard_display_table)) | 3691 | /* Produce glyphs for box character BOX in ROW. X is the position in |
| 3663 | { | 3692 | ROW where to start producing glyphs. N is the number of glyphs to |
| 3664 | struct Lisp_Char_Table *dp = XCHAR_TABLE (Vstandard_display_table); | 3693 | produce. CHILD is the frame to use for the face of the glyphs. */ |
| 3665 | Lisp_Object gc = dp->extras[box]; | ||
| 3666 | if (GLYPH_CODE_P (gc)) | ||
| 3667 | { | ||
| 3668 | SET_GLYPH_FROM_GLYPH_CODE (g, gc); | ||
| 3669 | /* Sorry, but I really don't care if the glyph has a face :-). */ | ||
| 3670 | } | ||
| 3671 | } | ||
| 3672 | 3694 | ||
| 3695 | static void | ||
| 3696 | produce_box_glyphs (enum box box, struct glyph_row *row, int x, int n, | ||
| 3697 | struct frame *child) | ||
| 3698 | { | ||
| 3699 | GLYPH g = box_glyph (child, box);; | ||
| 3673 | struct glyph *glyph = row->glyphs[0] + x; | 3700 | struct glyph *glyph = row->glyphs[0] + x; |
| 3674 | for (int i = 0; i < n; ++i, ++glyph) | 3701 | for (int i = 0; i < n; ++i, ++glyph) |
| 3675 | { | 3702 | { |