Only in IMdkit: .cvsignore
diff -ubB IMdkit.orig/lib/FrameMgr.c IMdkit/FrameMgr.c
--- IMdkit.orig/lib/FrameMgr.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/FrameMgr.c	Fri Jul  5 14:20:06 2002
@@ -314,6 +314,8 @@
             fm->idx += 8;
             break;
 #endif
+	default:
+	    break;
         }
         /*endswitch*/
         _FrameMgrPutToken(fm, data, data_size);
@@ -465,6 +467,8 @@
         
     case EOL:
         return FmEOD;
+    default:
+	break;
     }
     /*endswitch*/
     return (FmStatus) NULL;  /* Should never be reached */
@@ -484,7 +488,7 @@
 
     if (type & COUNTER_MASK)
     {
-        int end;
+        int end=0;
         FrameIter client_data;
 
         type &= ~COUNTER_MASK;
@@ -507,6 +511,8 @@
             end = Swap64 (fm, *(CARD64 *) (fm->area + fm->idx));
             break;
 #endif
+	default:
+	    break;
         }
         /*endswitch*/
         
@@ -685,6 +691,8 @@
 
     case EOL:
         return FmEOD;
+    default:
+	break;
     }
     /*endswitch*/
     return (FmStatus) NULL;  /* Should never be reached */
@@ -779,6 +787,8 @@
             
         case EOL:
             return FmEOD;
+	default:
+	    break;
         }
         /*endswitch*/
     }
@@ -909,8 +919,8 @@
             register int offset, iter_idx;
 
             info->counter.is_byte_len =
-                (((int) fi->template[fi->cur_no].data & 0xFF)) == FmCounterByte;
-            offset = ((int) fi->template[fi->cur_no].data) >> 8;
+                (((long) fi->template[fi->cur_no].data & 0xFF)) == FmCounterByte;
+            offset = ((long) fi->template[fi->cur_no].data) >> 8;
             iter_idx = fi->cur_no + offset;
             if (fi->template[iter_idx].type == ITER)
             {
@@ -958,8 +968,8 @@
             register int size;
             register int i;
 
-            unit = _UNIT ((int) fi->template[fi->cur_no].data);
-            number = _NUMBER ((int) fi->template[fi->cur_no].data);
+            unit = _UNIT ((long) fi->template[fi->cur_no].data);
+            number = _NUMBER ((long) fi->template[fi->cur_no].data);
 
             i = fi->cur_no;
             size = 0;
@@ -1028,6 +1038,8 @@
             /*endif*/
         }
         break;
+    default:
+	break;
     }
     /*endswitch*/
     return ret_type;
@@ -1058,8 +1070,8 @@
 	    register int iter_idx;
 
             info->counter.is_byte_len =
-                (((int) fi->template[fi->cur_no].data) & 0xFF) == FmCounterByte;
-            offset = ((int)fi->template[fi->cur_no].data) >> 8;
+                (((long) fi->template[fi->cur_no].data) & 0xFF) == FmCounterByte;
+            offset = ((long)fi->template[fi->cur_no].data) >> 8;
             iter_idx = fi->cur_no + offset;
             if (fi->template[iter_idx].type == ITER)
             {
@@ -1101,12 +1113,12 @@
         if (info)
         {
             register int unit;
-            register number;
-            register size;
-            register i;
+            register int number;
+            register int size;
+            register int i;
 
-            unit = _UNIT ((int) fi->template[fi->cur_no].data);
-            number = _NUMBER ((int) fi->template[fi->cur_no].data);
+            unit = _UNIT ((long) fi->template[fi->cur_no].data);
+            number = _NUMBER ((long) fi->template[fi->cur_no].data);
 
             i = fi->cur_no;
             size = 0;
@@ -1161,6 +1173,8 @@
             else
                 ret_type = sub_type;
             /*endif*/
+	default:
+	    break;
         }
         break;
     }
@@ -1325,6 +1339,8 @@
                 return FmSuccess;
             /*endif*/
             break;
+	default:
+	    break;
         }
         /*endswitch*/
         i = _FrameInstIncrement(fi->template, i);
@@ -1377,6 +1393,8 @@
                 return ret_size;
             /*endif*/
             break;
+	default:
+	    break;
         }
         /*endswitch*/
         i = _FrameInstIncrement (fi->template, i);
@@ -1421,6 +1439,9 @@
                 return FmSuccess;
             /*endif*/
             break;
+
+	default:
+	    break;
         }
         /*endswitch*/
         i = _FrameInstIncrement (fi->template, i);
@@ -1561,6 +1582,9 @@
             ChainMgrFree (&it->cm);
         }
         break;
+
+    default:
+	break;
     }
     /*endswitch*/
     Xfree (it);
@@ -1712,6 +1736,9 @@
             /*endif*/
 	    return ret_type;
         }
+
+    default:
+	return (XimFrameType) NULL;
     }
     /*endswitch*/
     return (XimFrameType) NULL;  /* This should never occur */
@@ -1786,6 +1813,9 @@
             /*endif*/
             return (ret_type);
         }
+
+    default:
+	break;
     }
     /*endswitch*/
     /* Reaching here is a bug! */
@@ -1906,6 +1936,9 @@
             /*endif*/
         }
         return FmNoMoreData;
+
+    default:
+	break;
     }
     /*endswitch*/
     return FmNoMoreData;
@@ -1966,6 +1999,9 @@
         }
         /*endfor*/
         return NO_VALID_FIELD;
+
+    default:
+	break;
     }
     /*endswitch*/
     return NO_VALID_FIELD;
@@ -2051,6 +2087,9 @@
         }
         /*endif*/
         break;
+
+    default:
+	break;
     }
     /*endswitch*/
     return FmNoMoreData;
@@ -2143,6 +2182,9 @@
         }
         /*endfor*/
         break;
+
+    default:
+	break;
     }
     /*endswitch*/
     return  size;
@@ -2171,6 +2213,9 @@
         /*endwhile*/
         ChainIterFree (&ci);
         break;
+
+    default:
+	break;
     }
     /*endswitch*/
     it->cur_no = 0;
@@ -2260,6 +2305,8 @@
         
     case ITER:
         return _FrameInstIncrement (frame, count + 1);
+    default:
+	break;
     }
     /*endswitch*/
     return - 1;    /* Error */
@@ -2304,6 +2351,8 @@
         }
         /*endwhile*/
         return 0;
+    default:
+	break;
     }
     /*enswitch*/
     return - 1;    /* Error */
@@ -2350,8 +2399,8 @@
             register int size;
             register int i;
 
-            unit = _UNIT ((int) fi->template[cur_no].data);
-            number = _NUMBER ((int) fi->template[cur_no].data);
+            unit = _UNIT ((long) fi->template[cur_no].data);
+            number = _NUMBER ((long) fi->template[cur_no].data);
 
             i = cur_no;
             size = 0;
@@ -2395,6 +2444,9 @@
             /*endif*/
             return sub_size;
         }
+
+    default:
+	break;
     }
     /*endswitch*/
     return NO_VALUE;
Only in IMdkit.orig/lib: FrameMgr.o
diff -ubB IMdkit.orig/lib/IMConn.c IMdkit/IMConn.c
--- IMdkit.orig/lib/IMConn.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/IMConn.c	Fri Jul  5 14:20:06 2002
@@ -31,6 +31,7 @@
 
 #include <X11/Xlib.h>
 #include <malloc.h>
+#include <string.h>
 #include "IMdkit.h"
 #include <stdarg.h>
 
@@ -44,7 +45,7 @@
 
     for (attr = va_arg (var, char*);  attr;  attr = va_arg (var, char*))
     {
-	va_arg (var, XIMArg *);
+	(void)va_arg (var, XIMArg *);
 	++(*total_count);
     }
     /*endfor*/
Only in IMdkit.orig/lib: IMConn.o
diff -ubB IMdkit.orig/lib/IMMethod.c IMdkit/IMMethod.c
--- IMdkit.orig/lib/IMMethod.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/IMMethod.c	Fri Jul  5 14:20:06 2002
@@ -57,3 +57,9 @@
 {
     return (ims->methods->preeditEnd) (ims, call_data);
 }
+
+int IMSyncXlib(XIMS ims, XPointer call_data)
+{
+    ims->sync = True;
+    return (ims->methods->syncXlib) (ims, call_data);
+}
Only in IMdkit.orig/lib: IMMethod.o
diff -ubB IMdkit.orig/lib/IMValues.c IMdkit/IMValues.c
--- IMdkit.orig/lib/IMValues.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/IMValues.c	Fri Jul  5 14:20:06 2002
@@ -29,6 +29,7 @@
  
 ******************************************************************/
 
+#include <stdlib.h>
 #include <X11/Xlib.h>
 #include "IMdkit.h"
 #include <stdarg.h>
@@ -43,7 +44,7 @@
 
     for (attr = va_arg (var, char *);  attr;  attr = va_arg (var, char *))
     {
-	va_arg (var, XIMArg *);
+	(void)va_arg (var, XIMArg *);
 	++(*total_count);
     }
     /*endfor*/
Only in IMdkit.orig/lib: IMValues.o
Only in IMdkit: IMdkit.h
diff -ubB IMdkit.orig/lib/Makefile IMdkit/Makefile
--- IMdkit.orig/lib/Makefile	Mon Apr 22 13:04:13 2002
+++ IMdkit/Makefile	Fri Jul  5 14:20:06 2002
@@ -1,22 +1,70 @@
-
+# Generated automatically from Makefile.in by configure.
 CC = gcc
-#CFLAGS =  -c -O2 -fno-strength-reduce -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE=500L -D_BSD_SOURCE -D_SVID_SOURCE   -DFUNCPROTO=15 -DNARROWPROTO   -DUNIXCONN -DTCPCONN -DXIM_t -DTRANS_SERVER
-CFLAGS =  -c -O2 -fno-strength-reduce -DXIM_t -DTRANS_SERVER
-INC = -I../include -I/usr/X11R6/include   
+CFLAGS       = -Wall -fsigned-char -O2
+CPPFLAGS     = 
+DEFS         = -DHAVE_CONFIG_H
+RANLIB	     = ranlib
+LN_S	     = ln -s
+
+
+x_includes  = -I/usr/X11R6/include
+extra_inc   = -I/usr/include
+extra_lib   = -L/usr/lib
+intl_inc    = 
+
+srcdir      = .
+top_srcdir  = ../../..
+prefix      = /usr
+exec_prefix = ${prefix}
+
+xcininc = -I$(top_srcdir)/src/include
+TARGET  = libXimd.a
+INC     = $(x_includes) $(xcininc) $(extra_inc) $(intl_inc)
+
+SRC =	FrameMgr.c IMValues.c i18nIMProto.c i18nPtHdr.c i18nX.c IMConn.c \
+	i18nAttr.c i18nIc.c IMMethod.c i18nClbk.c i18nMethod.c i18nUtil.c
 
+OBJ =	FrameMgr.o IMValues.o i18nIMProto.o i18nPtHdr.o i18nX.o IMConn.o \
+	i18nAttr.o i18nIc.o IMMethod.o i18nClbk.o i18nMethod.o i18nUtil.o
 
-SRC = IMConn.c IMValues.c IMMethod.c FrameMgr.c i18nIMProto.c i18nAttr.c i18nMethod.c i18nUtil.c i18nPtHdr.c i18nIc.c i18nClbk.c i18nX.c i18nTr.c i18ntrans.c
+.c.o:
+	$(CC) $(CFLAGS) $(DEFS) $(INC) -c -o $@ $<
 
-OBJ = $(SRC:.c=.o)
+all: $(TARGET)
 
-all: libXimd.a
+$(TARGET): $(OBJ)
+	ar -rc $@ $(OBJ)
+	if [ -n "$(RANLIB)" ]; then $(RANLIB) $(TARGET); fi
+	rm -f ../$(TARGET)
+	( cd ..; $(LN_S) IMdkit/$(TARGET) . )
 
-libXimd.a: $(OBJ)
-	ar clq libXimd.a $(OBJ)
-	ranlib libXimd.a
+FrameMgr.o: FrameMgr.c FrameMgr.h
+
+IMValues.o: IMValues.c IMdkit.h
+
+i18nIMProto.o: i18nIMProto.c FrameMgr.h
+
+i18nPtHdr.o: i18nPtHdr.c IMdkit.h Xi18n.h XimProto.h XimFunc.h
+
+i18nX.o: i18nX.c FrameMgr.h IMdkit.h Xi18n.h XimProto.h Xi18nX.h XimFunc.h
+
+IMConn.o: IMConn.c IMdkit.h
+
+i18nAttr.o: i18nAttr.c IMdkit.h Xi18n.h XimProto.h XimFunc.h
+
+i18nIc.o: i18nIc.c IMdkit.h Xi18n.h XimProto.h FrameMgr.h XimFunc.h
+
+IMMethod.o: IMMethod.c IMdkit.h 
+
+i18nClbk.o: i18nClbk.c IMdkit.h Xi18n.h XimProto.h FrameMgr.h XimFunc.h
+
+i18nMethod.o: i18nMethod.c FrameMgr.h IMdkit.h Xi18n.h XimFunc.h
+
+i18nUtil.o: i18nUtil.c IMdkit.h Xi18n.h XimProto.h FrameMgr.h XimFunc.h
 
-.c.o:
-	$(CC) $(CFLAGS) $(INC) $<
 
+.PHONY: clean distclean
 clean:
-	rm -f libXimd.a *.o *.bak
+	rm -f $(OBJ) $(TARGET) core
+distclean: clean
+	rm -f Makefile .depend
Only in IMdkit: Makefile.in
Only in IMdkit: Xi18n.h
Only in IMdkit: XimFunc.h
Only in IMdkit: XimProto.h
Only in IMdkit.orig/lib: Xtrans.c
Only in IMdkit.orig/lib: Xtrans.h
Only in IMdkit.orig/lib: Xtransam.c
Only in IMdkit.orig/lib: Xtransdnet.c
Only in IMdkit.orig/lib: Xtransint.h
Only in IMdkit.orig/lib: Xtranslcl.c
Only in IMdkit.orig/lib: Xtransmnx.c
Only in IMdkit.orig/lib: Xtransos2.c
Only in IMdkit.orig/lib: Xtranssock.c
Only in IMdkit.orig/lib: Xtranstli.c
Only in IMdkit.orig/lib: Xtransutil.c
Only in IMdkit: doc
diff -ubB IMdkit.orig/lib/i18nAttr.c IMdkit/i18nAttr.c
--- IMdkit.orig/lib/i18nAttr.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/i18nAttr.c	Fri Jul  5 14:20:06 2002
@@ -30,8 +30,10 @@
 ******************************************************************/
 
 #include <X11/Xlib.h>
+#include <X11/Xresource.h>
 #include "IMdkit.h"
 #include "Xi18n.h"
+#include "XimFunc.h"
 
 typedef struct 
 {
@@ -49,7 +51,7 @@
 IMListOfAttr Default_IMattr[] =
 {
     {XNQueryInputStyle,   XimType_XIMStyles},
-    {XNQueryIMValuesList, XimType_XIMValuesList},
+/*    {XNQueryIMValuesList, XimType_XIMValuesList},	*/
     {(char *) NULL, (CARD16) 0}
 };
 
Only in IMdkit.orig/lib: i18nAttr.o
diff -ubB IMdkit.orig/lib/i18nClbk.c IMdkit/i18nClbk.c
--- IMdkit.orig/lib/i18nClbk.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/i18nClbk.c	Fri Jul  5 14:20:06 2002
@@ -33,6 +33,7 @@
 #include "IMdkit.h"
 #include "Xi18n.h"
 #include "FrameMgr.h"
+#include "XimFunc.h"
 
 int _Xi18nGeometryCallback (XIMS ims, IMProtocol *call_data)
 {
@@ -168,14 +169,10 @@
     FrameMgrPutToken (fm, preedit_CB->icid);
     FrameMgrPutToken (fm, draw->caret);
     FrameMgrPutToken (fm, draw->chg_first);
-FrameMgrPutToken(fm, draw->chg_length);
+    FrameMgrPutToken (fm, draw->chg_length);
     FrameMgrPutToken (fm, status);
-FrameMgrPutToken(fm, draw->text->length);
-if( draw->text->length )
+    FrameMgrPutToken (fm, draw->text->length);
     FrameMgrPutToken (fm, draw->text->string);
-FrameMgrPutToken(fm, feedback_count);
-
-
     for (i = 0;  i < feedback_count;  i++)
         FrameMgrPutToken (fm, draw->text->feedback[i]);
     /*endfor*/
@@ -325,10 +322,10 @@
 int _Xi18nStatusDrawCallback (XIMS ims, IMProtocol *call_data)
 {
     Xi18n i18n_core = ims->protocol;
-    FrameMgr fm;
+    FrameMgr fm = (FrameMgr)0;
     extern XimFrameRec status_draw_text_fr[];
     extern XimFrameRec status_draw_bitmap_fr[];
-    register int total_size;
+    register int total_size = 0;
     unsigned char *reply = NULL;
     IMStatusCBStruct *status_CB =
         (IMStatusCBStruct *) &call_data->status_callback;
Only in IMdkit.orig/lib: i18nClbk.o
Only in IMdkit.orig/lib: i18nIMProto.o
diff -ubB IMdkit.orig/lib/i18nIc.c IMdkit/i18nIc.c
--- IMdkit.orig/lib/i18nIc.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/i18nIc.c	Fri Jul  5 14:20:06 2002
@@ -33,6 +33,7 @@
 #include "IMdkit.h"
 #include "Xi18n.h"
 #include "FrameMgr.h"
+#include "XimFunc.h"
 
 #define IC_SIZE 64
 
@@ -104,6 +105,7 @@
         return;
     /*endif*/
     FrameMgrGetToken (fm, base_name);
+    FrameMgrFree(fm);
     strncpy (buf, base_name, base_length);
     buf[base_length] = (char) 0;
 
@@ -536,10 +538,7 @@
                     attr_ret[n].attribute_id = xic_attr[j].attribute_id;
                     attr_ret[n].name_length = xic_attr[j].length;
                     attr_ret[n].name = malloc (xic_attr[j].length + 1);
-                    memcpy (attr_ret[n].name,
-			    xic_attr[j].name,
-			    xic_attr[j].length);
-		    attr_ret[n].name[xic_attr[j].length] = '\0';
+		    strcpy(attr_ret[n].name, xic_attr[j].name);
                     attr_ret[n].type = xic_attr[j].type;
                     n++;
                     i++;
@@ -560,10 +559,7 @@
                 attr_ret[n].attribute_id = xic_attr[j].attribute_id;
                 attr_ret[n].name_length = xic_attr[j].length;
                 attr_ret[n].name = malloc (xic_attr[j].length + 1);
-                memcpy (attr_ret[n].name,
-			xic_attr[j].name,
-			xic_attr[j].length);
-		attr_ret[n].name[xic_attr[j].length] = '\0';
+		strcpy(attr_ret[n].name, xic_attr[j].name);
                 attr_ret[n].type = xic_attr[j].type;
                 n++;
                 break;
@@ -651,6 +647,7 @@
         FrameMgrGetToken (fm, value);
         attrib_list[attrib_num].value = (void *) malloc (value_length + 1);
         memmove (attrib_list[attrib_num].value, value, value_length);
+	((char *)attrib_list[attrib_num].value)[value_length] = '\0';
         attrib_num++;
     }
     /*endwhile*/
@@ -797,6 +794,7 @@
     }
     /*endif*/
     FrameMgrFree (fm);
+    XFree(reply);
 }
 
 /* called from GetICValueMessageProc */
Only in IMdkit.orig/lib: i18nIc.o
diff -ubB IMdkit.orig/lib/i18nMethod.c IMdkit/i18nMethod.c
--- IMdkit.orig/lib/i18nMethod.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/i18nMethod.c	Fri Jul  5 14:20:06 2002
@@ -39,6 +39,7 @@
 #include "FrameMgr.h"
 #include "IMdkit.h"
 #include "Xi18n.h"
+#include "XimFunc.h"
 
 extern Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
 
@@ -47,11 +48,12 @@
 static Status xi18n_closeIM (XIMS);
 static char *xi18n_setIMValues (XIMS, XIMArg *);
 static char *xi18n_getIMValues (XIMS, XIMArg *);
-static Status xi18n_forwardEvent (XIMS, IMForwardEventStruct *);
-static Status xi18n_commit (XIMS, IMCommitStruct *);
-static Status xi18n_callCallback (XIMS, IMProtocol *);
-static Status xi18n_preeditStart (XIMS, IMProtocol *);
-static Status xi18n_preeditEnd (XIMS, IMProtocol *);
+static Status xi18n_forwardEvent (XIMS, XPointer);
+static Status xi18n_commit (XIMS, XPointer);
+static int xi18n_callCallback (XIMS, XPointer);
+static int xi18n_preeditStart (XIMS, XPointer);
+static int xi18n_preeditEnd (XIMS, XPointer);
+static int xi18n_syncXlib (XIMS, XPointer);
 
 #ifndef XIM_SERVERS
 #define XIM_SERVERS "XIM_SERVERS"
@@ -71,6 +73,7 @@
     xi18n_callCallback,
     xi18n_preeditStart,
     xi18n_preeditEnd,
+    xi18n_syncXlib,
 };
 
 extern Bool _Xi18nCheckXAddress (Xi18n, TransportSW *, char *);
@@ -79,8 +82,10 @@
 TransportSW _TransR[] =
 {
     {"X",               1, _Xi18nCheckXAddress},
+#ifdef TCPCONN
     {"tcp",             3, _Xi18nCheckTransAddress},
     {"local",           5, _Xi18nCheckTransAddress},
+#endif
 #ifdef DNETCONN
     {"decnet",          6, _Xi18nCheckTransAddress},
 #endif
@@ -576,6 +582,83 @@
     return (XGetSelectionOwner (dpy, atom) == ims_win);
 }
 
+static int DeleteXi18nAtom(Xi18n i18n_core)
+{
+    Display *dpy = i18n_core->address.dpy;
+    Window root = RootWindow (dpy, DefaultScreen (dpy));
+    Atom realtype;
+    int realformat;
+    unsigned long bytesafter;
+    long *data=NULL;
+    unsigned long length;
+    Atom atom;
+    int i, ret;
+    int found;
+    char buf[256];
+
+    (void)sprintf(buf, "@server=%s", i18n_core->address.im_name);
+    if ((atom = XInternAtom(dpy, buf, False)) == 0)
+        return False;
+    i18n_core->address.selection = atom;
+
+    if (XIM_Servers == None)
+        XIM_Servers = XInternAtom (dpy, XIM_SERVERS, False);
+    XGetWindowProperty (dpy,
+                        root,
+                        XIM_Servers,
+                        0L,
+                        1000000L,
+                        False,
+                        XA_ATOM,
+                        &realtype,
+                        &realformat,
+                        &length,
+                        &bytesafter,
+                        (unsigned char **) (&data));
+    if (realtype != XA_ATOM || realformat != 32) {
+        if (data != NULL)
+            XFree ((char *) data);
+        return False;
+    }
+
+    found = False;
+    for (i = 0; i < length; i++) {
+        if (data[i] == atom) {
+            found = True;
+            break;
+        }
+    }
+
+    if (found == True) {
+        for (i=i+1; i<length; i++)
+            data[i-1] = data[i];
+        XChangeProperty (dpy,
+                         root,
+                         XIM_Servers,
+                         XA_ATOM,
+                         32,
+                         PropModeReplace,
+                         (unsigned char *)data,
+                         length-1);
+        ret = True;
+    }
+    else {
+        XChangeProperty (dpy,
+                         root,
+                         XIM_Servers,
+                         XA_ATOM,
+                         32,
+                         PropModePrepend,
+                         (unsigned char *)data,
+                         0);
+        ret = False;
+    }
+    if (data != NULL)
+        XFree ((char *) data);
+    return ret;
+}
+
+
 /* XIM protocol methods */
 static void *xi18n_setup (Display *dpy, XIMArg *args)
 {
@@ -686,7 +769,7 @@
                             SelectionRequest,
                             SelectionRequest,
                             WaitXSelectionRequest,
-                            ims);
+                            (XPointer)ims);
     XFlush(dpy);
     return True;
 }
@@ -694,74 +777,20 @@
 static Status xi18n_closeIM(XIMS ims)
 {
     Xi18n i18n_core = ims->protocol;
-    Window ims_win = i18n_core->address.im_window;
     Display *dpy = i18n_core->address.dpy;
-    Atom atom = i18n_core->address.selection;
-    Window root = RootWindow (dpy, DefaultScreen (dpy));
-    Atom realtype;
-    int realformat;
-    unsigned long length;
-    unsigned long bytesafter;
-    long *data, *new_data;
-    int i, j;
 
+    DeleteXi18nAtom(i18n_core);
     if (!i18n_core->methods.end (ims))
         return False;
-    /*endif*/
     
     _XUnregisterFilter (dpy,
                         i18n_core->address.im_window,
                         WaitXSelectionRequest,
-                        ims);
-/*
- *  Now we should delete the atom list in XIM_Servers property of Root Window
- */
-/*
-    XGetWindowProperty (dpy,
-                        root,
-                        XIM_Servers,
-                        0L,
-                        1000000L,
-                        False,
-                        XA_ATOM,
-                        &realtype,
-                        &realformat,
-                        &length,
-                        &bytesafter,
-                        (unsigned char **) (&data));
-    if (realtype == XA_ATOM && realformat == 32 && length>0) {
-        new_data = malloc(sizeof(long) * length);
-        memset(new_data, 0, sizeof(long) * length);
-
-        for (i=0, j=0; i<length; i++) {
-            if (data[i] != atom) {
-		new_data[j] = data[i];
-		j ++;
-	    }
-        }
-	XDeleteProperty (dpy,
-			 root,
-			 XIM_Servers);
-	if (j > 0)
-            XChangeProperty (dpy,
-                             root,
-                             XIM_Servers,
-                             XA_ATOM,
-                             32,
-			     PropModePrepend,
-                             (unsigned char *)new_data,
-                             j);
-	free(new_data);
-    }
-    XFlush(dpy);
-
-    if (data != NULL)
-        XFree ((char *) data);
+                        (XPointer)ims);
     XFree (i18n_core->address.im_name);
     XFree (i18n_core->address.im_locale);
     XFree (i18n_core->address.im_addr);
     XFree (i18n_core);
-*/
     return True;
 }
 
@@ -817,9 +846,10 @@
     /*endswitch*/
 }
 
-static Status xi18n_forwardEvent (XIMS ims, IMForwardEventStruct *call_data)
+static Status xi18n_forwardEvent (XIMS ims, XPointer xp)
 {
     Xi18n i18n_core = ims->protocol;
+    IMForwardEventStruct *call_data = (IMForwardEventStruct *)xp;
     FrameMgr fm;
     extern XimFrameRec forward_event_fr[];
     register int total_size;
@@ -879,9 +909,10 @@
     return True;
 }
 
-static Status xi18n_commit (XIMS ims, IMCommitStruct *call_data)
+static Status xi18n_commit (XIMS ims, XPointer xp)
 {
     Xi18n i18n_core = ims->protocol;
+    IMCommitStruct *call_data = (IMCommitStruct *)xp;
     FrameMgr fm;
     extern XimFrameRec commit_chars_fr[];
     extern XimFrameRec commit_both_fr[];
@@ -974,8 +1005,9 @@
     return True;
 }
 
-static int xi18n_callCallback (XIMS ims, IMProtocol *call_data)
+static int xi18n_callCallback (XIMS ims, XPointer xp)
 {
+    IMProtocol *call_data = (IMProtocol *)xp;
     switch (call_data->major_code)
     {
     case XIM_GEOMETRY:
@@ -1010,8 +1042,9 @@
 }
 
 /* preeditStart and preeditEnd are used only for Dynamic Event Flow. */
-static int xi18n_preeditStart (XIMS ims, IMProtocol *call_data)
+static int xi18n_preeditStart (XIMS ims, XPointer xp)
 {
+    IMProtocol *call_data = (IMProtocol *)xp;
     Xi18n i18n_core = ims->protocol;
     IMPreeditStateStruct *preedit_state =
         (IMPreeditStateStruct *) &call_data->preedit_state;
@@ -1036,8 +1069,9 @@
     return True;
 }
 
-static int xi18n_preeditEnd (XIMS ims, IMProtocol *call_data)
+static int xi18n_preeditEnd (XIMS ims, XPointer xp)
 {
+    IMProtocol *call_data = (IMProtocol *)xp;
     Xi18n i18n_core = ims->protocol;
     int on_key_num = i18n_core->address.on_keys.count_keys;
     int off_key_num = i18n_core->address.off_keys.count_keys;
@@ -1057,3 +1091,39 @@
                         0);
     return True;
 }
+
+static int xi18n_syncXlib (XIMS ims, XPointer xp)
+{
+    IMProtocol *call_data = (IMProtocol *)xp;
+    Xi18n i18n_core = ims->protocol;
+    IMSyncXlibStruct *sync_xlib;
+
+    extern XimFrameRec sync_fr[];
+    FrameMgr fm;
+    CARD16 connect_id = call_data->any.connect_id;
+    int total_size;
+    unsigned char *reply;
+
+    sync_xlib = (IMSyncXlibStruct *) &call_data->sync_xlib;
+    fm = FrameMgrInit (sync_fr, NULL,
+                       _Xi18nNeedSwap (i18n_core, connect_id));
+    total_size = FrameMgrGetTotalSize(fm);
+    reply = (unsigned char *) malloc (total_size);
+    if (!reply) {
+        _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
+        return False;
+    }
+    memset (reply, 0, total_size);
+    FrameMgrSetBuffer (fm, reply);
+
+    /* input input-method ID */
+    FrameMgrPutToken (fm, connect_id);
+    /* input input-context ID */
+    FrameMgrPutToken (fm, sync_xlib->icid);
+    _Xi18nSendMessage (ims, connect_id, XIM_SYNC, 0, reply, total_size);
+
+    FrameMgrFree (fm);
+    XFree(reply);
+    return True;
+}
+
Only in IMdkit.orig/lib: i18nMethod.o
diff -ubB IMdkit.orig/lib/i18nPtHdr.c IMdkit/i18nPtHdr.c
--- IMdkit.orig/lib/i18nPtHdr.c	Mon Apr 22 14:42:54 2002
+++ IMdkit/i18nPtHdr.c	Fri Jul  5 14:20:06 2002
@@ -29,6 +29,14 @@
  
 ******************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+#ifdef DEBUG
+extern int verbose;
+extern void DebugLog(int deflevel, int inplevel, char *fmt, ...);
+#endif
+
 #include <stdlib.h>
 #include <sys/param.h>
 #include <X11/Xlib.h>
@@ -40,6 +48,7 @@
 #include "FrameMgr.h"
 #include "IMdkit.h"
 #include "Xi18n.h"
+#include "XimFunc.h"
 
 extern Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
 
@@ -556,6 +565,17 @@
     FrameMgrFree (fm);
 
     client->sync = False;
+
+    if (ims->sync == True) {
+	ims->sync = False;
+	if (i18n_core->address.improto) {
+	    call_data->sync_xlib.major_code = XIM_SYNC_REPLY;
+	    call_data->sync_xlib.minor_code = 0;
+	    call_data->sync_xlib.connect_id = input_method_ID;
+	    call_data->sync_xlib.icid = input_context_ID;
+	    i18n_core->address.improto(ims, call_data);
+	}
+    }
 }
 
 static void GetIMValueFromName (Xi18n i18n_core,
@@ -703,7 +723,10 @@
     register int j;
     int number;
     CARD16 *im_attrID_list;
+    char **name_list;
+    CARD16 name_number;
     XIMAttribute *im_attribute_list;
+    IMGetIMValuesStruct *getim = (IMGetIMValuesStruct *)&call_data->getim;
     CARD16 connect_id = call_data->any.connect_id;
     CARD16 input_method_ID;
 
@@ -716,6 +739,8 @@
     FrameMgrGetToken (fm, byte_length);
     im_attrID_list = (CARD16 *) malloc (sizeof (CARD16)*20);
     memset (im_attrID_list, 0, sizeof (CARD16)*20);
+    name_list = (char **)malloc(sizeof(char *) * 20);
+    memset(name_list, 0, sizeof(char *) * 20);
     number = 0;
     while (FrameMgrIsIterLoopEnd (fm, &status) == False)
     {
@@ -724,14 +749,6 @@
     }
     FrameMgrFree (fm);
 
-#ifdef PROTOCOL_RICH
-    if (i18n_core->address.improto) {
-        IMGetIMValuesStruct *getim = (IMGetIMValuesStruct *) &call_data->getim;
-        char **name_list;
-        CARD16 name_number;
-
-        name_list = (char **) malloc (sizeof (char *)*20);
-        memset (name_list, 0, sizeof (char *)*20);
         name_number = 0;
         for (i = 0;  i < number;  i++) {
             for (j = 0;  j < i18n_core->address.im_attr_num;  j++) {
@@ -745,12 +762,14 @@
         }
         getim->number = name_number;
         getim->im_attr_list = name_list;
-        if (!(i18n_core->address.improto (ims, call_data))) {
     	    XFree (name_list);
+
+
+#ifdef PROTOCOL_RICH
+    if (i18n_core->address.improto) {
+        if (!(i18n_core->address.improto (ims, call_data)))
             return;
 	}
-        XFree (name_list);
-    }
 #endif  /* PROTOCOL_RICH */
 
     im_attribute_list = MakeIMAttributeList (i18n_core,
@@ -805,6 +824,8 @@
     FrameMgrFree (fm);
     XFree (reply);
 
+    for (i = 0; i < iter_count; i++)
+        XFree(im_attribute_list[i].value);
     XFree (im_attribute_list);
 }
 
@@ -950,6 +971,7 @@
                        0,
                        reply,
                        total_size);
+    XFree(reply);
     FrameMgrFree (fm);
 }
 
@@ -1007,6 +1029,7 @@
 
     FrameMgrPutToken (fm, input_method_ID);
     FrameMgrPutToken (fm, resetic->icid);
+    FrameMgrPutToken(fm, resetic->length);
     FrameMgrPutToken (fm, resetic->commit_string);
 
     _Xi18nSendMessage (ims,
@@ -1016,6 +1039,7 @@
                        reply,
                        total_size);
     FrameMgrFree (fm);
+    XFree(reply);
 }
 
 static int WireEventToEvent (Xi18n i18n_core,
@@ -1299,7 +1323,7 @@
     Xi18nAddressRec *address = (Xi18nAddressRec *) & i18n_core->address;
     XIMEncodings *p;
     int i, j;
-    int enc_index;
+    int enc_index=0;
 
     p = (XIMEncodings *) &address->encoding_list;
     for (i = 0;  i < (int) p->count_encodings;  i++)
@@ -1617,58 +1641,100 @@
     switch (call_data.major_code)
     {
     case XIM_CONNECT:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_CONNECT\n");
+#endif
         ConnectMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_DISCONNECT:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_DISCONNECT\n");
+#endif
         DisConnectMessageProc (ims, &call_data);
         break;
 
     case XIM_OPEN:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_OPEN\n");
+#endif
         OpenMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_CLOSE:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_CLOSE\n");
+#endif
         CloseMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_QUERY_EXTENSION:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_QUERY_EXTENSION\n");
+#endif
         QueryExtensionMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_GET_IM_VALUES:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_GET_IM_VALUES\n");
+#endif
         GetIMValuesMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_CREATE_IC:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_CREATE_IC\n");
+#endif
         CreateICMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_SET_IC_VALUES:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_SET_IC_VALUES\n");
+#endif
         SetICValuesMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_GET_IC_VALUES:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_GET_IC_VALUES\n");
+#endif
         GetICValuesMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_SET_IC_FOCUS:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_SET_IC_FOCUS\n");
+#endif
         SetICFocusMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_UNSET_IC_FOCUS:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_UNSET_IC_FOCUS\n");
+#endif
         UnsetICFocusMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_DESTROY_IC:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_DESTROY_IC\n");
+#endif
         DestroyICMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_RESET_IC:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_RESET_IC\n");
+#endif
         ResetICMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_FORWARD_EVENT:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_FORWARD_EVENT\n");
+#endif
         if (client->sync == True)
         {
             AddQueue (client, p);
@@ -1681,34 +1747,58 @@
         break;
 
     case XIM_EXTENSION:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_EXTENSION\n");
+#endif
         ExtensionMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_SYNC:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_SYNC\n");
+#endif
         break;
 
     case XIM_SYNC_REPLY:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_SYNC_REPLY\n");
+#endif
         SyncReplyMessageProc (ims, &call_data, p1);
         ProcessQueue (ims, connect_id);
         break;
 
     case XIM_TRIGGER_NOTIFY:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_TRIGGER_NOTIFY\n");
+#endif
         TriggerNotifyMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_ENCODING_NEGOTIATION:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_ENCODING_NEGOTIATION\n");
+#endif
         EncodingNegotiatonMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_PREEDIT_START_REPLY:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_PREEDIT_START_REPLY\n");
+#endif
         PreeditStartReplyMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_PREEDIT_CARET_REPLY:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_PREEDIT_CARET_REPLY\n");
+#endif
         PreeditCaretReplyMessageProc (ims, &call_data, p1);
         break;
 
     case XIM_STR_CONVERSION_REPLY:
+#ifdef DEBUG
+	DebugLog(3, verbose, "-- XIM_STR_CONVERSION_REPLY\n");
+#endif
         StrConvReplyMessageProc (ims, &call_data, p1);
         break;
     }
Only in IMdkit.orig/lib: i18nPtHdr.o
diff -ubB IMdkit.orig/lib/i18nTr.c IMdkit/i18nTr.c
--- IMdkit.orig/lib/i18nTr.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/i18nTr.c	Fri Jul  5 14:20:06 2002
@@ -177,11 +177,11 @@
     /*endif*/
     return (unsigned char *) p;
 
-    //TODO: Get rid of this label, and the goto's
+    /* TODO: Get rid of this label, and the goto's  */
 read_error:
     _XUnregisterInternalConnection (i18n_core->address.dpy, fd);
-    _XimdXTransDisconnect (tr_client->accept_conn);
-    _XimdXTransClose (tr_client->accept_conn);
+    _XimXTransDisconnect (tr_client->accept_conn);
+    _XimXTransClose (tr_client->accept_conn);
     return (unsigned char *) NULL;
 }
 
@@ -200,7 +200,7 @@
         return False;
     }
     /*endif*/
-    fd = _XimdXTransGetConnectionNumber(spec->trans_conn);
+    fd = _XimXTransGetConnectionNumber(spec->trans_conn);
     return _XRegisterInternalConnection(i18n_core->address.dpy, fd,
                                         (_XInternalConnectionProc)Xi18nWaitTransListen,
                                         (XPointer)ims);
@@ -212,13 +212,13 @@
     TransSpecRec *spec = (TransSpecRec *) i18n_core->address.connect_addr;
     int fd;
 
-    fd = _XimdXTransGetConnectionNumber (spec->trans_conn);
+    fd = _XimXTransGetConnectionNumber (spec->trans_conn);
     if (fd == 0)
         return False;
     /*endif*/
     _XUnregisterInternalConnection (i18n_core->address.dpy, fd);
-    _XimdXTransDisconnect (spec->trans_conn);
-    _XimdXTransClose (spec->trans_conn);
+    _XimXTransDisconnect (spec->trans_conn);
+    _XimXTransClose (spec->trans_conn);
 
     XFree (spec->port);
     XFree (spec);
@@ -255,7 +255,7 @@
     Xi18n i18n_core = ims->protocol;
     Xi18nClient *client = _Xi18nFindClient(i18n_core, connect_id);
     TransClient *tr_client = (TransClient *)client->trans_rec;
-    int fd = _XimdXTransGetConnectionNumber(tr_client->accept_conn);
+    int fd = _XimXTransGetConnectionNumber(tr_client->accept_conn);
 
     for (;;)
     {
@@ -294,8 +294,8 @@
 
     _XUnregisterInternalConnection (i18n_core->address.dpy,
                                     tr_client->accept_fd);
-    _XimdXTransDisconnect (tr_client->accept_conn);
-    _XimdXTransClose (tr_client->accept_conn);
+    _XimXTransDisconnect (tr_client->accept_conn);
+    _XimXTransClose (tr_client->accept_conn);
     XFree (tr_client);
     _Xi18nDeleteClient (i18n_core, connect_id);
     return True;
@@ -308,7 +308,7 @@
 {
     int len;
 
-    if ((len = _XimdXTransRead (accept_conn, buf, buf_len)) <= 0)
+    if ((len = _XimXTransRead (accept_conn, buf, buf_len)) <= 0)
         return False;
     /*endif*/
     *ret_len = len;
@@ -321,7 +321,7 @@
 
     while (len > 0)
     {
-        if ((nbyte = _XimdXTransWrite (accept_conn, buf, len)) <= 0)
+        if ((nbyte = _XimXTransWrite (accept_conn, buf, len)) <= 0)
             return False;
         /*endif*/
         len -= nbyte;
@@ -387,7 +387,7 @@
     tr_client = (TransClient *) malloc (sizeof (TransClient));
 
     tr_client->accept_conn = accept_conn;
-    tr_client->accept_fd = _XimdXTransGetConnectionNumber (accept_conn);
+    tr_client->accept_fd = _XimXTransGetConnectionNumber (accept_conn);
     client->trans_rec = tr_client;
 
     return ((TransClient *) tr_client);
Only in IMdkit.orig/lib: i18nTr.o
diff -ubB IMdkit.orig/lib/i18nUtil.c IMdkit/i18nUtil.c
--- IMdkit.orig/lib/i18nUtil.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/i18nUtil.c	Fri Jul  5 14:20:06 2002
@@ -33,9 +33,11 @@
 #include "IMdkit.h"
 #include "Xi18n.h"
 #include "FrameMgr.h"
+#include "XimFunc.h"
 
 Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
 
+int
 _Xi18nNeedSwap (Xi18n i18n_core, CARD16 connect_id)
 {
     CARD8 im_byteOrder = i18n_core->address.im_byteOrder;
@@ -47,20 +49,23 @@
 Xi18nClient *_Xi18nNewClient(Xi18n i18n_core)
 {
     static CARD16 connect_id = 0;
+    int new_connect_id;
     Xi18nClient *client;
 
     if (i18n_core->address.free_clients)
     {
         client = i18n_core->address.free_clients;
         i18n_core->address.free_clients = client->next;
+	new_connect_id = client->connect_id;
     }
     else
     {
         client = (Xi18nClient *) malloc (sizeof (Xi18nClient));
+	new_connect_id = ++connect_id;
     }
     /*endif*/
     memset (client, 0, sizeof (Xi18nClient));
-    client->connect_id = ++connect_id;
+    client->connect_id = new_connect_id;
     client->pending = (XIMPending *) NULL;
     client->sync = False;
     client->byte_order = '?'; 	/* initial value */
@@ -226,6 +231,7 @@
                        reply,
                        total_size);
     FrameMgrFree (fm);
+    XFree(reply);
 }
 
 void _Xi18nSetEventMask (XIMS ims,
@@ -266,4 +272,5 @@
                        total_size);
 
     FrameMgrFree (fm);
+    XFree(reply);
 }
Only in IMdkit.orig/lib: i18nUtil.o
diff -ubB IMdkit.orig/lib/i18nX.c IMdkit/i18nX.c
--- IMdkit.orig/lib/i18nX.c	Mon Apr 22 13:04:13 2002
+++ IMdkit/i18nX.c	Fri Jul  5 14:20:06 2002
@@ -35,6 +35,7 @@
 #include "IMdkit.h"
 #include "Xi18n.h"
 #include "Xi18nX.h"
+#include "XimFunc.h"
 
 extern Xi18nClient *_Xi18nFindClient(Xi18n, CARD16);
 extern Xi18nClient *_Xi18nNewClient(Xi18n);
@@ -70,7 +71,7 @@
 {
     Xi18n i18n_core = ims->protocol;
     Xi18nClient *client = i18n_core->address.clients;
-    XClient *x_client;
+    XClient *x_client = NULL;
     FrameMgr fm;
     extern XimFrameRec packet_header_fr[];
     unsigned char *p = NULL;
@@ -195,7 +196,7 @@
                             ClientMessage,
                             ClientMessage,
                             WaitXIMProtocol,
-                            ims);
+                            (XPointer)ims);
     event.xclient.type = ClientMessage;
     event.xclient.display = dpy;
     event.xclient.window = new_client;
@@ -232,7 +233,7 @@
                             ClientMessage,
                             ClientMessage,
                             WaitXConnectMessage,
-                            ims);
+                            (XPointer)ims);
     return True;
 }
 
@@ -244,7 +245,7 @@
     _XUnregisterFilter (dpy,
                         i18n_core->address.im_window,
                         WaitXConnectMessage,
-                        ims);
+                        (XPointer)ims);
     return True;
 }
 
@@ -417,7 +418,7 @@
     _XUnregisterFilter (dpy,
 		        x_client->accept_win,
                         WaitXIMProtocol,
-		        ims);
+		        (XPointer)ims);
     XFree (x_client);
     _Xi18nDeleteClient (i18n_core, connect_id);
     return True;
Only in IMdkit.orig/lib: i18nX.o
Only in IMdkit.orig/lib: i18ntrans.c
Only in IMdkit.orig/lib: i18ntrans.o
Binary files IMdkit.orig/lib/libXimd.a and IMdkit/libXimd.a differ
Only in IMdkit.orig/lib: tags
Only in IMdkit.orig/lib: transport.c
