emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Final" version of tty child frames


From: Gerd Möllmann
Subject: Re: "Final" version of tty child frames
Date: Thu, 16 Jan 2025 20:05:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

martin rudalics <rudalics@gmx.at> writes:

> diff --git a/src/xdisp.c b/src/xdisp.c
> index 4087ff975ee..52f3ebf6f2e 100644
> --- a/src/xdisp.c
> +++ b/src/xdisp.c
> @@ -18228,6 +18228,32 @@ set_cursor_from_row (struct window *w, struct 
> glyph_row *row,
>       comes from a text property, not from an overlay.  */
>    bool string_from_text_prop = false;
>  
> +  /* is_tty_selected is true iff the following hold
> +     - W is the selected window.
> +     - There exists at least one visible child frame whose root is the
> +       same frame as the root of W's frame.  Such a frame could overlap
> +       the position of point in W in which case we (1) don't want to
> +       show the cursor and (2) make sure that if point is not overlapped
> +       by that frame, the cursor is shown.  */

If one wants, one could sharpen the second point a bit. Glyphs from
child frames can only ever appear if

- in a current matrix

  matrix == w->current_matrix

- if w->frame is a root frame (NILP (w->frame->parent_frame)
  IOW, the current matrix of child frames will never show this
  phenomenon.

  struct frame *f = XFRAME (w->frame);
  is_tty_root_frame (f);

- w is the selected window 

- that root frame has visible child frames. Something like

  Lisp_Object z_order = frames_in_reverse_z_order (f, true);
  bool has_visible_child = CONSP (XCDR (z_order);

Which might be easier to understand than the below.

> +  bool is_tty_selected = false;
> +  struct frame *f = WINDOW_XFRAME (w);
> +  struct frame *r = root_frame (WINDOW_XFRAME (w));
> +
> +  Lisp_Object tail, other;
> +
> +  if (w == XWINDOW (selected_window))
> +    FOR_EACH_FRAME (tail, other)
> +      {
> +     struct frame *o = XFRAME (other);
> +
> +     if (FRAME_LIVE_P (o) && is_tty_child_frame (o)
> +         && FRAME_VISIBLE_P (o) && root_frame (o) == r)
> +       {
> +         is_tty_selected = true;
> +         break;
> +       }
> +      }
> +

The rest LGTM, but I'm must admit that I don't understand parts of the
logic of this function well enough to be 100% sure. But the proof is in
the pudding - it seems to work with your .el. And AFAICS if the flag is
false, it does what it did before, so that's good, I'd say :-).

Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]