Tk Source Code

Artifact [b67440f8f6]
Login

Artifact b67440f8f6905f908d2a6f9c746391ce0a30185f:

Attachment "tk-scim-workaround.patch" to ticket [905830ffff] added by rmax 2005-12-06 00:35:25.
--- unix/tkUnixEvent.c
+++ unix/tkUnixEvent.c
@@ -650,10 +650,31 @@
 {
     unsigned short i;
     XIMStyles *stylePtr;
+    char *modifiers;
 
-    if (XSetLocaleModifiers("") == NULL) {
+    modifiers = XSetLocaleModifiers("");
+    if (modifiers == NULL) {
 	goto error;
     }
+#if 1
+    /* 
+     * This is a temporary hack that can be taken back out again
+     * once Tk has learned how to deal with SCIM
+     */
+    while ((modifiers = strchr(modifiers, '@')) != NULL) {
+	if (strncmp(modifiers, "@im=", 4) == 0) {
+	    /* The first "@im=" entry wins */
+	    const char const *scim = "@im=SCIM";
+	    if (strncmp(modifiers, scim, strlen(scim)) == 0) {
+		/* If it is SCIM, we override it */
+		if (XSetLocaleModifiers("@im=local") == NULL) {
+		    goto error;
+		}
+	    }
+	    break;
+	}
+    }
+#endif
 
     dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL);
     if (dispPtr->inputMethod == NULL) {