Tk Source Code

Artifact [86af2dfdd9]
Login

Artifact 86af2dfdd980ebc9bebbc94f7f778e6aec9e6328bb08748e56f5f02b8713fba0:

Attachment "xim-87.tk.patch" to ticket [340006f5d0] added by bll 2021-06-09 14:32:05.
--- generic/tkEvent.c	2021-06-09 06:44:24.883496567 -0700
+++ generic/tkEvent.c	2021-06-09 07:14:21.092832938 -0700
@@ -1227,22 +1227,22 @@
      * If the XIC has been invalidated, it must be recreated.
      */
     if (winPtr->dispPtr->ximGeneration != winPtr->ximGeneration) {
-	winPtr->flags &= ~TK_CHECKED_IC;
-	winPtr->inputContext = NULL;
+      winPtr->inputContext = NULL;
     }

-    if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)) {
-	if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
-	    winPtr->flags |= TK_CHECKED_IC;
-	    if (winPtr->dispPtr->inputMethod != NULL) {
-		CreateXIC(winPtr);
-	    }
-	}
-	if ((eventPtr->type == FocusIn) &&
-		(winPtr->dispPtr->inputMethod != NULL) &&
-		(winPtr->inputContext != NULL)) {
-	    XSetICFocus(winPtr->inputContext);
-	}
+    if (! (winPtr->flags & (TK_ALREADY_DEAD)) &&
+        (winPtr->dispPtr->flags & TK_DISPLAY_USE_IM) &&
+        winPtr->dispPtr->inputMethod != NULL) {
+      if ((winPtr->flags & TK_TOP_LEVEL) &&
+          winPtr->inputContext == NULL) {
+        CreateXIC(winPtr);
+      }
+      if (eventPtr->type == FocusIn) {
+        if (winPtr->inputContext == NULL) {
+	  CreateXIC(winPtr);
+        }
+        XSetICFocus(winPtr->inputContext);
+      }
     }

     /*
--- generic/tk.h	2021-06-09 06:44:24.879496557 -0700
+++ generic/tk.h	2021-06-09 07:12:48.183977890 -0700
@@ -874,10 +874,6 @@
  *				making it exist a ConfigureNotify event needs
  *				to be generated.
  * TK_GRAB_FLAG:		Used to manage grabs. See tkGrab.c for details
- * TK_CHECKED_IC:		1 means we've already tried to get an input
- *				context for this window; if the ic field is
- *				NULL it means that there isn't a context for
- *				the field.
  * TK_DONT_DESTROY_WINDOW:	1 means that Tk_DestroyWindow should not
  *				invoke XDestroyWindow to destroy this widget's
  *				X window. The flag is set when the window has
@@ -935,7 +931,6 @@
 #define TK_ALREADY_DEAD		4
 #define TK_NEED_CONFIG_NOTIFY	8
 #define TK_GRAB_FLAG		0x10
-#define TK_CHECKED_IC		0x20
 #define TK_DONT_DESTROY_WINDOW	0x40
 #define TK_WM_COLORMAP_WINDOW	0x80
 #define TK_EMBEDDED		0x100
--- unix/tkUnixEvent.c	2021-06-09 06:44:24.999496855 -0700
+++ unix/tkUnixEvent.c	2021-06-09 07:16:52.082175053 -0700
@@ -167,7 +167,6 @@
     memset(dispPtr, 0, sizeof(TkDisplay));
     dispPtr->display = display;
 #ifdef TK_USE_INPUT_METHODS
-    OpenIM(dispPtr);
     XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
 	    InstantiateIMCallback, (XPointer) dispPtr);
 #endif