From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs Date: Mon, 30 Nov 2020 19:09:38 +0000 Message-ID: References: <838sajle0s.fsf@gnu.org> <83v9dmker4.fsf@gnu.org> <83h7p6kd74.fsf@gnu.org> <837dq2k8ik.fsf@gnu.org> <87eekag0n3.fsf@gmail.com> <83zh2yisdt.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20308"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: jared@finder.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 30 20:10:44 2020 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 1kjoZP-0005CZ-RJ for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Nov 2020 20:10:43 +0100 Original-Received: from localhost ([::1]:52186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kjoZO-0000LO-TF for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Nov 2020 14:10:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kjoYW-0008EI-Mf for emacs-devel@gnu.org; Mon, 30 Nov 2020 14:09:48 -0500 Original-Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:53146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kjoYS-0007zE-PZ; Mon, 30 Nov 2020 14:09:48 -0500 Original-Received: by mail-wm1-x336.google.com with SMTP id a6so408040wmc.2; Mon, 30 Nov 2020 11:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=jvBnNmBs4dNyvD/zyTku5utiAxpGaFiidYNAjm969s4=; b=sEvjeXup9MYE80MF3eYF8hKTmxqX6rtarHRPVoquyREwYyc3u7LD8MHRnNdb3IRp33 LIYx35S0aoVxy7n0WTMV7TZKtThheECuqJy8Jk6eStqN1WJk2RzsXHTa05QlLuYidttm SRMwUshChlNdMHQCLGQFmOZaAmpfmO74jd/DbQHxCcm7X0gm1f0tmmZoSiTjcK9KLIkA i4YX2D2PdeQDVa2jmIYzoWmgdmhM+upj5HVACcoCdVhcsLloBuOkRR42u2mEFOUXUYjI 8tIooCG/grQYPUgndYHYdK3Pn6APbOlUExu/SJnkb5VT1BXianI4GyHwdo+QdeVzFBoq RR6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=jvBnNmBs4dNyvD/zyTku5utiAxpGaFiidYNAjm969s4=; b=PNndjIZaBS5bwgcyz6vPmFEPRd82jHmru8uhg3EGbYloR3K+AgvlHsvupmV5oM6Z4q S0+8MrgCoYvHwgEnzRVoPgy70y7FgzlYfZltRivkjE+ZDGIX0QDxojaRUvqlo7397dEF kophW8QT8bGWgBVpkPIZZMOC51dokTBcooUUzti8GFTgPwwpLtmHX0myXSM7nwgX9Rw7 9eZum99I9G2Ruy5YSBLn6XSrw+/qhLqLbpKjf28GdOa0BnvdqIikc/XTjXeuPYdqR0D7 fmgMLGcxsSGLlLAjn1UrUdE327nH9tmsyvUw+q1JK1I2us70DX/Ac0C1Yz1VoGgBxnI7 HDDg== X-Gm-Message-State: AOAM533w7xEcPpAFegLz8yVEbdnlJtADqI0jZnv2YQuYGjOJmp4kGZuY RdOheIp/Bubn0wMYiQviQKW4vDcNsU4= X-Google-Smtp-Source: ABdhPJxQOG7RKDO7WuIm3Bu6GYqevcQN+nf5o0lhAuL76Q3XHJ+fotlR4LsTmno6+7ugFz4pR+mUeA== X-Received: by 2002:a1c:3c09:: with SMTP id j9mr300568wma.180.1606763380432; Mon, 30 Nov 2020 11:09:40 -0800 (PST) Original-Received: from Joaos-MacBook-Pro.local ([89.180.149.21]) by smtp.gmail.com with ESMTPSA id f23sm266618wmb.43.2020.11.30.11.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 11:09:39 -0800 (PST) In-Reply-To: <83zh2yisdt.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Nov 2020 20:58:22 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:260093 Archived-At: Eli Zaretskii writes: >> From: Jo=C3=A3o T=C3=A1vora >> Cc: jared@finder.org, emacs-devel@gnu.org >> Date: Mon, 30 Nov 2020 18:28:16 +0000 >>=20 >> > You need to implement tty_draw_row_with_mouse_face for macOS terminal. >> > Look at the other implementations, it should be easy. >>=20 >> Thanks. In which file should I do that? I.e. how do I implement a C >> function for a specific terminal? > > I guess nsterm.m is the right place? Maybe wait for Alan to chime in. Yes, I look at it but that would be for graphical stuff right? > An alternative is to make the function in term.c be compiled on macOS, > I think the code there is fairly generic. Maybe this is the best way. > Assuming term.c gets compiled on macOS, that is. Yep, I tried that and it works like a charm! I just freed some code from the #ifdef HAVE_GPM shackles, and it compiled and linked cleanly. Which is just as well since I have no idea what these data structures are :-) Anyway, a patch after my sig, which I will use for a while Jo=C3=A3o diff --git a/src/term.c b/src/term.c index fee3b55575..178a73b6fc 100644 --- a/src/term.c +++ b/src/term.c @@ -790,8 +790,6 @@ tty_write_glyphs (struct frame *f, struct glyph *string= , int len) cmcheckmagic (tty); } =20 -#ifdef HAVE_GPM /* Only used by GPM code. */ - static void tty_write_glyphs_with_face (register struct frame *f, register struct glyp= h *string, register int len, register int face_id) @@ -847,7 +845,6 @@ tty_write_glyphs_with_face (register struct frame *f, r= egister struct glyph *str =20 cmcheckmagic (tty); } -#endif =20 /* An implementation of insert_glyphs for termcap frames. */ =20 @@ -2380,24 +2377,6 @@ DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1,= 0, Mouse ***********************************************************************/ =20 -#ifdef HAVE_GPM - -#ifndef HAVE_WINDOW_SYSTEM -void -term_mouse_moveto (int x, int y) -{ - /* TODO: how to set mouse position? - const char *name; - int fd; - name =3D (const char *) ttyname (0); - fd =3D emacs_open (name, O_WRONLY, 0); - SOME_FUNCTION (x, y, fd); - emacs_close (fd); - last_mouse_x =3D x; - last_mouse_y =3D y; */ -} -#endif /* HAVE_WINDOW_SYSTEM */ - /* Implementation of draw_row_with_mouse_face for TTY/GPM. */ void tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, @@ -2430,6 +2409,24 @@ tty_draw_row_with_mouse_face (struct window *w, stru= ct glyph_row *row, cursor_to (f, save_y, save_x); } =20 +#ifdef HAVE_GPM + +#ifndef HAVE_WINDOW_SYSTEM +void +term_mouse_moveto (int x, int y) +{ + /* TODO: how to set mouse position? + const char *name; + int fd; + name =3D (const char *) ttyname (0); + fd =3D emacs_open (name, O_WRONLY, 0); + SOME_FUNCTION (x, y, fd); + emacs_close (fd); + last_mouse_x =3D x; + last_mouse_y =3D y; */ +} +#endif /* HAVE_WINDOW_SYSTEM */ + /* Return the current time, as a Time value. Wrap around on overflow. */ static Time current_Time (void) diff --git a/src/xdisp.c b/src/xdisp.c index 76ef420a36..fc1ff9144c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -31836,9 +31836,11 @@ draw_row_with_mouse_face (struct window *w, int st= art_x, struct glyph_row *row, return; } #endif -#if defined (HAVE_GPM) || defined (MSDOS) || defined (WINDOWSNT) +#if defined (HAVE_GPM) || defined (MSDOS) || defined (WINDOWSNT) || \ + defined (DARWIN_OS) tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw); #endif + } =20 /* Display the active region described by mouse_face_* according to DRAW. = */