Tk Source Code

Artifact [dea5604657]
Login

Artifact dea5604657be7e0e472e6ff5218dc11f4d3f3d0fb909a11ee4e889abcca50751:

Attachment "xim-8610.tk.patch" to ticket [340006f5d0] added by bll 2021-01-04 13:46:14.
Index: generic/tk.h
==================================================================
--- generic/tk.h
+++ generic/tk.h
@@ -832,14 +832,10 @@
  * TK_NEED_CONFIG_NOTIFY:	1 means that the window has been reconfigured
  *				before it was made to exist. At the time of
  *				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
  *				already been destroyed elsewhere (e.g. by
  *				another application) or when it will be
@@ -889,11 +885,10 @@
 #define TK_MAPPED		1
 #define TK_TOP_LEVEL		2
 #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
 #define TK_CONTAINER		0x200
 #define TK_BOTH_HALVES		0x400

Index: generic/tkEvent.c
==================================================================
--- generic/tkEvent.c
+++ generic/tkEvent.c
@@ -1222,26 +1222,26 @@
 #ifdef TK_USE_INPUT_METHODS
     /*
      * 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);
+      }
     }
 #endif /*TK_USE_INPUT_METHODS*/
 
     /*
      * For events where it hasn't already been done, update the current time

Index: unix/tkUnixEvent.c
==================================================================
--- unix/tkUnixEvent.c
+++ unix/tkUnixEvent.c
@@ -178,11 +178,11 @@
     dispPtr = ckalloc(sizeof(TkDisplay));
     memset(dispPtr, 0, sizeof(TkDisplay));
     dispPtr->display = display;
     dispPtr->flags |= use_xkb;
 #ifdef TK_USE_INPUT_METHODS
-    OpenIM(dispPtr);
+/*    OpenIM(dispPtr); */
     XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
 	    InstantiateIMCallback, (XPointer) dispPtr);
 #endif
     Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE,
 	    DisplayFileProc, dispPtr);