[openi18n-im:01586] Re: HANGUL_KEYBOARD_TYPE patch

Bo Gavin Tu <[email protected]> Thu, 16 Feb 2006 11:01:46 +0800
Newsgroups gmane.comp.internationalization.input-methods
Message-ID <[email protected]>
hi Yong-iL:

Thanks a lot for your contribution.

Currently, kole doesn't support "per configuration file per user", so
all system users have to share the same configuration.

SetEnv "HANGUL_KEYBOARD_TYPE" is a good workaround for this issue.But,i
think the best way is to support "per configuration file per user", and
keep private configuration file under users' home directory.

Best regards,
Gavin

Yong-iL Joh wrote On  21:26,:
> I'm using "sebeol 390 keyboard type" for hangul input.
> 
> When I'm using iiimf,
> I must change
> 	/usr/lib/im/locale/ko_KR/hangul.conf
> for my hangul input.
> but, this notebook is pubilc use.
> so, I can't change system-wide setting.
> 
> there is a de-facto standard
> of selecting hangul keyboard type, "HANGUL_KEYBOARD_TYPE".
> # or use export HANGUL_KEYBOARD_TYPE=...
> # dubeol:          2
> # sebeol final:    3FINAL
> # sebeol 390:      390
> # sebeol no-shift: 3NOSHIFT
> 
> here is a patch.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --- iiimf-12.2/leif/hangul/hangul.conf~	2003-08-29 21:15:45.000000000 +0900
> +++ iiimf-12.2/leif/hangul/hangul.conf	2006-02-15 21:48:54.000000000 +0900
> @@ -6,3 +6,9 @@
>  # sebeol 390:      39
>  # sebeol no-shift: 3s
>  keyboard = 2
> +
> +# or use export HANGUL_KEYBOARD_TYPE=...
> +# dubeol:          2
> +# sebeol final:    3FINAL
> +# sebeol 390:      390
> +# sebeol no-shift: 3NOSHIFT
> --- iiimf-12.2/leif/hangul/composer.c~	2005-04-14 00:30:34.000000000 +0900
> +++ iiimf-12.2/leif/hangul/composer.c	2006-02-15 21:48:41.000000000 +0900
> @@ -1510,6 +1510,7 @@
>  hangul_load_config(void)
>  {
>      const char *conf_filename = HANGUL_CONFIG_FILENAME;
> +    char *env_keyboard_type = getenv("HANGUL_KEYBOARD_TYPE");
>      FILE *conf_file;
>      char key[64];
>      char value[512];
> @@ -1520,6 +1521,24 @@
>      config.keyboard = keyboard_map_2;
>      config.composer = hangul_composer_2;
>  
> +    if (env_keyboard_type != NULL) {
> +      strncpy(value, env_keyboard_type, 10);
> +      if (strcmp(value, "2") == 0) {
> +	config.keyboard = keyboard_map_2;
> +	config.composer = hangul_composer_2;
> +      } else if (strcmp(value, "390") == 0) {
> +	config.keyboard = keyboard_map_390;
> +	config.composer = hangul_composer_3;
> +      } else if (strcmp(value, "3FINAL") == 0) {
> +	config.keyboard = keyboard_map_3final;
> +	config.composer = hangul_composer_3;
> +      } else if (strcmp(value, "3NOSHIFT") == 0) {
> +	config.keyboard = keyboard_map_3sun;
> +	config.composer = hangul_composer_3;
> +      }
> +      return;
> +    }
> +
>      conf_file = fopen(conf_filename, "r");
>      if (conf_file == NULL) {
>  	perror(conf_filename);
> --- iiimf-12.2/leif/hangul/ChangeLog~	2006-02-15 21:52:32.000000000 +0900
> +++ iiimf-12.2/leif/hangul/ChangeLog	2006-02-15 21:52:17.000000000 +0900
> @@ -1,3 +1,9 @@
> +2006-02-15  Yong-iL Joh <[email protected]>
> +
> +	* composer.c (HANGUL_KEYBOARD_TYPE): user may set 3beolshik
> +
> +	* hangul.conf (HANGUL_KEYBOARD_TYPE): add comment
> +
>  2005-04-13  Jens Petersen  <[email protected]>
>  
>  	* Makefile.am (hangul_la_CFLAGS): Use IM_LEIFDIR instead of