unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
@ 2020-11-29 21:33 João Távora
  2020-11-30  3:28 ` Eli Zaretskii
  0 siblings, 1 reply; 24+ messages in thread
From: João Távora @ 2020-11-29 21:33 UTC (permalink / raw)
  To: emacs-devel

Hi all,

Lately I've become a fan of Emacs -nw (or TTY Emacs as some know it) [1]

Recently, I've noticed that even mouse-triggered menus are supported and
work surprisingly well when the mouse pointer enters the window of the
terminal emulator which is running Emacs.  Really great work!  I've also
noticed that the `help-echo` that I place in a overlay is also correctly
triggered by hovering my mouse over that overlay.  All of this happens
out-of-the-box with little or no configuration (that I'm aware of), both
in the urxvt terminal emulator on GNU/Linux and using iTerm2 or Terminal
on Mac OS.

The only thing that's now sorely missing is the temporary highlighting
with 'mouse-face'.  Doesn't it make sense to also support this?  How
would I go about adding this feature to Emacs master?  Or is it somehow
available already via a configuration switch that I'm not aware of?
It'd really help in my new Emacs extension.

Thanks in advance,
João

[1] I've learned to live with the limitations in certain keybindings.
Plus, the 'emacsclient' integration is really hard to beat, especially
with a script that I've adapted from Phil Jackson's almost
lost-in-the-internet Emacs hacks website:

http://web.archive.org/web/20070703163718/http://www.shellarchive.co.uk/Emacs.html

Ping me if you'd like to see my version.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2020-11-30  3:28 UTC (permalink / raw)
  To: João Távora; +Cc: emacs-devel

> From: João Távora <joaotavora@gmail.com>
> Date: Sun, 29 Nov 2020 21:33:25 +0000
> 
> The only thing that's now sorely missing is the temporary highlighting
> with 'mouse-face'.  Doesn't it make sense to also support this?

It's already supported, but maybe not with every text-mode mouse
interface.

What kind of "TTY mouse" support are you using?  Is that xt-mouse, per
chance?



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2020-11-30  3:28 ` Eli Zaretskii
@ 2020-11-30  8:21   ` João Távora
  2020-11-30 16:09     ` Eli Zaretskii
  0 siblings, 1 reply; 24+ messages in thread
From: João Távora @ 2020-11-30  8:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> What kind of "TTY mouse" support are you using?  Is that xt-mouse, per
> chance?

Indeed, I've just noticed all that I described before doesn't out of the
box with Emacs -Q -nw.  Yes, I'm have xterm-mouse-mode, defined in
xt-mouse.el, set to t, so I think that counts as a yes.

So am I out of luck?  Or can something like this be turned on and/or
added to xt-mouse.el?

My terminal is Mac OS iTerm2.  I've just noticed that on rxvt-unicode on
Debian, mouse menus do work but help-echo doesn't.

This is with Emacs -Q -nw -f xterm-mouse-mode.

Thanks,
João





^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2020-11-30 16:09 UTC (permalink / raw)
  To: João Távora, Jared Finder; +Cc: emacs-devel

> From: João Távora <joaotavora@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Mon, 30 Nov 2020 08:21:19 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > What kind of "TTY mouse" support are you using?  Is that xt-mouse, per
> > chance?
> 
> Indeed, I've just noticed all that I described before doesn't out of the
> box with Emacs -Q -nw.  Yes, I'm have xterm-mouse-mode, defined in
> xt-mouse.el, set to t, so I think that counts as a yes.
> 
> So am I out of luck?  Or can something like this be turned on and/or
> added to xt-mouse.el?

I'm not sure.  Is this Emacs 28? if not, try the master code, as
xt-mouse got several improvements lately.

If you are already using a recent master branch, maybe this is
something else xt-mouse should learn to support?  Jared, can you chime
in, please?



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2020-11-30 16:09     ` Eli Zaretskii
@ 2020-11-30 16:25       ` João Távora
  2020-11-30 16:43         ` Eli Zaretskii
  0 siblings, 1 reply; 24+ messages in thread
From: João Távora @ 2020-11-30 16:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Jared Finder, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> I'm not sure.  Is this Emacs 28? if not, try the master code, as
> xt-mouse got several improvements lately.

It is master.

> If you are already using a recent master branch, maybe this is
> something else xt-mouse should learn to support?  Jared, can you chime
> in, please?

In the meantime, I've been doing some printf debugging with xdisp.c and
found that hovering over the text does call note_mouse_highlight() and
mouse_face_from_buffer_pos() in xdisp.c.  Per the docstring of
display--update-for-mouse-movement, both mouse-face and help-echo seem
to be reasonably independent from the remaining mouse-tracking stuff.

note_mouse_highlight() seems to be the entry point for this, and it
seems to be mostly doing its job provided I enter xterm-mouse-mode.  So
I would dare say that the problem is not in xt-mouse.el.

To recap, help-echo works fine, but mouse-face is somehow missing (on
TTY only).

Thanks,
João



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 2 replies; 24+ messages in thread
From: Eli Zaretskii @ 2020-11-30 16:43 UTC (permalink / raw)
  To: João Távora; +Cc: jared, emacs-devel

> From: João Távora <joaotavora@gmail.com>
> Cc: Jared Finder <jared@finder.org>,  emacs-devel@gnu.org
> Date: Mon, 30 Nov 2020 16:25:37 +0000
> 
> To recap, help-echo works fine, but mouse-face is somehow missing (on
> TTY only).

It works for me on the w32 TTY, so something else is at work here.
More debugging is needed, I think.  Specifically, note_mouse_highlight
is supposed to redraw some of the glyphs with the mouse-face.  If the
function is called, please step through it and try to figure out why
the redrawing doesn't happen -- what prevents that?




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  1 sibling, 0 replies; 24+ messages in thread
From: João Távora @ 2020-11-30 16:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Jared Finder, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

On Mon, Nov 30, 2020 at 4:43 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: João Távora <joaotavora@gmail.com>
> > Cc: Jared Finder <jared@finder.org>,  emacs-devel@gnu.org
> > Date: Mon, 30 Nov 2020 16:25:37 +0000
> >
> > To recap, help-echo works fine, but mouse-face is somehow missing (on
> > TTY only).
>
> It works for me on the w32 TTY, so something else is at work here.
> More debugging is needed, I think.  Specifically, note_mouse_highlight
> is supposed to redraw some of the glyphs with the mouse-face.  If the
> function is called, please step through it and try to figure out why
> the redrawing doesn't happen -- what prevents that?

Stepping is currently hard for me, but putting a silly fprintf(stderr
is doable, so can you tell me exactly the code that you expect
to really "draw it"?  Then I can work back from there.

João

[-- Attachment #2: Type: text/html, Size: 1182 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  1 sibling, 1 reply; 24+ messages in thread
From: João Távora @ 2020-11-30 18:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jared, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: João Távora <joaotavora@gmail.com>
>> Cc: Jared Finder <jared@finder.org>,  emacs-devel@gnu.org
>> Date: Mon, 30 Nov 2020 16:25:37 +0000
>> 
>> To recap, help-echo works fine, but mouse-face is somehow missing (on
>> TTY only).
>
> It works for me on the w32 TTY, so something else is at work here.
> More debugging is needed, I think.  Specifically, note_mouse_highlight
> is supposed to redraw some of the glyphs with the mouse-face.  If the
> function is called, please step through it and try to figure out why
> the redrawing doesn't happen -- what prevents that?

I think I figured it out.  draw_row_with_mouse_face() is eventually
called by show_mouse_face(), but it is a noop on my system.  Easy to
see:

static void
draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row,
			  int start_hpos, int end_hpos,
			  enum draw_glyphs_face draw)
{
#ifdef HAVE_WINDOW_SYSTEM
   ...
#endif
#if defined (HAVE_GPM) || defined (MSDOS) || defined (WINDOWSNT)
  tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw);
#endif
}


I'm currently using Mac OS.  Most of the TTY things work here, and I
would expect drawing some face on a part of the screen to work too.  I
can certainly show and hide faces programatically.

I've tried uncommenting that, but it fails during linking.

João





^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2020-11-30 18:24 UTC (permalink / raw)
  To: João Távora; +Cc: jared, emacs-devel

> From: João Távora <joaotavora@gmail.com>
> Cc: jared@finder.org,  emacs-devel@gnu.org
> Date: Mon, 30 Nov 2020 18:05:07 +0000
> 
> I think I figured it out.  draw_row_with_mouse_face() is eventually
> called by show_mouse_face(), but it is a noop on my system.  Easy to
> see:
> 
> static void
> draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row,
> 			  int start_hpos, int end_hpos,
> 			  enum draw_glyphs_face draw)
> {
> #ifdef HAVE_WINDOW_SYSTEM
>    ...
> #endif
> #if defined (HAVE_GPM) || defined (MSDOS) || defined (WINDOWSNT)
>   tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw);
> #endif
> }
> 
> 
> I'm currently using Mac OS.  Most of the TTY things work here, and I
> would expect drawing some face on a part of the screen to work too.  I
> can certainly show and hide faces programatically.
> 
> I've tried uncommenting that, but it fails during linking.

You need to implement tty_draw_row_with_mouse_face for macOS terminal.
Look at the other implementations, it should be easy.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2020-11-30 18:24             ` Eli Zaretskii
@ 2020-11-30 18:28               ` João Távora
  2020-11-30 18:58                 ` Eli Zaretskii
  0 siblings, 1 reply; 24+ messages in thread
From: João Távora @ 2020-11-30 18:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jared, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> I'm currently using Mac OS.  Most of the TTY things work here, and I
>> would expect drawing some face on a part of the screen to work too.  I
>> can certainly show and hide faces programatically.
>> 
>> I've tried uncommenting that, but it fails during linking.
>
> 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?

Anyway, some good news: things are moving fast on master indeed.  I just
recompiled for GNU/Linux and the problem doesn't happen: I get the
mouse-face highlighting as expected.

João



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2020-11-30 18:58 UTC (permalink / raw)
  To: João Távora; +Cc: jared, emacs-devel

> 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.

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.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2020-11-30 18:58                 ` Eli Zaretskii
@ 2020-11-30 19:09                   ` João Távora
  2020-11-30 20:07                     ` Stefan Monnier
  2020-12-01  7:10                     ` Jared Finder via Emacs development discussions.
  0 siblings, 2 replies; 24+ messages in thread
From: João Távora @ 2020-11-30 19:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jared, emacs-devel

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.  */



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2020-11-30 19:09                   ` João Távora
@ 2020-11-30 20:07                     ` Stefan Monnier
  2020-12-01  7:10                     ` Jared Finder via Emacs development discussions.
  1 sibling, 0 replies; 24+ messages in thread
From: Stefan Monnier @ 2020-11-30 20:07 UTC (permalink / raw)
  To: João Távora; +Cc: Eli Zaretskii, jared, emacs-devel

> -#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

I think the whole #if` conditional should be removed now.


        Stefan




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2020-11-30 19:09                   ` João Távora
  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
  1 sibling, 1 reply; 24+ messages in thread
From: Jared Finder via Emacs development discussions. @ 2020-12-01  7:10 UTC (permalink / raw)
  To: João Távora; +Cc: Eli Zaretskii, emacs-devel

On 2020-11-30 11:09 am, João Távora wrote:
> [... email contents elided ...]

This email chain makes me wonder if other code paths that are currently 
hidden behind HAVE_GPM that should now be enabled.

I found the following two suspect lines that sound related, but it's 
unclear to me what they're for.  Does anyone know what functionality 
they enable?  (Note: I have some local changes, so my line numbers may 
be slightly off.)

term.c:4253
   tty->mouse_highlight.mouse_face_window = Qnil;

xdisp.c:20783
	  gui_clear_window_mouse_face (w);


Additionally, it looks like set-mouse-position and 
set-mouse-pixel-position in frame.c does not behave consistently on TTYs 
if Emacs is compiled with window system support vs without.  I assume 
that should be fixed.

   -- MJF



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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.
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2020-12-01 18:20 UTC (permalink / raw)
  To: Jared Finder; +Cc: joaotavora, emacs-devel

> Date: Mon, 30 Nov 2020 23:10:54 -0800
> From: Jared Finder <jared@finder.org>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> 
> I found the following two suspect lines that sound related, but it's 
> unclear to me what they're for.  Does anyone know what functionality 
> they enable?  (Note: I have some local changes, so my line numbers may 
> be slightly off.)
> 
> term.c:4253
>    tty->mouse_highlight.mouse_face_window = Qnil;
> 
> xdisp.c:20783
> 	  gui_clear_window_mouse_face (w);

They are necessary parts of mouse-highlight implementation, and should
be indeed enabled in all builds nowadays.

> Additionally, it looks like set-mouse-position and 
> set-mouse-pixel-position in frame.c does not behave consistently on TTYs 
> if Emacs is compiled with window system support vs without.

You mean, if Emacs is compiled with X _and_ with GPM?  Otherwise I
don't think I see the issue.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Jared Finder via Emacs development discussions. @ 2020-12-02  8:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: joaotavora, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]

On 2020-12-01 10:20 am, Eli Zaretskii wrote:
>> Date: Mon, 30 Nov 2020 23:10:54 -0800
>> From: Jared Finder <jared@finder.org>
>> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
>> 
>> I found the following two suspect lines that sound related, but it's
>> unclear to me what they're for.  Does anyone know what functionality
>> they enable?  (Note: I have some local changes, so my line numbers may
>> be slightly off.)
>> 
>> term.c:4253
>>    tty->mouse_highlight.mouse_face_window = Qnil;
>> 
>> xdisp.c:20783
>> 	  gui_clear_window_mouse_face (w);
> 
> They are necessary parts of mouse-highlight implementation, and should
> be indeed enabled in all builds nowadays.
> 
>> Additionally, it looks like set-mouse-position and
>> set-mouse-pixel-position in frame.c does not behave consistently on 
>> TTYs
>> if Emacs is compiled with window system support vs without.
> 
> You mean, if Emacs is compiled with X _and_ with GPM?  Otherwise I
> don't think I see the issue.

Yes that.  Also if none of the flags are defined, then Fselect_frame is 
not called.  This is independent of if GPM is enabled or not.


Attached is a patch that addresses the above issues.  I was able to 
verify that this make set-mouse-position and set-mouse-pixel-position 
select frames if HAS_GPM is not defined.  I was not able to notice any 
difference when always setting mouse_face_window.

I'd appreciate if someone could test the changes to set-mouse-position 
on MSDOS and with window systems enabled as I can not test that 
environment.

   -- MJF

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Remove-incorrect-usage-of-HAVE_GPM.patch --]
[-- Type: text/x-diff; name=0001-Remove-incorrect-usage-of-HAVE_GPM.patch, Size: 3673 bytes --]

From 41fa47d4315a998ea1116f0d9f898eeaaad51c0b Mon Sep 17 00:00:00 2001
From: Jared Finder <jared@finder.org>
Date: Wed, 2 Dec 2020 00:05:59 -0800
Subject: [PATCH] Remove incorrect usage of HAVE_GPM.

* src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call
Fselect_frame in all terminals, independent of defines.
* src/term.c (init_tty): Initialize mouse_face_window for all
terminals.
* src/xdisp.c (try_window_id): Call gui_clear_window_mouse_face in all
cases.
---
 src/frame.c | 36 ++++++++++++++++++++++++------------
 src/term.c  |  2 +-
 src/xdisp.c |  3 +--
 3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/frame.c b/src/frame.c
index 17ec455d2d..4bbcb74667 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2574,22 +2574,28 @@ DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (XFRAME (frame)))
-    /* Warping the mouse will cause enternotify and focus events.  */
-    frame_set_mouse_position (XFRAME (frame), xval, yval);
-#elif defined MSDOS
+    {
+      /* Warping the mouse will cause enternotify and focus events.  */
+      frame_set_mouse_position (XFRAME (frame), xval, yval);
+      return Qnil;
+    }
+#endif /* HAVE_WINDOW_SYSTEM */
+#ifdef MSDOS
   if (FRAME_MSDOS_P (XFRAME (frame)))
     {
       Fselect_frame (frame, Qnil);
       mouse_moveto (xval, yval);
+      return Qnil;
     }
-#elif defined HAVE_GPM
+#endif /* MSDOS */
+
   Fselect_frame (frame, Qnil);
+#if defined (HAVE_GPM) && ! defined (HAVE_WINDOW_SYSTEM)
   term_mouse_moveto (xval, yval);
 #else
   (void) xval;
   (void) yval;
-#endif
-
+#endif /* HAVE_GPM && ! HAVE_WINDOW_SYSTEM */
   return Qnil;
 }
 
@@ -2612,22 +2618,28 @@ DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position,
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (XFRAME (frame)))
-    /* Warping the mouse will cause enternotify and focus events.  */
-    frame_set_mouse_pixel_position (XFRAME (frame), xval, yval);
-#elif defined MSDOS
+    {
+      /* Warping the mouse will cause enternotify and focus events.  */
+      frame_set_mouse_pixel_position (XFRAME (frame), xval, yval);
+      return Qnil;
+    }
+#endif /* HAVE_WINDOW_SYSTEM */
+#ifdef MSDOS
   if (FRAME_MSDOS_P (XFRAME (frame)))
     {
       Fselect_frame (frame, Qnil);
       mouse_moveto (xval, yval);
+      return Qnil;
     }
-#elif defined HAVE_GPM
+#endif /* MSDOS */
+
   Fselect_frame (frame, Qnil);
+#if defined (HAVE_GPM) && ! defined (HAVE_WINDOW_SYSTEM)
   term_mouse_moveto (xval, yval);
 #else
   (void) xval;
   (void) yval;
-#endif
-
+#endif /* HAVE_GPM && ! HAVE_WINDOW_SYSTEM */
   return Qnil;
 }
 \f
diff --git a/src/term.c b/src/term.c
index fee3b55575..dfdc3bce7e 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4246,8 +4246,8 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
 
 #ifdef HAVE_GPM
   terminal->mouse_position_hook = term_mouse_position;
-  tty->mouse_highlight.mouse_face_window = Qnil;
 #endif
+  tty->mouse_highlight.mouse_face_window = Qnil;
 
   terminal->kboard = allocate_kboard (Qnil);
   terminal->kboard->reference_count++;
diff --git a/src/xdisp.c b/src/xdisp.c
index 76ef420a36..498e6f1065 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20779,9 +20779,8 @@ #define GIVE_UP(X) return 0
 		     + window_wants_header_line (w)
 		     + window_internal_height (w));
 
-#if defined (HAVE_GPM) || defined (MSDOS)
 	  gui_clear_window_mouse_face (w);
-#endif
+
 	  /* Perform the operation on the screen.  */
 	  if (dvpos > 0)
 	    {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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.
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2020-12-05 10:39 UTC (permalink / raw)
  To: Jared Finder; +Cc: joaotavora, emacs-devel

> Date: Wed, 02 Dec 2020 00:40:01 -0800
> From: Jared Finder <jared@finder.org>
> Cc: joaotavora@gmail.com, emacs-devel@gnu.org
> 
> * src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call
> Fselect_frame in all terminals, independent of defines.

Maybe I'm missing something, but I don't see how the proposed changes
cause Fselect_frame to be called fore any display type.

> diff --git a/src/frame.c b/src/frame.c
> index 17ec455d2d..4bbcb74667 100644
> --- a/src/frame.c
> +++ b/src/frame.c
> @@ -2574,22 +2574,28 @@ DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
>    /* I think this should be done with a hook.  */
>  #ifdef HAVE_WINDOW_SYSTEM
>    if (FRAME_WINDOW_P (XFRAME (frame)))
> -    /* Warping the mouse will cause enternotify and focus events.  */
> -    frame_set_mouse_position (XFRAME (frame), xval, yval);
> -#elif defined MSDOS
> +    {
> +      /* Warping the mouse will cause enternotify and focus events.  */
> +      frame_set_mouse_position (XFRAME (frame), xval, yval);
> +      return Qnil;
> +    }
> +#endif /* HAVE_WINDOW_SYSTEM */
> +#ifdef MSDOS
>    if (FRAME_MSDOS_P (XFRAME (frame)))
>      {
>        Fselect_frame (frame, Qnil);
>        mouse_moveto (xval, yval);
> +      return Qnil;
>      }

Can we do this without introducing multiple return points?  if nothing
else, that makes it harder to assess correctness and harder to debug
the code.

> +#if defined (HAVE_GPM) && ! defined (HAVE_WINDOW_SYSTEM)
>    term_mouse_moveto (xval, yval);
>  #else

The additional HAVE_WINDOW_SYSTEM condition is because
term_mouse_moveto is conditioned the same on term.c?  If so, I think
we should remove the HAVE_WINDOW_SYSTEM part there as well: there's no
reason why a --with-x build couldn't also support GPM.

Thanks.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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.
  0 siblings, 1 reply; 24+ messages in thread
From: Jared Finder via Emacs development discussions. @ 2020-12-08  5:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: joaotavora, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 678 bytes --]

On 2020-12-05 2:39 am, Eli Zaretskii wrote:
>> Date: Wed, 02 Dec 2020 00:40:01 -0800
>> From: Jared Finder <jared@finder.org>
>> Cc: joaotavora@gmail.com, emacs-devel@gnu.org
>> 
>> * src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call
>> Fselect_frame in all terminals, independent of defines.
> 
> Maybe I'm missing something, but I don't see how the proposed changes
> cause Fselect_frame to be called fore any display type.

Perhaps I'm using the wrong terminology?  It causes Fselect_frame to be 
called for all terminals, a.k.a *non-graphical* displays, a.k.a. the 
display you get when you specify -nw.

Other comments addressed, patch attached.

   -- MJF

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Remove-incorrect-usage-of-HAVE_GPM.patch --]
[-- Type: text/x-diff; name=0001-Remove-incorrect-usage-of-HAVE_GPM.patch, Size: 5049 bytes --]

From 0998426869aecdf26ae834feeed18c5ca235ef51 Mon Sep 17 00:00:00 2001
From: Jared Finder <jared@finder.org>
Date: Wed, 2 Dec 2020 00:05:59 -0800
Subject: [PATCH] Remove incorrect usage of HAVE_GPM.

* src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call
Fselect_frame and appropriate mouse_moveto function in all terminals,
independent of defines.
* src/term.c (init_tty): Initialize mouse_face_window for all
terminals.
(term_mouse_moveto): Make available even if HAVE_WINDOW_SYSTEM is
defined.
* src/xdisp.c (try_window_id): Call gui_clear_window_mouse_face in all
cases.
---
 src/frame.c     | 59 +++++++++++++++++++++++++++++++------------------
 src/term.c      |  4 +---
 src/termhooks.h |  2 --
 src/xdisp.c     |  3 +--
 4 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/src/frame.c b/src/frame.c
index 17ec455d2d..12e3763fe0 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2572,23 +2572,30 @@ DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
   int yval = check_integer_range (y, INT_MIN, INT_MAX);
 
   /* I think this should be done with a hook.  */
-#ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (XFRAME (frame)))
-    /* Warping the mouse will cause enternotify and focus events.  */
-    frame_set_mouse_position (XFRAME (frame), xval, yval);
-#elif defined MSDOS
-  if (FRAME_MSDOS_P (XFRAME (frame)))
+    {
+#ifdef HAVE_WINDOW_SYSTEM
+      /* Warping the mouse will cause enternotify and focus events.  */
+      frame_set_mouse_position (XFRAME (frame), xval, yval);
+#endif /* HAVE_WINDOW_SYSTEM */
+    }
+  else if (FRAME_MSDOS_P (XFRAME (frame)))
     {
       Fselect_frame (frame, Qnil);
+#ifdef MSDOS
       mouse_moveto (xval, yval);
+#endif /* MSDOS */
     }
-#elif defined HAVE_GPM
-  Fselect_frame (frame, Qnil);
-  term_mouse_moveto (xval, yval);
+  else
+    {
+      Fselect_frame (frame, Qnil);
+#ifdef HAVE_GPM
+      term_mouse_moveto (xval, yval);
 #else
-  (void) xval;
-  (void) yval;
-#endif
+      (void) xval;
+      (void) yval;
+#endif /* HAVE_GPM */
+    }
 
   return Qnil;
 }
@@ -2610,23 +2617,31 @@ DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position,
   int yval = check_integer_range (y, INT_MIN, INT_MAX);
 
   /* I think this should be done with a hook.  */
-#ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (XFRAME (frame)))
-    /* Warping the mouse will cause enternotify and focus events.  */
-    frame_set_mouse_pixel_position (XFRAME (frame), xval, yval);
-#elif defined MSDOS
-  if (FRAME_MSDOS_P (XFRAME (frame)))
+    {
+      /* Warping the mouse will cause enternotify and focus events.  */
+#ifdef HAVE_WINDOW_SYSTEM
+      frame_set_mouse_pixel_position (XFRAME (frame), xval, yval);
+#endif /* HAVE_WINDOW_SYSTEM */
+    }
+  else if (FRAME_MSDOS_P (XFRAME (frame)))
     {
       Fselect_frame (frame, Qnil);
+#ifdef MSDOS
       mouse_moveto (xval, yval);
+#endif /* MSDOS */
     }
-#elif defined HAVE_GPM
-  Fselect_frame (frame, Qnil);
-  term_mouse_moveto (xval, yval);
+  else
+    {
+      Fselect_frame (frame, Qnil);
+#ifdef HAVE_GPM
+      term_mouse_moveto (xval, yval);
 #else
-  (void) xval;
-  (void) yval;
-#endif
+      (void) xval;
+      (void) yval;
+#endif /* HAVE_GPM */
+
+    }
 
   return Qnil;
 }
diff --git a/src/term.c b/src/term.c
index fee3b55575..2437749d19 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2382,7 +2382,6 @@ DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
 
 #ifdef HAVE_GPM
 
-#ifndef HAVE_WINDOW_SYSTEM
 void
 term_mouse_moveto (int x, int y)
 {
@@ -2396,7 +2395,6 @@ term_mouse_moveto (int x, int y)
   last_mouse_x = x;
   last_mouse_y = y;  */
 }
-#endif /* HAVE_WINDOW_SYSTEM */
 
 /* Implementation of draw_row_with_mouse_face for TTY/GPM.  */
 void
@@ -4246,8 +4244,8 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
 
 #ifdef HAVE_GPM
   terminal->mouse_position_hook = term_mouse_position;
-  tty->mouse_highlight.mouse_face_window = Qnil;
 #endif
+  tty->mouse_highlight.mouse_face_window = Qnil;
 
   terminal->kboard = allocate_kboard (Qnil);
   terminal->kboard->reference_count++;
diff --git a/src/termhooks.h b/src/termhooks.h
index 44ab14225f..7ffab7e86f 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -367,9 +367,7 @@ #define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event))
 #ifdef HAVE_GPM
 #include <gpm.h>
 extern int handle_one_term_event (struct tty_display_info *, Gpm_Event *);
-#ifndef HAVE_WINDOW_SYSTEM
 extern void term_mouse_moveto (int, int);
-#endif
 
 /* The device for which we have enabled gpm support.  */
 extern struct tty_display_info *gpm_tty;
diff --git a/src/xdisp.c b/src/xdisp.c
index 76ef420a36..498e6f1065 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20779,9 +20779,8 @@ #define GIVE_UP(X) return 0
 		     + window_wants_header_line (w)
 		     + window_internal_height (w));
 
-#if defined (HAVE_GPM) || defined (MSDOS)
 	  gui_clear_window_mouse_face (w);
-#endif
+
 	  /* Perform the operation on the screen.  */
 	  if (dvpos > 0)
 	    {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Jared Finder via Emacs development discussions. @ 2021-01-16  5:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: joaotavora, emacs-devel

It seems like these set of patches got lost. Joao, Eli, is this no 
longer valuable?

   -- MJF

On 2020-12-07 9:46 pm, Jared Finder wrote:
> On 2020-12-05 2:39 am, Eli Zaretskii wrote:
>>> Date: Wed, 02 Dec 2020 00:40:01 -0800
>>> From: Jared Finder <jared@finder.org>
>>> Cc: joaotavora@gmail.com, emacs-devel@gnu.org
>>> 
>>> * src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call
>>> Fselect_frame in all terminals, independent of defines.
>> 
>> Maybe I'm missing something, but I don't see how the proposed changes
>> cause Fselect_frame to be called fore any display type.
> 
> Perhaps I'm using the wrong terminology?  It causes Fselect_frame to
> be called for all terminals, a.k.a *non-graphical* displays, a.k.a.
> the display you get when you specify -nw.
> 
> Other comments addressed, patch attached.
> 
>   -- MJF



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2021-01-16  7:53 UTC (permalink / raw)
  To: Jared Finder; +Cc: joaotavora, emacs-devel

> Date: Fri, 15 Jan 2021 21:31:59 -0800
> From: Jared Finder <jared@finder.org>
> Cc: joaotavora@gmail.com, emacs-devel@gnu.org
> 
> It seems like these set of patches got lost. Joao, Eli, is this no 
> longer valuable?

It isn't lost, it is still in my queue.  Sorry for being such a slow
patch-processing machine.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2021-01-16  7:53                                 ` Eli Zaretskii
@ 2021-01-16 13:06                                   ` Eli Zaretskii
  2021-01-16 22:27                                     ` jared--- via Emacs development discussions.
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2021-01-16 13:06 UTC (permalink / raw)
  To: jared; +Cc: joaotavora, emacs-devel

> Date: Sat, 16 Jan 2021 09:53:02 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: joaotavora@gmail.com, emacs-devel@gnu.org
> 
> > Date: Fri, 15 Jan 2021 21:31:59 -0800
> > From: Jared Finder <jared@finder.org>
> > Cc: joaotavora@gmail.com, emacs-devel@gnu.org
> > 
> > It seems like these set of patches got lost. Joao, Eli, is this no 
> > longer valuable?
> 
> It isn't lost, it is still in my queue.  Sorry for being such a slow
> patch-processing machine.

I installed that changeset now, with a small followup change: I see no
need in this case to have code that checks FRAME_MSDOS_P outside of
the #ifdef MSDOS conditional, as the former will never happen there,
and the number of #ifdef's would not be smaller anyway.

Thanks.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2021-01-16 13:06                                   ` Eli Zaretskii
@ 2021-01-16 22:27                                     ` jared--- via Emacs development discussions.
  2021-01-22 12:20                                       ` Eli Zaretskii
  0 siblings, 1 reply; 24+ messages in thread
From: jared--- via Emacs development discussions. @ 2021-01-16 22:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: joaotavora, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]

On 2021-01-16 5:06 am, Eli Zaretskii wrote:
>> Date: Sat, 16 Jan 2021 09:53:02 +0200
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: joaotavora@gmail.com, emacs-devel@gnu.org
>> 
>> > Date: Fri, 15 Jan 2021 21:31:59 -0800
>> > From: Jared Finder <jared@finder.org>
>> > Cc: joaotavora@gmail.com, emacs-devel@gnu.org
>> >
>> > It seems like these set of patches got lost. Joao, Eli, is this no
>> > longer valuable?
>> 
>> It isn't lost, it is still in my queue.  Sorry for being such a slow
>> patch-processing machine.
> 
> I installed that changeset now, with a small followup change: I see no
> need in this case to have code that checks FRAME_MSDOS_P outside of
> the #ifdef MSDOS conditional, as the former will never happen there,
> and the number of #ifdef's would not be smaller anyway.
> 
> Thanks.

Thanks.  It looks like Joao's patch earlier in the thread slipped 
through the cracks.  To make things easy, I created a patch file with a 
changelog for Joao.  (He authored the patch, not I.)  Attached.

   -- MJF

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Enable-TTY-mouse-face-support-when-built-without-GPM.patch --]
[-- Type: text/x-diff; name=0001-Enable-TTY-mouse-face-support-when-built-without-GPM.patch, Size: 2866 bytes --]

From 801eb8f478e1617f3c49de16aba7d4de4163ccd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= <joaotavora@gmail.com>
Date: Sat, 16 Jan 2021 14:17:58 -0800
Subject: [PATCH] Enable TTY mouse-face support when built without GPM support

* src/term.c (tty_write_glyphs_with_face): Move definition out of
ifdef block.
* src/xdisp.c (draw_row_with_mouse_face): Move call to
tty_draw_row_with_mouse_face out of ifdef block.
---
 src/term.c  | 35 ++++++++++++++++-------------------
 src/xdisp.c |  3 +--
 2 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/src/term.c b/src/term.c
index 2e2ab2bf43..37c06a560d 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,22 +2377,6 @@ DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
 			       Mouse
  ***********************************************************************/
 
-#ifdef HAVE_GPM
-
-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;  */
-}
-
 /* Implementation of draw_row_with_mouse_face for TTY/GPM.  */
 void
 tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
@@ -2428,6 +2409,22 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
   cursor_to (f, save_y, save_x);
 }
 
+#ifdef HAVE_GPM
+
+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;  */
+}
+
 /* 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 32e9773b54..e1e4ff4136 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -31927,9 +31927,8 @@ 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)
+
   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.  */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2021-01-22 12:20 UTC (permalink / raw)
  To: Jared Finder; +Cc: joaotavora, emacs-devel

> Date: Sat, 16 Jan 2021 14:27:08 -0800
> From: Jared Finder <jared@finder.org>
> Cc: joaotavora@gmail.com, emacs-devel@gnu.org
> 
> Thanks.  It looks like Joao's patch earlier in the thread slipped 
> through the cracks.  To make things easy, I created a patch file with a 
> changelog for Joao.  (He authored the patch, not I.)  Attached.

Thanks, I somehow thought João installed that.

I installed it now, together with a followup change that was needed
for DOS_NT systems.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
  2021-01-22 12:20                                       ` Eli Zaretskii
@ 2021-01-22 16:47                                         ` João Távora
  0 siblings, 0 replies; 24+ messages in thread
From: João Távora @ 2021-01-22 16:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Jared Finder, emacs-devel

On Fri, Jan 22, 2021 at 12:20 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > Date: Sat, 16 Jan 2021 14:27:08 -0800
> > From: Jared Finder <jared@finder.org>
> > Cc: joaotavora@gmail.com, emacs-devel@gnu.org
> >
> > Thanks.  It looks like Joao's patch earlier in the thread slipped
> > through the cracks.  To make things easy, I created a patch file with a
> > changelog for Joao.  (He authored the patch, not I.)  Attached.
>
> Thanks, I somehow thought João installed that.

No sorry, I lost track of this, too, was waiting for approval,
or something.

> I installed it now, together with a followup change that was needed
> for DOS_NT systems.

Thanks!

João



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-01-22 16:47 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).