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

From: Gerd Möllmann <[email-masked]>
Date: Mon, 27 Jan 2025 20:12:41 +0100

martin rudalics <[email-masked]> writes:

> (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.
>
Thanks. That's 100% bug.

> (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.  

I don't understand that one. It doesn't, or shouldn't change, the
visibility of the top_frame, but the visibility of its root. Can you
please explain?

> 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)));
>
>     }

Would have to be changed then.

My idea is that root windows on ttys become invisible/invisible when
they are displayed on the terminal or not. Child windows on these roots
keep their visibility. They are automatically not displayed when the
root is not displayed, that's inherently the case when
combine_updates_for frame is not called for invisible root frames.

> 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.

Okay.