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

From: martin rudalics <[email-masked]>
Date: Mon, 27 Jan 2025 08:59:59 +0100

(4) As noted elsewhere, the documentation must be rewritten.

 > Can't talk for w32, but I've removed the "obscuring" fromt the ttys
 > because it plainly went against the rest with tty child frames.

You could have left it in to handle invisible top frames but maybe
that's really not needed any more.  Whatever you decide here, the
following issues must be resolved:

(1) Fframe_visible_p has this

   else if (is_tty_root_frame (f))
     return Qt;

where is_tty_root_frame is defined as

   return !FRAME_PARENT_FRAME (f) && is_tty_frame (f);

This is wrong because it will return t even if F has been explicitly
made invisible.

(2) do_switch_frame now has this

	  if (FRAMEP (top_frame))
	    {
	      struct frame *top = XFRAME (top_frame);
	      struct frame *old_root = root_frame (top);
	      if (old_root != new_root)
		SET_FRAME_VISIBLE (old_root, false);
	    }

This is wrong because it will set the visibility of the old top frame to
nil.  This will change the behavior of many functions that check the
visibility of frames, notably here in candidate_window_p in window.c

   else if (EQ (all_frames, Qvisible))
     {
       candidate_p = FRAME_VISIBLE_P (f)
	&& (FRAME_TERMINAL (XFRAME (w->frame))
	    == FRAME_TERMINAL (XFRAME (selected_frame)));

     }

where a window on the prior top frame will be no more considered as
eligible.

(3) I have not checked whether it's needed but I strongly suppose we now
need a frame_visible_invisible_hook for ttys too.

martin