From 3c23ae13f044083c928df14ff441f841fcdc3b4f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 25 Jul 2022 10:07:30 +0800 Subject: [PATCH] Fix mouse face handling with tooltips * src/xterm.c (handle_one_xevent): Clear last_mouse_motion_frame and last_mouse_glyph_frame on LeaveNotify. Otherwise, mouse face will be restored by gui_redo_mouse_highlight and will not be restored if an EnterNotify is later sent on top of the same glyph. --- src/xterm.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/xterm.c b/src/xterm.c index da909f337f9..e953f54d6da 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -18303,6 +18303,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, #endif if (f) { + /* Now clear dpyinfo->last_mouse_motion_frame, or + gui_redo_mouse_highlight will end up highlighting the + last known poisition of the mouse if a tooltip frame is + later unmapped. */ + + if (f == dpyinfo->last_mouse_motion_frame) + dpyinfo->last_mouse_motion_frame = NULL; + + /* Something similar applies to + dpyinfo->last_mouse_glyph_frame. */ + if (f == dpyinfo->last_mouse_glyph_frame) + dpyinfo->last_mouse_glyph_frame = NULL; + if (f == hlinfo->mouse_face_mouse_frame) { /* If we move outside the frame, then we're @@ -19753,8 +19766,22 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (!f) f = x_top_window_to_frame (dpyinfo, leave->event); #endif + if (f) { + /* Now clear dpyinfo->last_mouse_motion_frame, or + gui_redo_mouse_highlight will end up highlighting + the last known poisition of the mouse if a + tooltip frame is later unmapped. */ + + if (f == dpyinfo->last_mouse_motion_frame) + dpyinfo->last_mouse_motion_frame = NULL; + + /* Something similar applies to + dpyinfo->last_mouse_glyph_frame. */ + if (f == dpyinfo->last_mouse_glyph_frame) + dpyinfo->last_mouse_glyph_frame = NULL; + if (f == hlinfo->mouse_face_mouse_frame) { /* If we move outside the frame, then we're -- 2.39.2