From: Po Lu Date: Mon, 25 Jul 2022 02:07:30 +0000 (+0800) Subject: Fix mouse face handling with tooltips X-Git-Tag: emacs-29.0.90~1447^2~762 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3c23ae13f044083c928df14ff441f841fcdc3b4f;p=emacs.git 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. --- 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