Clear mouse highlight when mouse moves outside edit widget

* 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.
This commit is contained in:
Po Lu 2022-02-08 14:17:23 +08:00
parent 58172cc28a
commit 9d1ae05442

View 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)
{