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. */
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)
{