diff -Nuar gtk+-2.1.3/modules/input/gtkimcontextxim.c gtk+-2.1.3-thximconv/modules/input/gtkimcontextxim.c
--- gtk+-2.1.3/modules/input/gtkimcontextxim.c	2002-12-23 19:37:05.000000000 +0700
+++ gtk+-2.1.3-thximconv/modules/input/gtkimcontextxim.c	2002-12-23 19:38:48.000000000 +0700
@@ -1028,6 +1028,78 @@
     }
 }
 
+static void
+string_conversion_callback(XIC xic, XPointer client_data, XPointer call_data)
+{
+  GtkIMContextXIM *context_xim;
+  XIMStringConversionCallbackStruct *conv_data;
+  gchar *surrounding;
+  gint  cursor_index;
+
+  context_xim = (GtkIMContextXIM *)client_data;
+  conv_data = (XIMStringConversionCallbackStruct *)call_data;
+
+  switch (conv_data->operation)
+    {
+    case XIMStringConversionRetrieval:
+      if (gtk_im_context_get_surrounding ((GtkIMContext *)context_xim,
+                                          &surrounding, &cursor_index))
+        {
+          gchar *text = NULL;
+          gsize text_len = 0;
+          gint  i;
+          gchar *p = surrounding + cursor_index, *q;
+    
+          switch (conv_data->direction)
+            {
+            case XIMForwardChar:
+              for (i = conv_data->factor, q = p; i > 0 && *q; --i)
+                g_utf8_next_char (q);
+              text = g_locale_from_utf8 (p, q - p, NULL, &text_len, NULL);
+              break;
+            case XIMBackwardChar:
+              for (i = conv_data->factor, q = p; i > 0 && q > surrounding; --i)
+                q = g_utf8_prev_char (q);
+              text = g_locale_from_utf8 (q, p - q, NULL, &text_len, NULL);
+              break;
+            case XIMForwardWord:
+            case XIMBackwardWord:
+            case XIMCaretUp:
+            case XIMCaretDown:
+            case XIMNextLine:
+            case XIMPreviousLine:
+            case XIMLineStart:
+            case XIMLineEnd:
+            case XIMAbsolutePosition:
+            case XIMDontChange:
+            default:
+              break;
+            }
+          if (text)
+            {
+              conv_data->text = (XIMStringConversionText *)
+                                  malloc (sizeof (XIMStringConversionText));
+              conv_data->text->length = text_len;
+              conv_data->text->feedback = 0;
+              conv_data->text->encoding_is_wchar = False;
+              conv_data->text->string.mbs = (char *)malloc (text_len);
+              memcpy (conv_data->text->string.mbs, text, text_len);
+
+              g_free (text);
+            }
+    
+          g_free(surrounding);
+        }
+      break;
+
+    case XIMStringConversionSubstitution:
+      break;
+
+    default:
+      break;
+    }
+}
+
 static XVaNestedList
 set_preedit_callback (GtkIMContextXIM *context_xim)
 {
@@ -1064,6 +1136,18 @@
 			      NULL);
 }
 
+static void
+set_string_conversion_callback (GtkIMContextXIM *context_xim, XIC xic)
+{
+  context_xim->string_conversion_callback.client_data = (XPointer)context_xim;
+  context_xim->string_conversion_callback.callback
+    = (XICProc)string_conversion_callback;
+
+  XSetICValues (xic,
+                XNStringConversionCallback,
+                (XPointer)&context_xim->string_conversion_callback, NULL);
+}
+
 static XIC
 get_ic_real (GtkIMContextXIM *context_xim)
 {
@@ -1128,6 +1212,8 @@
 		    XNFilterEvents, &mask,
 		    NULL);
       context_xim->filter_key_release = (mask & KeyReleaseMask);
+      if (strncmp (context_xim->locale, "th", 2) == 0)
+        set_string_conversion_callback (context_xim, xic);
     }
 
   return xic;
diff -Nuar gtk+-2.1.3/modules/input/gtkimcontextxim.h gtk+-2.1.3-thximconv/modules/input/gtkimcontextxim.h
--- gtk+-2.1.3/modules/input/gtkimcontextxim.h	2002-12-23 19:37:14.000000000 +0700
+++ gtk+-2.1.3-thximconv/modules/input/gtkimcontextxim.h	2002-12-23 19:37:33.000000000 +0700
@@ -73,6 +73,8 @@
   XIC ic;
   gboolean filter_key_release;
 
+  XICCallback string_conversion_callback;
+
   guint use_preedit : 1;
   guint status_visible : 1;
 };
