Tk Source Code

Artifact [e7cd4cb8]
Login

Artifact e7cd4cb8d9ef8dae77e1b5f3d53d6fff711a6fd3:

Attachment "xim_peek.patch" to ticket [570902ff] added by mdejong 2002-06-19 09:53:51.
Index: unix/tcl.m4
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/tcl.m4,v
retrieving revision 1.29
diff -u -r1.29 tcl.m4
--- unix/tcl.m4	21 May 2002 18:27:31 -0000	1.29
+++ unix/tcl.m4	19 Jun 2002 02:49:30 -0000
@@ -929,6 +929,9 @@
 	        EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline"
 	    fi
 
+	    # XIM peeking works under XFree86.
+	    AC_DEFINE(PEEK_XCLOSEIM)
+
 	    ;;
 	GNU*)
 	    SHLIB_CFLAGS="-fPIC"
Index: unix/tkUnixEvent.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/tkUnixEvent.c,v
retrieving revision 1.8
diff -u -r1.8 tkUnixEvent.c
--- unix/tkUnixEvent.c	15 Jun 2002 01:54:09 -0000	1.8
+++ unix/tkUnixEvent.c	19 Jun 2002 02:49:30 -0000
@@ -26,6 +26,17 @@
 } ThreadSpecificData;
 static Tcl_ThreadDataKey dataKey;
 
+#if defined(TK_USE_INPUT_METHODS) && defined(PEEK_XCLOSEIM)
+/*
+ * Structure used to peek into internal XIM data structure.
+ * Enabled only on systems where we are sure it works.
+ */
+struct XIMPeek {
+    void *junk1, *junk2;
+    XIC  ic_chain;
+};
+#endif
+
 /*
  * Prototypes for procedures that are referenced only in this file:
  */
@@ -178,6 +189,12 @@
 	 * This causes core dumps on some systems (e.g. Solaris 2.3 as of
 	 * 1/6/95), but is OK with X11R6
 	 */
+
+#if defined(TK_USE_INPUT_METHODS) && defined(PEEK_XCLOSEIM)
+	struct XIMPeek *peek = (struct XIMPeek *) dispPtr->inputMethod;
+	if (peek->ic_chain != NULL)
+	    panic("input contexts not freed before XCloseIM");
+#endif
 	XCloseIM(dispPtr->inputMethod);
     }
 #endif