From 14c80c9db8dd4abf547bfe3e15020fc977e4bdba Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 27 Feb 2022 14:40:26 +0800 Subject: [PATCH] Work around some problems with Motif and the input extension * src/xmenu.c (create_and_show_popup_menu): Restore input focus to the frame's outer window if there was an input extension grab. --- src/xmenu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xmenu.c b/src/xmenu.c index 2bc9f5a93a0..93bc90514c2 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1687,6 +1687,14 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv, unbind_to (specpdl_count, Qnil); } + +#if defined HAVE_XINPUT2 && defined USE_MOTIF + /* For some reason input focus isn't always restored to the outer + window after the menu pops down. */ + if (any_xi_grab_p) + XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), + RevertToParent, CurrentTime); +#endif } #endif /* not USE_GTK */ -- 2.39.5