From: Jared Finder via "Emacs development discussions." <emacs-devel@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: joaotavora@gmail.com, emacs-devel@gnu.org
Subject: Re: Mouse-hovering over 'mouse-face' overlays/regions on a TTY Emacs
Date: Wed, 02 Dec 2020 00:40:01 -0800 [thread overview]
Message-ID: <5aff1d6ff795552203292395560a5075@finder.org> (raw)
In-Reply-To: <83o8jdgzgk.fsf@gnu.org>
[-- 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
next prev parent reply other threads:[~2020-12-02 8:40 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
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. [this message]
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=5aff1d6ff795552203292395560a5075@finder.org \
--to=emacs-devel@gnu.org \
--cc=eliz@gnu.org \
--cc=jared@finder.org \
--cc=joaotavora@gmail.com \
/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).