]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix mouse face handling with tooltips
authorPo Lu <luangruo@yahoo.com>
Mon, 25 Jul 2022 02:07:30 +0000 (10:07 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 25 Jul 2022 02:07:30 +0000 (10:07 +0800)
* 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

index da909f337f9da7336f1f2dcda8ef7a9663faa646..e953f54d6da7f7f6c7a7b7f8bc2aef41992193da 100644 (file)
@@ -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