[Uim] easy hack to enable Yen sign for Japanese keyboard

Yusuke TABATA yusuke at w5.dion.ne.jp
Fri Mar 30 16:38:41 EEST 2007


This patch is a quick hack for long standing problem of Japanese kana-input.
I know this is not a good solution, however
 (1) This hack only affects on gtk+ immodule with Japanese keyboard
     -> please confirm.
 (2) Correct solution may not be available in near future.

What do you think about this?

Index: key-util-gtk.c
===================================================================
--- key-util-gtk.c	(revision 4527)
+++ key-util-gtk.c	(working copy)
@@ -54,6 +54,7 @@
 static guint g_mod1_mask, g_mod2_mask, g_mod3_mask, g_mod4_mask, g_mod5_mask;
 static gint g_numlock_mask;
 static guint g_modifier_state, g_pre_modifier_state;
+static KeyCode g_prolongedsound_keycode;
 #endif

 void
@@ -228,6 +229,13 @@
      break;
     }
   }
+#ifdef GDK_WINDOWING_X11
+  /* 1'. replace keysym for Japanese keyboard */
+  if (*ukey == '\\' &&
+      event->hardware_keycode == g_prolongedsound_keycode) {
+    *ukey = UKey_Yen;
+  }
+#endif

   /* 2. check modifier */
   if (mod & GDK_SHIFT_MASK)
@@ -375,5 +383,7 @@
   g_slist_free(mod5_list);
   XFreeModifiermap(map);
   XFree(sym);
+  /* setup keycode hack */
+  g_prolongedsound_keycode = XKeysymToKeycode(display, XK_prolongedsound);
 #endif
 }


-- 
--
 CHAOS AND CHANCE!
  Yusuke TABATA



More information about the uim mailing list