summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorJared Finder <jared@finder.org>2020-10-31 21:25:47 -0800
committerEli Zaretskii <eliz@gnu.org>2020-11-14 14:31:55 +0200
commit91d5edd9d10db30418cb32f5734d496d76ef56f3 (patch)
tree3f21bae82386a7b9f976d483ef3b68cf387a9f0f /src/term.c
parent31f94e4b1c3dc201646ec436d3e2c477f784ed21 (diff)
downloademacs-91d5edd9d10db30418cb32f5734d496d76ef56f3.tar.gz
Face-changing text properties and help-echo now work with xterm-mouse.
* src/dispnew.c (update_mouse_position): New function for mouse movement logic in 'handle_one_term_event' that can be shared across different mouse backends. (display--update-for-mouse-movement): New lisp function, call it. * lisp/xt-mouse.el (xterm-mouse--handle-mouse-movement): New function that calls 'display--update-for-mouse-movement'. (xterm-mouse-translate-1): Call it. * src/term.c (handle_one_term_event): Inline logic from 'term_mouse_movement' and call 'update_mouse_position'. (term_mouse_movement): Delete.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c52
1 files changed, 14 insertions, 38 deletions
diff --git a/src/term.c b/src/term.c
index 3a13da165e5..a0738594bfc 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2430,22 +2430,6 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
cursor_to (f, save_y, save_x);
}
-static bool
-term_mouse_movement (struct frame *frame, Gpm_Event *event)
-{
- /* Has the mouse moved off the glyph it was on at the last sighting? */
- if (event->x != last_mouse_x || event->y != last_mouse_y)
- {
- frame->mouse_moved = 1;
- note_mouse_highlight (frame, event->x, event->y);
- /* Remember which glyph we're now on. */
- last_mouse_x = event->x;
- last_mouse_y = event->y;
- return 1;
- }
- return 0;
-}
-
/* Return the current time, as a Time value. Wrap around on overflow. */
static Time
current_Time (void)
@@ -2562,30 +2546,22 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event)
if (event->type & (GPM_MOVE | GPM_DRAG))
{
- previous_help_echo_string = help_echo_string;
- help_echo_string = Qnil;
-
Gpm_DrawPointer (event->x, event->y, fileno (tty->output));
- if (!term_mouse_movement (f, event))
- help_echo_string = previous_help_echo_string;
-
- /* If the contents of the global variable help_echo_string
- has changed, generate a HELP_EVENT. */
- if (!NILP (help_echo_string)
- || !NILP (previous_help_echo_string))
- {
- Lisp_Object frame;
-
- if (f)
- XSETFRAME (frame, f);
- else
- frame = Qnil;
-
- gen_help_event (help_echo_string, frame, help_echo_window,
- help_echo_object, help_echo_pos);
- count++;
- }
+ /* Has the mouse moved off the glyph it was on at the last
+ sighting? */
+ if (event->x != last_mouse_x || event->y != last_mouse_y)
+ {
+ /* FIXME: These three lines can not be moved into
+ update_mouse_position unless xterm-mouse gets updated to
+ generate mouse events via C code. See
+ https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00163.html */
+ last_mouse_x = event->x;
+ last_mouse_y = event->y;
+ f->mouse_moved = 1;
+
+ count += update_mouse_position (f, event->x, event->y);
+ }
}
else
{