From 7e612a26a8697a984980f15a8ffefd90e8c34d36 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 13 Feb 2022 19:50:20 +0800 Subject: [PATCH] Only get rid of IC focus if focus is really gone * src/xterm.c (x_focus_changed): Only unset IC focus if the focus state is empty. --- src/xterm.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index fe213b0fabb..b8d0a2b58b6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5559,17 +5559,21 @@ x_focus_changed (int type, int state, struct x_display_info *dpyinfo, struct fra XSETFRAME (bufp->frame_or_window, frame); } + if (!frame->output_data.x->focus_state) + { #ifdef HAVE_X_I18N - if (FRAME_XIC (frame)) - XUnsetICFocus (FRAME_XIC (frame)); + if (FRAME_XIC (frame)) + XUnsetICFocus (FRAME_XIC (frame)); #ifdef USE_GTK - if (x_gtk_use_native_input) - { - gtk_im_context_focus_out (FRAME_X_OUTPUT (frame)->im_context); - gtk_im_context_set_client_window (FRAME_X_OUTPUT (frame)->im_context, NULL); - } + if (x_gtk_use_native_input) + { + gtk_im_context_focus_out (FRAME_X_OUTPUT (frame)->im_context); + gtk_im_context_set_client_window (FRAME_X_OUTPUT (frame)->im_context, NULL); + } #endif #endif + } + if (frame->pointer_invisible) XTtoggle_invisible_pointer (frame, false); } -- 2.39.5