Tk Source Code

Artifact [25613534b1]
Login

Artifact 25613534b152f69216a8263e8ac9da38493eba00:

Attachment "XSetICFocus-8.4.7.patch" to ticket [905830ffff] added by rmax 2004-07-30 01:03:15.
Index: generic/tkEvent.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkEvent.c,v
retrieving revision 1.17.2.4
diff -u -r1.17.2.4 tkEvent.c
--- generic/tkEvent.c	21 Jul 2004 04:27:55 -0000	1.17.2.4
+++ generic/tkEvent.c	29 Jul 2004 17:46:34 -0000
@@ -882,8 +882,8 @@
      */
     dispPtr = winPtr->dispPtr;
     if ((dispPtr->flags & TK_DISPLAY_USE_IM)) {
+	long im_event_mask = 0L;
 	if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
-	    long im_event_mask = 0L;
 	    winPtr->flags |= TK_CHECKED_IC;
 	    if (dispPtr->inputMethod != NULL) {
 #if TK_XIM_SPOT
@@ -937,14 +937,15 @@
 			NULL);
 #endif
 	    }
-	    if (winPtr->inputContext != NULL) {
-		XGetICValues(winPtr->inputContext,
-			XNFilterEvents, &im_event_mask, NULL);
-		if (im_event_mask != 0L) {
-		    XSelectInput(winPtr->display, winPtr->window,
-		    winPtr->atts.event_mask | im_event_mask);
-		    XSetICFocus(winPtr->inputContext);
-		}
+	}
+	if (winPtr->inputContext != NULL &&
+	    (eventPtr->xany.type == FocusIn)) {
+	    XGetICValues(winPtr->inputContext,
+			 XNFilterEvents, &im_event_mask, NULL);
+	    if (im_event_mask != 0L) {
+		XSelectInput(winPtr->display, winPtr->window,
+			     winPtr->atts.event_mask | im_event_mask);
+		XSetICFocus(winPtr->inputContext);
 	    }
 	}
 	if (XFilterEvent(eventPtr, None)) {