From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: "Final" version of tty child frames Date: Sun, 05 Jan 2025 09:07:07 +0200 Message-ID: <86h66dagdg.fsf@gnu.org> References: <86wmi0g0x6.fsf@gnu.org> <11a86987cce9fe0a257c3fa58703dc33@finder.org> <86wmgl6jzv.fsf@gnu.org> <092cb755eee3a9b5e06d15c0b07e90b1@finder.org> <276414b03c24964aaeb9e43e8dba5e77@finder.org> <5fedec86bce470555814acbdf999f99d@finder.org> <86h6791khk.fsf@gnu.org> <09b0904da92efad899865b2ece5f3116@finder.org> <23dfc3fde8677a984b4c37a40d09d83b@finder.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23046"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org, rudalics@gmx.at To: Jared Finder Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 05 08:08:33 2025 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tUKkT-0005sQ-Hq for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Jan 2025 08:08:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUKjA-0007Nl-Nv; Sun, 05 Jan 2025 02:07:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUKj9-0007Mh-LP for emacs-devel@gnu.org; Sun, 05 Jan 2025 02:07:11 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUKj8-0005Fc-TO; Sun, 05 Jan 2025 02:07:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nEL5J46DFJG1n238esHl95cNKC16Ix8wuxhit4KuvxY=; b=QGefoeL4kGQg Sx7YwCgLSyScp1n5N3yoGZy8DS7t5PcK4QSMdMuW1sD9uB8Mpp50SIgfhpeiOzVDPN8ARLeqH4dLo H85oIwEE7RIZkkuBzys/R3nycWDFK7AQY+8Gm9EMWVSDcDHz8bbJudzk0FgUzgFfahwI5l5Zqi1Sf s38CGxd9zeIUyX0qAwCQDru4L4BKH4gzI1sUY4UipBO2nN5LQGNm+z+BqhBBj6u0YRfYhxKpEew4n XEYG5CC8FRlQJk4zeRt/mtWTvxnclVIc1Boc58YBnpdimSwzan3uYrH89Ub2yMdjdGohLkrtEw7HX SY8NZqJnA3FXY1zfU96qYw==; In-Reply-To: <23dfc3fde8677a984b4c37a40d09d83b@finder.org> (message from Jared Finder on Sat, 04 Jan 2025 14:12:00 -0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327707 Archived-At: > Date: Sat, 04 Jan 2025 14:12:00 -0800 > From: Jared Finder > Cc: Eli Zaretskii , 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.