diff -Nuar gtk+-2.2.0/modules/input/gtkimcontextthai.c gtk+-2.2.0-imthai/modules/input/gtkimcontextthai.c
--- gtk+-2.2.0/modules/input/gtkimcontextthai.c	1970-01-01 07:00:00.000000000 +0700
+++ gtk+-2.2.0-imthai/modules/input/gtkimcontextthai.c	2003-01-14 18:01:52.000000000 +0700
@@ -0,0 +1,365 @@
+/* GTK - The GIMP Toolkit
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:  Theppitak Karoonboonyanan <thep@linux.thai.net>
+ *
+ */
+
+#include <string.h>
+
+#include <gdk/gdkkeysyms.h>
+#include <gdk/gdkkeys.h>
+#include <gtkimcontextthai.h>
+#include "wtt.h"
+
+static void     gtk_im_context_thai_class_init          (GtkIMContextThaiClass *class);
+static void     gtk_im_context_thai_init                (GtkIMContextThai      *im_context_xim);
+static gboolean gtk_im_context_thai_filter_keypress     (GtkIMContext          *context,
+						         GdkEventKey           *key);
+static void     gtk_im_context_thai_reset               (GtkIMContext          *context);
+
+
+static GObjectClass *parent_class;
+
+GType gtk_type_im_context_thai = 0;
+
+void
+gtk_im_context_thai_register_type (GTypeModule *type_module)
+{
+  static const GTypeInfo im_context_thai_info =
+  {
+    sizeof (GtkIMContextThaiClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) gtk_im_context_thai_class_init,
+    NULL,           /* class_finalize */    
+    NULL,           /* class_data */
+    sizeof (GtkIMContextThai),
+    0,
+    (GInstanceInitFunc) gtk_im_context_thai_init,
+  };
+
+  gtk_type_im_context_thai = 
+    g_type_module_register_type (type_module,
+                                 GTK_TYPE_IM_CONTEXT,
+                                 "GtkIMContextThai",
+                                 &im_context_thai_info, 0);
+}
+
+static void
+gtk_im_context_thai_class_init (GtkIMContextThaiClass *class)
+{
+  GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class);
+
+  parent_class = g_type_class_peek_parent (class);
+
+  im_context_class->filter_keypress = gtk_im_context_thai_filter_keypress;
+  im_context_class->reset = gtk_im_context_thai_reset;
+}
+
+static void
+gtk_im_context_thai_init (GtkIMContextThai *im_context_thai)
+{
+  memset (im_context_thai->char_buff, 0, GTK_IM_CONTEXT_THAI_BUFF_SIZE);
+  im_context_thai->isc_mode = ISC_BASICCHECK;
+}
+
+GtkIMContext *
+gtk_im_context_thai_new (void)
+{
+  GtkIMContextThai *result;
+
+  result = GTK_IM_CONTEXT_THAI (g_object_new (GTK_TYPE_IM_CONTEXT_THAI, NULL));
+
+  return GTK_IM_CONTEXT (result);
+}
+
+GtkIMContextThaiISCMode
+gtk_im_context_thai_get_isc_mode (GtkIMContextThai *context_thai)
+{
+  return context_thai->isc_mode;
+}
+
+GtkIMContextThaiISCMode
+gtk_im_context_thai_set_isc_mode (GtkIMContextThai *context_thai,
+                                  GtkIMContextThaiISCMode mode)
+{
+  GtkIMContextThaiISCMode prev_mode = context_thai->isc_mode;
+  context_thai->isc_mode = mode;
+  return prev_mode;
+}
+
+static gboolean
+is_context_lost_key(guint keyval)
+{
+  return ((keyval & 0xFF00) == 0xFF00) &&
+         (keyval == GDK_BackSpace ||
+          keyval == GDK_Tab ||
+          keyval == GDK_Linefeed ||
+          keyval == GDK_Clear ||
+          keyval == GDK_Return ||
+          keyval == GDK_Pause ||
+          keyval == GDK_Scroll_Lock ||
+          keyval == GDK_Sys_Req ||
+          keyval == GDK_Escape ||
+          keyval == GDK_Delete ||
+          (GDK_Home <= keyval && keyval <= GDK_Begin) || /* IsCursorkey */
+          (GDK_KP_Space <= keyval && keyval <= GDK_KP_Equal) || /* IsKeypadKey */
+          (GDK_Select <= keyval && keyval <= GDK_Break) || /* IsMiscFunctionKey */
+          (GDK_F1 <= keyval && keyval <= GDK_F35)); /* IsFunctionKey */
+}
+
+static gboolean
+is_context_intact_key(guint keyval)
+{
+  return (((keyval & 0xFF00) == 0xFF00) &&
+           ((GDK_Shift_L <= keyval && keyval <= GDK_Hyper_R) || /* IsModifierKey */
+            (keyval == GDK_Mode_switch) ||
+            (keyval == GDK_Num_Lock))) ||
+         (((keyval & 0xFE00) == 0xFE00) &&
+          (GDK_ISO_Lock <= keyval && keyval <= GDK_ISO_Last_Group_Lock));
+}
+
+static tischar_t
+gdk_keyval_to_tis (guint keyval)
+{
+  gchar     key_utf8[6];
+  int       len;
+  tischar_t key_tis;
+
+  key_tis = 0;
+
+  len = g_unichar_to_utf8 (gdk_keyval_to_unicode (keyval), key_utf8);
+  if (len > 0)
+    {
+      tischar_t *key_tis_str;
+      key_tis_str = g_convert (key_utf8, len, "TIS-620", "UTF-8",
+                               NULL, NULL, NULL);
+      if (key_tis_str)
+        {
+          key_tis = key_tis_str[0];
+          g_free (key_tis_str);
+        }
+    }
+
+  return key_tis;
+}
+#define thai_chtype(c)  TACchtype(c)
+#if 0
+static gshort
+thai_chtype (tischar_t c)
+{
+  return TACchtype(c);
+}
+#endif
+
+static gboolean
+thai_is_accept (tischar_t new_char, tischar_t prev_char, gint isc_mode)
+{
+  switch (isc_mode)
+    {
+    case ISC_PASSTHROUGH:
+      return TRUE;
+
+    case ISC_BASICCHECK:
+      return TACio_op(prev_char, new_char) != RJ;
+
+    case ISC_STRICT:
+      {
+        int op = TACio_op(prev_char, new_char);
+        return op != RJ && op != SR;
+      }
+
+    default:
+      return FALSE;
+    }
+}
+
+#define thai_is_composible(n,p)  (TACio_op ((p), (n)) == CP)
+#if 0
+static gboolean
+thai_is_composible (tischar_t new_char, tischar_t prev_char, gint isc_mode)
+{
+  return TACio_op (prev_char, new_char) == CP;
+}
+#endif
+
+static tischar_t
+get_prev_char (GtkIMContextThai *context_thai, gint offset)
+{
+  gchar *surrounding;
+  gint  cursor_index;
+
+  if (gtk_im_context_get_surrounding ((GtkIMContext *)context_thai,
+                                      &surrounding, &cursor_index))
+    {
+      gchar *tis_text, tis_char;
+      gchar *p, *q;
+
+      tis_char = 0;
+      p = surrounding + cursor_index;
+      for (q = p; offset < 0 && q > surrounding; ++offset)
+        q = g_utf8_prev_char (q);
+      if (offset == 0)
+        {
+          tis_text = g_convert (q, p - q, "TIS-620", "UTF-8", NULL, NULL, NULL);
+          if (tis_text)
+            {
+              tis_char = tis_text[0];
+              g_free (tis_text);
+            }
+        }
+      g_free (surrounding);
+      return tis_char;
+    }
+  else
+    {
+      offset = -offset - 1;
+      if (0 <= offset && offset < GTK_IM_CONTEXT_THAI_BUFF_SIZE)
+        return context_thai->char_buff[offset];
+      return 0;
+    }
+}
+
+static void
+forget_previous_char (GtkIMContextThai *context_thai)
+{
+  memset (context_thai->char_buff, 0, GTK_IM_CONTEXT_THAI_BUFF_SIZE);
+}
+
+static void
+remember_previous_char (GtkIMContextThai *context_thai, tischar_t new_char)
+{
+  memmove (context_thai->char_buff + 1, context_thai->char_buff,
+           GTK_IM_CONTEXT_THAI_BUFF_SIZE - 1);
+  context_thai->char_buff[0] = new_char;
+}
+
+static gboolean
+gtk_im_context_thai_commit_chars (GtkIMContextThai *context_thai,
+                                  tischar_t *s, gsize len)
+{
+  gchar *utf8;
+
+  utf8 = g_convert (s, len, "UTF-8", "TIS-620", NULL, NULL, NULL);
+  if (!utf8) return FALSE;
+
+  g_signal_emit_by_name (context_thai, "commit", utf8);
+
+  g_free (utf8);
+  return TRUE;
+}
+
+static gboolean
+accept_input (GtkIMContextThai *context_thai, tischar_t new_char)
+{
+  return gtk_im_context_thai_commit_chars (context_thai, &new_char, 1);
+}
+
+static gboolean
+reorder_input (GtkIMContextThai *context_thai,
+               tischar_t prev_char, tischar_t new_char)
+{
+  tischar_t buf[2];
+
+  if (!gtk_im_context_delete_surrounding (GTK_IM_CONTEXT (context_thai), -1, 1))
+    return FALSE;
+
+  buf[0] = new_char;
+  buf[1] = prev_char;
+  return gtk_im_context_thai_commit_chars (context_thai, buf, 2);
+}
+
+static gboolean
+replace_input (GtkIMContextThai *context_thai, tischar_t new_char)
+{
+  if (!gtk_im_context_delete_surrounding (GTK_IM_CONTEXT (context_thai), -1, 1))
+    return FALSE;
+  return gtk_im_context_thai_commit_chars (context_thai, &new_char, 1);
+}
+
+static gboolean
+gtk_im_context_thai_filter_keypress (GtkIMContext *context,
+                                     GdkEventKey  *event)
+{
+  GtkIMContextThai *context_thai = GTK_IM_CONTEXT_THAI (context);
+  tischar_t prev_char, new_char;
+  gboolean  is_reject;
+  GtkIMContextThaiISCMode isc_mode;
+
+  if (event->type != GDK_KEY_PRESS)
+    return FALSE;
+
+  if (event->state & (GDK_MODIFIER_MASK & ~GDK_SHIFT_MASK) ||
+      is_context_lost_key (event->keyval))
+    {
+      forget_previous_char (context_thai);
+      return FALSE;
+    }
+  if (event->keyval == 0 || is_context_intact_key (event->keyval))
+    {
+      return FALSE;
+    }
+
+  prev_char = get_prev_char (context_thai, -1);
+  if (!prev_char) prev_char = ' ';
+  new_char = gdk_keyval_to_tis (event->keyval);
+  is_reject = TRUE;
+  isc_mode = gtk_im_context_thai_get_isc_mode (context_thai);
+  if (thai_is_accept (new_char, prev_char, isc_mode))
+    {
+      accept_input (context_thai, new_char);
+      is_reject = FALSE;
+    }
+  else
+    {
+      tischar_t context_char;
+
+      /* rejected, trying to correct */
+      context_char = get_prev_char (context_thai, -2);
+      if (context_char)
+        {
+          if (thai_is_composible (new_char, context_char))
+            {
+              if (thai_is_composible (prev_char, new_char))
+                is_reject = !reorder_input (context_thai, prev_char, new_char);
+              else if (thai_is_composible (prev_char, context_char))
+                is_reject = !replace_input (context_thai, new_char);
+              else if (thai_chtype (prev_char) == FV1
+                       && thai_chtype(new_char) == TONE)
+                is_reject = !reorder_input (context_thai, prev_char, new_char);
+            }
+	  else if (thai_is_accept (new_char, context_char, isc_mode))
+            is_reject = !replace_input (context_thai, new_char);
+        }
+    }
+  if (is_reject)
+    {
+      /* reject character */
+      gdk_beep ();
+      return TRUE;
+    }
+  remember_previous_char (context_thai, new_char);
+  return TRUE;
+}
+
+static void
+gtk_im_context_thai_reset (GtkIMContext *context)
+{
+  forget_previous_char (GTK_IM_CONTEXT_THAI (context));
+}
+
diff -Nuar gtk+-2.2.0/modules/input/gtkimcontextthai.h gtk+-2.2.0-imthai/modules/input/gtkimcontextthai.h
--- gtk+-2.2.0/modules/input/gtkimcontextthai.h	1970-01-01 07:00:00.000000000 +0700
+++ gtk+-2.2.0-imthai/modules/input/gtkimcontextthai.h	2003-01-14 17:53:48.000000000 +0700
@@ -0,0 +1,83 @@
+/* GTK - The GIMP Toolkit
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:  Theppitak Karoonboonyanan <thep@linux.thai.net>
+ *
+ */
+
+#ifndef __GTK_IM_CONTEXT_THAI_H__
+#define __GTK_IM_CONTEXT_THAI_H__
+
+#include <gtk/gtkimcontext.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+extern GType gtk_type_im_context_thai;
+
+#define GTK_TYPE_IM_CONTEXT_THAI             gtk_type_im_context_thai
+#define GTK_IM_CONTEXT_THAI(obj)             (GTK_CHECK_CAST ((obj), GTK_TYPE_IM_CONTEXT_THAI, GtkIMContextThai))
+#define GTK_IM_CONTEXT_THAI_CLASS(klass)     (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT_THAI, GtkIMContextThaiClass))
+#define GTK_IS_IM_CONTEXT_THAI(obj)          (GTK_CHECK_TYPE ((obj), GTK_TYPE_IM_CONTEXT_THAI))
+#define GTK_IS_IM_CONTEXT_THAI_CLASS(klass)  (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT_THAI))
+#define GTK_IM_CONTEXT_THAI_GET_CLASS(obj)   (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT_THAI, GtkIMContextThaiClass))
+
+
+typedef guchar tischar_t;
+
+typedef struct _GtkIMContextThai       GtkIMContextThai;
+typedef struct _GtkIMContextThaiClass  GtkIMContextThaiClass;
+
+typedef enum
+{
+  ISC_PASSTHROUGH,
+  ISC_BASICCHECK,
+  ISC_STRICT
+} GtkIMContextThaiISCMode;
+#define GTK_IM_CONTEXT_THAI_BUFF_SIZE 2
+
+struct _GtkIMContextThai
+{
+  GtkIMContext object;
+
+  tischar_t               char_buff[GTK_IM_CONTEXT_THAI_BUFF_SIZE];
+  GtkIMContextThaiISCMode isc_mode;
+};
+
+struct _GtkIMContextThaiClass
+{
+  GtkIMContextClass parent_class;
+};
+
+void gtk_im_context_thai_register_type (GTypeModule *type_module);
+GtkIMContext *gtk_im_context_thai_new (void);
+
+GtkIMContextThaiISCMode
+  gtk_im_context_thai_get_isc_mode (GtkIMContextThai *context_thai);
+
+GtkIMContextThaiISCMode
+  gtk_im_context_thai_set_isc_mode (GtkIMContextThai *context_thai,
+                                    GtkIMContextThaiISCMode mode);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __GTK_IM_CONTEXT_THAI_H__ */
diff -Nuar gtk+-2.2.0/modules/input/imthai.c gtk+-2.2.0-imthai/modules/input/imthai.c
--- gtk+-2.2.0/modules/input/imthai.c	1970-01-01 07:00:00.000000000 +0700
+++ gtk+-2.2.0-imthai/modules/input/imthai.c	2003-01-14 17:48:16.000000000 +0700
@@ -0,0 +1,70 @@
+/* GTK - The GIMP Toolkit
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Theppitak Karoonboonyanan <thep@linux.thai.net>
+ *
+ */
+
+#include <string.h>
+
+#include <gdk/gdkkeysyms.h>
+
+#include "gtk/gtkintl.h"
+#include "gtk/gtkimmodule.h"
+#include "gtkimcontextthai.h"
+
+GType type_thai = 0;
+
+static const GtkIMContextInfo thai_info = { 
+  "thai",	   /* ID */
+  N_("Thai"),	   /* Human readable name */
+  "gtk+",	   /* Translation domain */
+   GTK_LOCALEDIR,  /* Dir for bindtextdomain (not strictly needed for "gtk+") */
+  ""		   /* Languages for which this module is the default */
+};
+
+static const GtkIMContextInfo *info_list[] = {
+  &thai_info
+};
+
+void
+im_module_init (GTypeModule *module)
+{
+  gtk_im_context_thai_register_type (module);
+}
+
+void 
+im_module_exit (void)
+{
+}
+
+void 
+im_module_list (const GtkIMContextInfo ***contexts,
+		int                      *n_contexts)
+{
+  *contexts = info_list;
+  *n_contexts = G_N_ELEMENTS (info_list);
+}
+
+GtkIMContext *
+im_module_create (const gchar *context_id)
+{
+  if (strcmp (context_id, "thai") == 0)
+    return gtk_im_context_thai_new ();
+  else
+    return NULL;
+}
diff -Nuar gtk+-2.2.0/modules/input/Makefile.am gtk+-2.2.0-imthai/modules/input/Makefile.am
--- gtk+-2.2.0/modules/input/Makefile.am	2003-01-14 17:41:27.000000000 +0700
+++ gtk+-2.2.0-imthai/modules/input/Makefile.am	2003-01-14 17:42:45.000000000 +0700
@@ -61,6 +61,15 @@
 im_thai_broken_la_SOURCES = imthai-broken.c
 im_thai_broken_la_LIBADD = $(LDADDS)
 
+im_thai_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
+im_thai_la_SOURCES = 		\
+	wtt.c 			\
+	wtt.h 			\
+	gtkimcontextthai.c 	\
+	gtkimcontextthai.h	\
+	imthai.c
+im_thai_la_LIBADD = $(LDADDS)
+
 im_viqr_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_viqr_la_SOURCES = imviqr.c
 im_viqr_la_LIBADD = $(LDADDS)
@@ -108,6 +117,7 @@
 	im-inuktitut.la				\
 	im-ipa.la				\
 	im-thai-broken.la			\
+	im-thai.la				\
 	im-ti-er.la				\
 	im-ti-et.la				\
 	im-viqr.la
diff -Nuar gtk+-2.2.0/modules/input/wtt.c gtk+-2.2.0-imthai/modules/input/wtt.c
--- gtk+-2.2.0/modules/input/wtt.c	1970-01-01 07:00:00.000000000 +0700
+++ gtk+-2.2.0-imthai/modules/input/wtt.c	2003-01-14 17:48:57.000000000 +0700
@@ -0,0 +1,80 @@
+/*
+ * wtt.h - WTT I/O implementation
+ * Created: 2001-08-04
+ * Author:  Theppitak Karoonboonyanan <thep@linux.thai.net>
+ */
+
+#include "wtt.h"
+
+gshort TACchtype_[256] = {
+    CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL,  /*  0 -  7 */
+    CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL,  /*  8 - 15 */
+    CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL,  /* 16 - 23 */
+    CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL,  /* 24 - 31 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 32 - 39 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 40 - 47 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 48 - 55 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 56 - 63 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 64 - 71 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 72 - 79 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 80 - 87 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 88 - 95 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 96 - 103 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 104 - 111 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 112 - 119 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  CTRL,  /* 120 - 127 */
+    CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL,  /* 128 - 135 */
+    CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL,  /* 136 - 143 */
+    CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL,  /* 144 - 151 */
+    CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL,  /* 152 - 159 */
+    NON,  CONS, CONS, CONS, CONS, CONS, CONS, CONS,  /* 160 - 167 */
+    CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS,  /* 168 - 175 */
+    CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS,  /* 176 - 183 */
+    CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS,  /* 184 - 191 */
+    CONS, CONS, CONS, CONS,  FV3, CONS,  FV3, CONS,  /* 192 - 199 */
+    CONS, CONS, CONS, CONS, CONS, CONS, CONS, NON,   /* 200 - 207 */
+    FV1,  AV2,  FV1,  FV1,  AV1,  AV3,  AV2,  AV3,   /* 208 - 215 */
+    BV1,  BV2,  BD,   NON,  NON,  NON,  NON,  NON,   /* 216 - 223 */
+    LV,   LV,   LV,   LV,   LV,   FV2,  NON,  AD2,   /* 224 - 231 */
+    TONE, TONE, TONE, TONE, AD1,  AD1,  AD3,  NON,   /* 232 - 239 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  NON,   /* 240 - 247 */
+    NON,  NON,  NON,  NON,  NON,  NON,  NON,  CTRL   /* 248 - 255 */
+};
+
+/* Table for Thai Cell Manipulation */
+gshort TACio_op_[17][17] = {
+      /* Table 2: WTT I/O sequence check rules */
+      /* row: leading char,  column: following char */
+/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */
+   {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/
+  ,{XC, AC, AC, AC, AC, SR, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/
+  ,{XC, SR, AC, SR, SR, SR, SR, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/
+  ,{XC, SR, AC, SR, AC, SR, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/
+  ,{XC, AC, AC, AC, AC, SR, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/
+  ,{XC, AC, AC, AC, SR, AC, SR, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV3*/
+  ,{XC, AC, AC, AC, AC, SR, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/
+  ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*TONE*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD1*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD2*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/
+  ,{XC, AC, AC, AC, SR, SR, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/
+};
+
+#undef TACchtype
+#undef TACio_op
+
+gshort TACchtype(guchar c)
+{
+    return TACchtype_[c];
+}
+
+gshort TACio_op(guchar c1, guchar c2)
+{
+    return TACio_op_[TACchtype_[c1]][TACchtype_[c2]];
+}
+
diff -Nuar gtk+-2.2.0/modules/input/wtt.h gtk+-2.2.0-imthai/modules/input/wtt.h
--- gtk+-2.2.0/modules/input/wtt.h	1970-01-01 07:00:00.000000000 +0700
+++ gtk+-2.2.0-imthai/modules/input/wtt.h	2003-01-14 17:48:53.000000000 +0700
@@ -0,0 +1,62 @@
+/*
+ * wtt.h - WTT I/O implementation
+ * Created: 2001-08-04
+ * Author:  Theppitak Karoonboonyanan <thep@linux.thai.net>
+ */
+
+#ifndef __THAI_WTT_H__
+#define __THAI_WTT_H__
+
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Classification of characters in TIS620 according to WTT */
+
+#define CTRL    0   /* control chars */
+#define NON     1   /* non composibles */
+#define CONS    2   /* consonants */
+#define LV      3   /* leading vowels */
+#define FV1     4   /* following vowels */
+#define FV2     5
+#define FV3     6
+#define BV1     7   /* below vowels */
+#define BV2     8
+#define BD      9   /* below diacritics */
+#define TONE    10  /* tonemarks */
+#define AD1     11  /* above diacritics */
+#define AD2     12
+#define AD3     13
+#define AV1     14  /* above vowels */
+#define AV2     15
+#define AV3     16
+
+/* Composibility checking tables */
+#define CP  1   /* COMPOSIBLE - following char is displayed in the same cell
+                                as leading char, also implies ACCEPT */
+#define XC  2   /* Non-display */
+#define AC  3   /* ACCEPT - display the following char in the next cell */
+#define RJ  4   /* REJECT - discard that following char, ignore it */
+#define SR  5   /* STRICT REJECT - REJECT only if in strict mode */
+
+extern gshort TACchtype(guchar c);
+extern gshort TACio_op(guchar c1, guchar c2);
+
+/*
+ * implementation parts
+ */
+
+extern gshort TACchtype_[256];
+extern gshort TACio_op_[17][17];
+
+#define TACchtype(c)     (TACchtype_[c])
+#define TACio_op(c1, c2) (TACio_op_[TACchtype(c1)][TACchtype(c2)])
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif  /* __THAI_WTT_H__ */
+
