From: Jared Finder <jared@finder.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org, rudalics@gmx.at
Subject: Re: "Final" version of tty child frames
Date: Sun, 05 Jan 2025 16:05:59 -0800 [thread overview]
Message-ID: <9c324c399a59d8e64cdc7072d2db0ae8@finder.org> (raw)
In-Reply-To: <86h66dagdg.fsf@gnu.org>
On 2025-01-04 23:07, Eli Zaretskii wrote:
>> 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.
Style comments addressed, thank you! Someday, I will internalize Emacs'
unique C style conventions. Probably once I only code for Emacs and not
other projects. :)
>> @@ -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"?
This is just keeping the behavior that already exists today. I was
surprised by the current behavior: that term_mouse_position which only
works for a GPM enabled mouse gets called even when GPM could not be
used. It could make sense to change this behavior however it would be a
bigger change as gpm-mouse-mode is enabled by default even for non-GPM
supporting terminals. I suspect that GPM support is equivalent to
TERM=linux, but I may be wrong.
This works when xterm-mouse-mode is enabled because mouse_position_hook
(set to term_mouse_position) is called first, followed by
mouse-position-function (set to xterm-mouse-position-function). On ttys
with xterm-mouse-mode enabled the return value from term_mouse_position
is ignored. See existing definitions in Fmouse_pixel_position and
mouse_position in frame.c.
>> +{
>> + 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.
Would it make sense to delete the Lisp implementation of frame-at and
make it implemented in C only? The only other existing client of
frame-at is xterm-mouse-mode for the same use case. Looking forward, I
expect that getting a window by screen pixel coordinate will be less
available over time. Wayland and Android specifically do not support
this for arbitrary pixels for security reasons.
-- MJF
next prev parent reply other threads:[~2025-01-06 0:05 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 4:46 "Final" version of tty child frames Gerd Möllmann
2024-10-22 5:29 ` Eli Zaretskii
2024-10-22 9:58 ` martin rudalics
2024-10-22 10:20 ` Eli Zaretskii
2024-10-22 14:01 ` martin rudalics
2024-10-22 14:23 ` Eli Zaretskii
2024-10-22 10:40 ` Gerd Möllmann
2024-10-22 11:43 ` Po Lu
2024-10-22 13:44 ` Eli Zaretskii
2024-10-22 14:01 ` Gerd Möllmann
2024-10-22 14:02 ` martin rudalics
2024-10-28 4:35 ` Jared Finder
2024-10-28 5:57 ` Gerd Möllmann
2024-11-30 11:25 ` Eli Zaretskii
2024-12-05 3:49 ` Jared Finder
2024-12-11 7:31 ` Jared Finder
2024-12-11 7:59 ` Gerd Möllmann
2024-12-12 5:11 ` Jared Finder
2024-12-12 6:20 ` Gerd Möllmann
2024-12-12 6:48 ` Gerd Möllmann
2024-12-12 6:30 ` Eli Zaretskii
2024-12-12 7:04 ` Gerd Möllmann
2024-12-18 5:35 ` Jared Finder
2024-12-18 6:25 ` Gerd Möllmann
2025-01-04 22:12 ` Jared Finder
2025-01-05 4:03 ` Gerd Möllmann
2025-01-05 7:07 ` Eli Zaretskii
2025-01-06 0:05 ` Jared Finder [this message]
2025-01-06 4:27 ` Gerd Möllmann
2025-01-06 13:30 ` Eli Zaretskii
2025-01-07 5:40 ` Jared Finder
2025-01-07 7:36 ` Gerd Möllmann
2024-12-18 13:54 ` Eli Zaretskii
2024-12-18 16:01 ` Gerd Möllmann
2024-12-18 16:29 ` Eli Zaretskii
2024-12-18 16:39 ` Gerd Möllmann
2024-12-18 17:02 ` Eli Zaretskii
2024-12-18 17:22 ` Gerd Möllmann
2024-12-19 5:17 ` Jared Finder
2024-12-19 5:30 ` Gerd Möllmann
2024-12-19 7:44 ` Gerd Möllmann
2024-12-19 8:36 ` Eli Zaretskii
2024-12-19 9:04 ` Gerd Möllmann
2024-12-19 9:17 ` Gerd Möllmann
2024-12-19 10:34 ` Robert Pluim
2024-12-19 10:40 ` Gerd Möllmann
2024-12-18 21:06 ` Stefan Kangas
2024-12-19 8:00 ` Andrea Corallo
2024-12-11 9:39 ` martin rudalics
2025-01-04 22:09 ` Jared Finder
2025-01-05 3:48 ` Gerd Möllmann
2025-01-05 6:46 ` Eli Zaretskii
2025-01-06 0:18 ` Jared Finder
2025-01-06 13:35 ` Eli Zaretskii
2024-10-22 7:34 ` Dr. Arne Babenhauserheide
2024-10-22 7:49 ` Gerd Möllmann
2024-10-22 7:49 ` Eli Zaretskii
2024-10-22 8:01 ` Eli Zaretskii
2024-10-22 8:21 ` Gerd Möllmann
2024-10-22 8:57 ` Eli Zaretskii
2024-10-22 9:42 ` Eli Zaretskii
2024-10-22 10:23 ` Gerd Möllmann
2024-10-22 13:35 ` Eli Zaretskii
2024-10-22 13:43 ` Gerd Möllmann
2024-10-22 13:55 ` Eli Zaretskii
2024-10-22 14:02 ` Gerd Möllmann
2024-10-22 14:40 ` Eli Zaretskii
2024-10-22 19:19 ` Paul Eggert
2024-10-23 3:18 ` Gerd Möllmann
2024-10-22 10:43 ` Gerd Möllmann
2024-10-23 3:05 ` Feng Shu
2024-10-23 3:13 ` Gerd Möllmann
2024-10-23 3:25 ` Feng Shu
2024-10-23 3:36 ` Gerd Möllmann
2024-10-23 3:44 ` Feng Shu
2024-10-23 4:09 ` Gerd Möllmann
2024-10-23 4:40 ` Gerd Möllmann
2024-10-23 5:00 ` Gerd Möllmann
2024-10-23 7:49 ` Eli Zaretskii
2024-10-23 8:12 ` Gerd Möllmann
2024-10-23 11:04 ` Gerd Möllmann
2024-10-23 17:23 ` Eli Zaretskii
2024-10-23 17:52 ` Gerd Möllmann
2024-10-23 6:54 ` Feng Shu
2024-10-23 7:25 ` Gerd Möllmann
2024-10-23 7:28 ` Eli Zaretskii
2024-10-23 7:37 ` Gerd Möllmann
2024-10-23 7:52 ` Feng Shu
2024-10-23 8:07 ` Gerd Möllmann
2024-10-23 9:07 ` Feng Shu
2024-10-23 9:58 ` Gerd Möllmann
2024-10-23 7:11 ` Eli Zaretskii
2024-10-26 8:15 ` Gerd Möllmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9c324c399a59d8e64cdc7072d2db0ae8@finder.org \
--to=jared@finder.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=gerd.moellmann@gmail.com \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).