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

YAMAMOTO Kengo / YamaKen yamaken at bp.iij4u.or.jp
Wed May 23 08:40:57 PDT 2007


Hi Yusuke, thank you for the patch.

At Fri, 30 Mar 2007 22:38:41 +0900,
yusuke at w5.dion.ne.jp wrote:
> 
> 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?

I think the solution is reasonable for current uim
implementation. And I'm assuming that (1) is true too. How do
you think, Etsushi?

And for my curiosity, which is supposed by the word 'correct
solution' on this context?

  1. Toolkit-level Japanese kana-keyboard support that supports
     all underlying windowing systems

  2. Distinguishing UKey_Yen and UKey_Kana_ProlongedSound
     properly with X11-dependent kana lock state sensing

Finally, a little explanation about the hack such as follows may
help code readers.

  This hack assumes that the xmodmap for the Japanese kana
  keyboard is defined as follows:
  
  yen sign key: keycode X = backslash bar prolongedsound
  kana_RO key:  keycode Y = backslash underscore kana_RO

Yusuke, please let me know your Gmail account to register you as
a committer on the new repository.

> 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
>  }

------------------------------------------------
YAMAMOTO Kengo / YamaKen  yamaken at bp.iij4u.or.jp
FAMILY   Given / Nick
http://en.wikipedia.org/wiki/Japanese_name


More information about the uim mailing list