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: Eli Zaretskii
Subject: Re: "Final" version of tty child frames
Date: Sun, 05 Jan 2025 09:07:07 +0200

> Date: Sat, 04 Jan 2025 14:12:00 -0800
> From: Jared Finder <jared@finder.org>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org, rudalics@gmx.at
> 
> It was that easy to do.  Attached is a patch that adds support for TTY 
> child frames to a GPM mouse.

Thanks.

> @@ -2638,7 +2639,11 @@ term_mouse_position (struct frame **fp, int insist, 
> Lisp_Object *bar_window,
>                    enum scroll_bar_part *part, Lisp_Object *x,
>                    Lisp_Object *y, Time *timeptr)
>  {
> -  *fp = SELECTED_FRAME ();
> +  /* This code runs even when `gpm-mouse-mode' was never active, like
> +     inside an xterm.  In such cases, last_mouse_frame will never be
> +     set, so fallback to SELECTED_FRAME. */
> +  *fp = FRAMEP (last_mouse_frame) ? XFRAME (last_mouse_frame)
> +    : SELECTED_FRAME ();

Does this mean child frames on xterm will have the selected-frame set
to a child frame, and thus do not need this trick with
last_mouse_frame?  Or what other difference between xterm and the
Linux console hides behind this "fallback"?

> +static Lisp_Object
> +frame_at(int x, int y)
           ^
Missing space there.

> +{
> +  Lisp_Object frame = CALLN (Ffuncall, Qframe_at,
> +                          make_fixnum (x), make_fixnum (y));

I'd refrain from calling into Lisp here: frame-at will call
tty-frame-list-z-order, which is implemented in C, and the rest of
frame-at can be trivially done in C.

> +  if (NILP (frame))
> +    {
> +      frame = selected_frame;
> +    }

Redundant braces.

> +handle_one_term_event (struct tty_display_info *tty, const Gpm_Event 
> *event_in)
>  {
> -  struct frame *f = XFRAME (tty->top_frame);
> +  Lisp_Object frame = frame_at(event_in->x, event_in->y);
                                 ^
Missing space.

> +      /* The pointer must be drawn using screen coordinates (x,y), not
> +      frame coordinates. Use event_in which has an unmodified event
                          ^^
Two spaces between sentences.

> +      directly from GPM. */
                          ^^
Same at the end of a comment.



reply via email to

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