From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jared@finder.org, emacs-devel@gnu.org
Subject: Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
Date: Mon, 30 Nov 2020 19:09:38 +0000 [thread overview]
Message-ID: <m2y2ii7jbh.fsf@gmail.com> (raw)
In-Reply-To: <83zh2yisdt.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Nov 2020 20:58:22 +0200")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: João Távora <joaotavora@gmail.com>
>> Cc: jared@finder.org, emacs-devel@gnu.org
>> Date: Mon, 30 Nov 2020 18:28:16 +0000
>>
>> > You need to implement tty_draw_row_with_mouse_face for macOS terminal.
>> > Look at the other implementations, it should be easy.
>>
>> 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ão
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);
}
-#ifdef HAVE_GPM /* Only used by GPM code. */
-
static void
tty_write_glyphs_with_face (register struct frame *f, register struct glyph *string,
register int len, register int face_id)
@@ -847,7 +845,6 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str
cmcheckmagic (tty);
}
-#endif
/* An implementation of insert_glyphs for termcap frames. */
@@ -2380,24 +2377,6 @@ DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
Mouse
***********************************************************************/
-#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 = (const char *) ttyname (0);
- fd = emacs_open (name, O_WRONLY, 0);
- SOME_FUNCTION (x, y, fd);
- emacs_close (fd);
- last_mouse_x = x;
- last_mouse_y = 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, struct glyph_row *row,
cursor_to (f, save_y, save_x);
}
+#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 = (const char *) ttyname (0);
+ fd = emacs_open (name, O_WRONLY, 0);
+ SOME_FUNCTION (x, y, fd);
+ emacs_close (fd);
+ last_mouse_x = x;
+ last_mouse_y = 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 start_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
+
}
/* Display the active region described by mouse_face_* according to DRAW. */
next prev parent reply other threads:[~2020-11-30 19:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-29 21:33 Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs João Távora
2020-11-30 3:28 ` Eli Zaretskii
2020-11-30 8:21 ` João Távora
2020-11-30 16:09 ` Eli Zaretskii
2020-11-30 16:25 ` João Távora
2020-11-30 16:43 ` Eli Zaretskii
2020-11-30 16:47 ` João Távora
2020-11-30 18:05 ` João Távora
2020-11-30 18:24 ` Eli Zaretskii
2020-11-30 18:28 ` João Távora
2020-11-30 18:58 ` Eli Zaretskii
2020-11-30 19:09 ` João Távora [this message]
2020-11-30 20:07 ` Stefan Monnier
2020-12-01 7:10 ` Jared Finder via Emacs development discussions.
2020-12-01 18:20 ` Eli Zaretskii
2020-12-02 8:40 ` Jared Finder via Emacs development discussions.
2020-12-05 10:39 ` Eli Zaretskii
2020-12-08 5:46 ` Jared Finder via Emacs development discussions.
2021-01-16 5:31 ` Jared Finder via Emacs development discussions.
2021-01-16 7:53 ` Eli Zaretskii
2021-01-16 13:06 ` Eli Zaretskii
2021-01-16 22:27 ` jared--- via Emacs development discussions.
2021-01-22 12:20 ` Eli Zaretskii
2021-01-22 16:47 ` João Távora
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=m2y2ii7jbh.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jared@finder.org \
/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).