]> git.eshelyaron.com Git - emacs.git/commitdiff
Clear mouse highlight when mouse moves outside edit widget
authorPo Lu <luangruo@yahoo.com>
Tue, 8 Feb 2022 06:17:23 +0000 (14:17 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 8 Feb 2022 06:18:34 +0000 (14:18 +0800)
* src/xterm.c (handle_one_xevent): Clear mouse highlight when
leaving the edit widget.  Otherwise, it stays around on the
toolbar after the mouse is moved onto the menu bar.

src/xterm.c

index b49441ddb79627a817ae7e0f2c8e190e4260fafa..8bdb3c9ea1b9e752a695e57e885c8e505acbe7ff 100644 (file)
@@ -10068,8 +10068,17 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       if (x_top_window_to_frame (dpyinfo, event->xcrossing.window))
        x_detect_focus_change (dpyinfo, any, event, &inev.ie);
 
+#if defined USE_X_TOOLKIT
+      /* If the mouse leaves the edit widget, then any mouse highlight
+        should be cleared.  */
+      f = x_window_to_frame (dpyinfo, event->xcrossing.window);
+
+      if (!f)
+       f = x_top_window_to_frame (dpyinfo, event->xcrossing.window);
+#else
       f = x_top_window_to_frame (dpyinfo, event->xcrossing.window);
-#if defined HAVE_X_TOOLKIT && defined HAVE_XINPUT2
+#endif
+#if defined USE_X_TOOLKIT && defined HAVE_XINPUT2
       /* The XI2 event mask is set on the frame widget, so this event
         likely originates from the shell widget, which we aren't
         interested in.  */
@@ -10783,15 +10792,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
            if (any)
              x_detect_focus_change (dpyinfo, any, event, &inev.ie);
 
-           if (!any)
-             any = x_any_window_to_frame (dpyinfo, leave->event);
-
 #ifndef USE_X_TOOLKIT
            f = x_top_window_to_frame (dpyinfo, leave->event);
 #else
            /* On Xt builds that have XI2, the enter and leave event
               masks are set on the frame widget's window.  */
            f = x_window_to_frame (dpyinfo, leave->event);
+
+           if (!f)
+             f = x_top_window_to_frame (dpyinfo, leave->event);
 #endif
            if (f)
              {