--- gcin-1.5.6.pre8.orig/Makefile
+++ gcin-1.5.6.pre8/Makefile
@@ -34,6 +34,7 @@
 
 OBJS_gcin_gb_toggle = gcin-gb-toggle.o gcin-conf.o util.o gcin-send.o
 OBJS_gcin_kbm_toggle = gcin-kbm-toggle.o gcin-conf.o util.o gcin-send.o
+OBJS_gcin_tan_toggle = gcin-tan-toggle.o gcin-conf.o util.o gcin-send.o
 OBJS_gcin_message = gcin-message.o gcin-conf.o util.o gcin-send.o
 OBJS_pin_juyin = pin-juyin.o util.o pho-lookup.o locale.o pho-sym.o
 
@@ -110,7 +111,7 @@
 
 PROGS=gcin tsd2a32 tsa2d32 phoa2d phod2a tslearn gcin-setup gcin2tab \
 	juyin-learn sim2trad gcin-gb-toggle gcin-message gtab-merge \
-	gcin-kbm-toggle tsin2gtab-phrase
+	gcin-kbm-toggle tsin2gtab-phrase gcin-tan-toggle
 PROGS_SYM=trad2sim
 PROGS_CV=kbmcv pin-juyin
 
@@ -189,6 +190,10 @@
 	export LD_RUN_PATH=$(gcin_ld_run_path) ;\
 	$(CCLD) -o $@ $(OBJS_gcin_kbm_toggle) -L./im-client -lgcin-im-client $(LDFLAGS)
 
+gcin-tan-toggle:	$(OBJS_gcin_tan_toggle)
+	export LD_RUN_PATH=$(gcin_ld_run_path) ;\
+	$(CCLD) -o $@ $(OBJS_gcin_tan_toggle) -L./im-client -lgcin-im-client $(LDFLAGS)
+
 gcin-message:	$(OBJS_gcin_message)
 	export LD_RUN_PATH=$(gcin_ld_run_path) ;\
 	$(CCLD) -o $@ $(OBJS_gcin_message) -L./im-client -lgcin-im-client $(LDFLAGS)
@@ -203,13 +208,13 @@
 	$(MAKE) -C im-client
 
 gcin1_so += intcode.pico win-int.pico win-message.pico win-sym.pico \
-win-inmd-switch.pico pinyin.pico win-pho-near.pico win-kbm.pico
+win-inmd-switch.pico pinyin.pico win-pho-near.pico win-kbm.pico win-tan.pico
 
 ifeq ($(USE_ANTHY),Y)
 gcin1_so += anthy.pico
 endif
 
-gcin1.so: $(gcin1_so) pho.o tsin.o eve.o gtab.o win-sym.o
+gcin1.so: $(gcin1_so) pho.o tsin.o eve.o gtab.o win-sym.o win-tan.o
 	$(CCLD) $(SO_FLAGS) -o $@ $(gcin1_so) $(LDFLAGS)
 
 gcin2_so= t2s-lookup.pico
--- gcin-1.5.6.pre8.orig/anthy.cpp
+++ gcin-1.5.6.pre8/anthy.cpp
@@ -1095,6 +1095,7 @@
     if (!anthy_visible())
       gtk_widget_show(win_anthy);
     show_win_sym();
+    SHOW_WIN_TAN();
   }
 }
 
@@ -1106,6 +1107,7 @@
   }
   gtk_widget_hide(win_anthy);
   hide_win_sym();
+  HIDE_WIN_TAN();
 }
 
 void change_anthy_font_size()
@@ -1149,6 +1151,7 @@
   win_y = y;
 
   move_win_sym();
+  MOVE_WIN_TAN();
 }
 
 void tsin_set_eng_ch(int nmod);
--- gcin-1.5.6.pre8.orig/gcin-tan-toggle.cpp
+++ gcin-1.5.6.pre8/gcin-tan-toggle.cpp
@@ -0,0 +1,9 @@
+#include "gcin.h"
+
+int main()
+{
+  gdk_init(NULL, NULL);
+  send_gcin_message(GDK_DISPLAY(), "#gcin_tan_toggle");
+
+  return 0;
+}
--- gcin-1.5.6.pre8.orig/gcin.cpp
+++ gcin-1.5.6.pre8/gcin.cpp
@@ -379,6 +379,13 @@
    if (strstr(message, "#gcin_message")) {
      execute_message(message);
    } else
+   if (strstr(message, "#gcin_tan_toggle")) {
+     win_tan_enabled^=1;
+     if (win_tan_enabled)
+       SHOW_WIN_TAN();
+     else
+       HIDE_WIN_TAN();
+   } else
 #endif
    if (!strcmp(message, RELOAD_TSIN_DB)) {
      reload_tsin_db();
--- gcin-1.5.6.pre8.orig/gcin.h
+++ gcin-1.5.6.pre8/gcin.h
@@ -8,6 +8,7 @@
 #if UNIX
 #include "IMdkit.h"
 #include "Xi18n.h"
+#include "win-tan.h"
 #endif
 #if GCIN_i18n_message
 #include <libintl.h>
--- gcin-1.5.6.pre8.orig/win-gtab.cpp
+++ gcin-1.5.6.pre8/win-gtab.cpp
@@ -249,6 +249,7 @@
   win_x = x;  win_y = y;
 
   move_win_sym();
+  MOVE_WIN_TAN();
 }
 
 void set_gtab_input_method_name(char *s)
@@ -550,6 +551,11 @@
 
   create_win_gtab();
   create_win_gtab_gui();
+  CREATE_WIN_TAN();
+  if (win_tan_enabled)
+    SHOW_WIN_TAN();
+  else
+    HIDE_WIN_TAN();
 #if WIN32
   // window was destroyed
   if (gcin_pop_up_win)
@@ -629,6 +635,7 @@
 
   close_gtab_pho_win();
   hide_win_sym();
+  HIDE_WIN_TAN();
 }
 
 void minimize_win_gtab()
--- gcin-1.5.6.pre8.orig/win-pho.cpp
+++ gcin-1.5.6.pre8/win-pho.cpp
@@ -82,6 +82,7 @@
 
   gtk_window_move(GTK_WINDOW(gwin_pho), x, y);
   move_win_sym();
+  MOVE_WIN_TAN();
 }
 
 void minimize_win_pho()
@@ -235,6 +236,11 @@
 //  dbg("show_win_pho\n");
   create_win_pho();
   create_win_pho_gui();
+  CREATE_WIN_TAN();
+  if (win_tan_enabled)
+    SHOW_WIN_TAN();
+  else
+    HIDE_WIN_TAN();
 
   if (gcin_pop_up_win && !pho_has_input())
     return;
@@ -269,6 +275,7 @@
     return;
   gtk_widget_hide(gwin_pho);
   hide_win_sym();
+  HIDE_WIN_TAN();
 }
 
 
--- gcin-1.5.6.pre8.orig/win-tan.cpp
+++ gcin-1.5.6.pre8/win-tan.cpp
@@ -0,0 +1,142 @@
+#include "gcin.h"
+// #include "gtab.h"
+
+static GtkWidget *gwin_tan = NULL;
+
+static int cur_in_method;
+gboolean win_tan_enabled=1;
+
+void move_win_tan()
+{
+#if 0
+  dbg("move_win_tan %d\n", current_CS->in_method);
+#endif
+  if (!gwin_tan)
+    return;
+
+  int wx, wy;
+#if 0
+  if (gcin_pop_up_win) {
+    wx = dpy_xl;
+  } else
+#endif
+  {
+  //  dbg("win_y: %d  %d\n", win_y, win_yl);
+    update_active_in_win_geom();
+
+    wx = win_x; wy = win_y + win_yl;
+  }
+
+  int wintan_xl, wintan_yl;
+  get_win_size(gwin_tan, &wintan_xl, &wintan_yl);
+
+  if (wx + wintan_xl > dpy_xl)
+    wx = dpy_xl - wintan_xl;
+  if (wx < 0)
+    wx = 0;
+
+#if 0
+  if (gcin_pop_up_win) {
+    wy = win_status_y - wintan_yl;
+  } else
+#endif
+  {
+    if (wy + wintan_yl > dpy_yl)
+      wy = win_y - wintan_yl;
+    if (wy < 0)
+      wy = 0;
+  }
+
+  gtk_window_move(GTK_WINDOW(gwin_tan), wx, wy);
+}
+
+void hide_win_tan()
+{
+  if (!gwin_tan)
+    return;
+  gtk_widget_hide(gwin_tan);
+}
+
+void show_win_tan()
+{
+  if (!current_CS)
+    return;
+
+  if (!gwin_tan || !win_tan_enabled || current_CS->im_state == GCIN_STATE_DISABLED)
+    return;
+#if 0
+  dbg("show_win_tan\n");
+#endif
+  gtk_widget_show_all(gwin_tan);
+  move_win_tan();
+}
+
+void create_win_tan()
+{
+  char gcin_dir[512];
+
+  if (!current_CS) {
+    dbg("create_win_tan, null CS\n");
+    return;
+  }
+
+#if 0
+  if (current_CS->in_method < 0 || current_CS->in_method >= MAX_GTAB_NUM_KEY) {
+    p_err("bad current_CS %d\n", current_CS->in_method);
+  }
+#endif
+
+#if 0
+  if (current_method_type() != method_type_PHO && current_method_type() != method_type_TSIN && current_method_type() != method_type_ANTHY && !cur_inmd)
+    return;
+#endif
+
+#if 0
+  if (cur_in_method != current_CS->in_method)
+    destroy_tan();
+#endif
+
+  if (gwin_tan) {
+    if (win_tan_enabled)
+      show_win_tan();
+    else
+      hide_win_tan();
+
+    return;
+  }
+
+  gwin_tan = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+#if WIN32
+  set_no_focus(gwin_tan);
+#endif
+
+  cur_in_method = current_CS->in_method;
+
+  GdkBitmap *bitmap = NULL;
+  gdk_pixbuf_render_pixmap_and_mask(gdk_pixbuf_new_from_file(get_gcin_conf_fname("gcin-tan", gcin_dir), NULL), NULL, &bitmap, 128);
+  gtk_widget_shape_combine_mask(gwin_tan, bitmap, 0, 0);
+  gtk_container_add (GTK_CONTAINER (gwin_tan), gtk_image_new_from_file(get_gcin_conf_fname("gcin-tan", gcin_dir)));
+
+  gtk_widget_realize (gwin_tan);
+#if UNIX
+  GdkWindow *gdkwin_tan = gtk_widget_get_window(gwin_tan);
+  set_no_focus(gwin_tan);
+#else
+  win32_init_win(gwin_tan);
+#endif
+
+  if (win_tan_enabled)
+    gtk_widget_show_all(gwin_tan);
+
+  move_win_tan();
+#if 0
+  dbg("in_method:%d\n", current_CS->in_method);
+#endif
+  return;
+}
+
+void toggle_win_tan()
+{
+  win_tan_enabled^=1;
+  create_win_tan();
+}
--- gcin-1.5.6.pre8.orig/win-tan.h
+++ gcin-1.5.6.pre8/win-tan.h
@@ -0,0 +1,14 @@
+#if 1
+#define CREATE_WIN_TAN() create_win_tan()
+#define HIDE_WIN_TAN() hide_win_tan()
+#define SHOW_WIN_TAN() show_win_tan()
+#define MOVE_WIN_TAN() move_win_tan()
+#define TOGGLE_WIN_TAN() toggle_win_tan()
+#else
+#define CREATE_WIN_TAN()
+#define HIDE_WIN_TAN()
+#define SHOW_WIN_TAN()
+#define MOVE_WIN_TAN()
+#define TOGGLE_WIN_TAN()
+#endif
+extern gboolean win_tan_enabled;
--- gcin-1.5.6.pre8.orig/win0.cpp
+++ gcin-1.5.6.pre8/win0.cpp
@@ -437,6 +437,7 @@
 #endif
 
   move_win_sym();
+  MOVE_WIN_TAN();
 }
 
 GtkWidget *gwin1;
@@ -666,6 +667,11 @@
 #endif
   create_win0();
   create_win0_gui();
+  CREATE_WIN_TAN();
+  if (win_tan_enabled)
+    SHOW_WIN_TAN();
+  else
+    HIDE_WIN_TAN();
 
   if (gcin_pop_up_win && !tsin_has_input() && !force_show)
     return;
@@ -700,6 +706,7 @@
 #endif
   hide_selections_win();
   hide_win_sym();
+  HIDE_WIN_TAN();
 }
 
 void bell();
