Subject: Re: 31.0.50; Re-parenting tty child frame leaves two instances on display

From: martin rudalics <[email-masked]>
Date: Tue, 18 Mar 2025 10:02:09 +0100

>> I think we need the following change
 >>
 >> diff --git a/src/frame.c b/src/frame.c
 >> index c1ef26e5dd4..9a4ca7d0682 100644
 >> --- a/src/frame.c
 >> +++ b/src/frame.c
 >> @@ -3706,6 +3706,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
 >>          if (NILP (f->parent_frame) != NILP (val))
 >>    	error ("Making a root frame a child or vice versa is not supported");
 >>          f->parent_frame = val;
 >> +      SET_FRAME_GARBAGED (root_frame (f));
 >>        }
 >>
 >>      /* The tty color needed to be set before the frame's parameter
 >>
 >> since otherwise re-parenting a child frame, for example, using
 >>
 >> (set-frame-parameter tty-3 'parent-frame tty-1)
 >>
 >> from my earlier tty-child-frames.el leaves one with two instances of the
 >> child frame on display.
 >>
 >> martin
 >
 > Yep, for sure.

Installed with the additional twist that I now garbage the old and new
root frame to handle a scenario where I make the child frames tty-1,
tty-2 on the selected frame and then do

(setq tty-0 (make-frame))
(set-frame-parameter tty-1 'parent-frame tty-0)
(set-frame-parameter tty-2 'parent-frame tty-1)

martin