]> git.eshelyaron.com Git - emacs.git/commitdiff
Only get rid of IC focus if focus is really gone
authorPo Lu <luangruo@yahoo.com>
Sun, 13 Feb 2022 11:50:20 +0000 (19:50 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 13 Feb 2022 11:51:49 +0000 (19:51 +0800)
* src/xterm.c (x_focus_changed): Only unset IC focus if the
focus state is empty.

src/xterm.c

index fe213b0fabbab997b2417ad31c3d5566236538ea..b8d0a2b58b6251c1a60fbff40b48380a36ecf327 100644 (file)
@@ -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);
     }