Subject: bug#75056: 31.0.50; tty-child-frames with server / multiple clients possible hangs

From: Gerd Möllmann <[email-masked]>
Date: Thu, 30 Jan 2025 19:50:31 +0100

martin rudalics <[email-masked]> writes:

>>>>> Also when I want to move a child frame to the left of its parent via
>>>>>
>>>>>     (modify-frame-parameters nil '((left . 0)))
>>>>>
>>>>> the left border disappears.  Is that intended?
>>>>
>>>> If I understand that correctly, then probably yes. The borders are drawn
>>>> around the frame, so the left border is at left - 1, the right at left +
>>>> width + 1, and so on.
>>>
>>> I see.
>>>
>>>> Whatever is outside of the terminal is clipped.
>
> Troublesome.  Please revise that.  When I want to resize a child frame
> with the mouse, I have to drag its internal border.  But as it stands,
> the internal border is part of the underlying or root frame and the
> whole make_lispy_position mechanism is broken on ttys.

You drag a child frame with the mouse, what the heck? :-)

There is little chance that I can change how the borders are drawn, I'm
afraid. I started with trying to give tty frames a border_width, and
failed spectacularly. It was so bad that I git reset --hard in a rage,
which is a really rare event.

>> _Much_ nicer than the default IMO. I still wished Emacs would do that by
>> default, but here were objections.
>
> Looks good.  But _where_ on earth (that is, in the code) do you that and
> how is it related to the width of the internal border?

See copy_child_glyphs.

dispnew.c:
 3729   /* Draw borders around the child frame.  */
 3730   if (!FRAME_UNDECORATED (child))
 3731     {
 3732       /* Horizontal line above.  */
 3733       if (r.y > 0)
 3734         produce_box_line (root, child, r.x, r.y - 1, r.w, true);
 3735 
 3736       for (int y = r.y; y < r.y + r.h; ++y)
 3737         {
 3738           struct glyph_row *root_row = prepare_desired_root_row (root, y);
 3739           if (root_row)
 3740             produce_box_sides (BOX_VERTICAL, BOX_VERTICAL, root_row, r.x, r.w,
 3741                                root, child);
 3742         }
 3743 
 3744       /* Horizontal line below.  */
 3745       if (r.y + r.h < root->desired_matrix->matrix_h)
 3746         produce_box_line (root, child, r.x, r.y + r.h, r.w, false);
 3747     }

The code is not related to an internal border, and I'm relatively sure
tty frames don't have one right now. At least as far as redisplay is
concerned, don't know about the frame parameters/values. It's like for
border_width.

> I attach my latest achievements both in the menu bar and mouse drag
> child frame departments. Menu bars now accept navigation with the
> keyboard which was pretty non-trivial to do. Mouse dragging works with
> header and mode lines - the attached tty-child-frames.el should
> provide the necessary ingredients via C-l and M-l.

👍

> One bug I noted now is the following.  Do C-l and M-l and drag the
> yellow and orange frames somehow as in before.png with the cursor in the
> yellow frame right before the left edge of the orange frame.  Do C-f -
> the cursor appears on top of the left edge of the orange frame as in
> middle.png.  Another C-f moves it into the orange frame as in
> after.png.

Thanks.