XPutBackEvent (f->output_data.x->display_info->display,
f->output_data.x->saved_menu_event);
#else
-#ifdef USE_MOTIF
-#ifdef HAVE_XINPUT2
+#if defined USE_X_TOOLKIT && defined HAVE_XINPUT2
struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
- /* Clear the XI2 grab so Motif can set a core grab. Otherwise some
- versions of Motif will emit a warning and hang. */
+ /* Clear the XI2 grab so Motif or lwlib can set a core grab.
+ Otherwise some versions of Motif will emit a warning and hang,
+ and lwlib will fail to destroy the menu window. */
if (dpyinfo->num_devices)
{
XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
CurrentTime);
}
-#endif
#endif
XtDispatchEvent (f->output_data.x->saved_menu_event);
#endif
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
f = x_top_window_to_frame (dpyinfo, event->xcrossing.window);
+#if defined HAVE_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 (dpyinfo->supports_xi2)
+ f = NULL;
+#endif
if (f)
{
if (f == hlinfo->mouse_face_mouse_frame)
x_display_set_last_user_time (dpyinfo, xi_event->time);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
+#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);
+#endif
if (f)
{
if (f == hlinfo->mouse_face_mouse_frame)