diff options
author | Choe Hwanjin <choe.hwanjin@gmail.com> | 2008-04-20 15:48:59 +0900 |
---|---|---|
committer | Choe Hwanjin <choe.hwanjin@gmail.com> | 2008-04-20 15:48:59 +0900 |
commit | ecd9b93de5110cfb194ae82fd6a9757045170b5c (patch) | |
tree | 78190b1ea41705ed9b89c97382e1702052676579 | |
parent | 2246defa251eda370b7603f9f0f76906d2131d6c (diff) | |
download | libhangul-ecd9b93de5110cfb194ae82fd6a9757045170b5c.tar.gz |
hangul input context 개선:
* hangul_ic_select_keyboard() 함수에서 output mode 초기화 함
* HangulInputContext::use_jamo_mode_only 값에 따라서
output mode 설정 기능이 동작하도록 함
* 세벌식 옛글 자판을 선택했다가 현대글자판으로 바꾸면 jamo output 모드 설정이
남아있던 문제 수정
* libhangul 버그: #304765
git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@173 8f00fcd2-89fc-0310-932e-b01be5b65e01
-rw-r--r-- | hangul/hangulinputcontext.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/hangul/hangulinputcontext.c b/hangul/hangulinputcontext.c index cab91de..2ed190e 100644 --- a/hangul/hangulinputcontext.c +++ b/hangul/hangulinputcontext.c @@ -29,6 +29,14 @@ #include "hangul.h" #include "hangulinternals.h" +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + #define HANGUL_KEYBOARD_TABLE_SIZE 0x80 typedef void (*HangulOnTranslate) (HangulInputContext*, @@ -87,6 +95,8 @@ struct _HangulInputContext { HangulICFilter filter; void *filter_data; + + unsigned int use_jamo_mode_only : 1; }; #include "hangulkeyboard.h" @@ -1039,7 +1049,8 @@ hangul_ic_set_output_mode(HangulInputContext *hic, int mode) if (hic == NULL) return; - hic->output_mode = mode; + if (!hic->use_jamo_mode_only) + hic->output_mode = mode; } void @@ -1106,22 +1117,33 @@ hangul_ic_select_keyboard(HangulInputContext *hic, const char* id) if (strcmp(id, "32") == 0) { hic->keyboard = &hangul_keyboard_32; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } else if (strcmp(id, "39") == 0) { hic->keyboard = &hangul_keyboard_390; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } else if (strcmp(id, "3f") == 0) { hic->keyboard = &hangul_keyboard_3final; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } else if (strcmp(id, "3s") == 0) { hic->keyboard = &hangul_keyboard_3sun; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } else if (strcmp(id, "3y") == 0) { hic->keyboard = &hangul_keyboard_3yet; hic->combination = &hangul_combination_full; hic->output_mode = HANGUL_OUTPUT_JAMO; + hic->use_jamo_mode_only = TRUE; } else { hic->keyboard = &hangul_keyboard_2; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } } @@ -1144,11 +1166,6 @@ hangul_ic_new(const char* keyboard) if (hic == NULL) return NULL; - hangul_ic_set_output_mode(hic, HANGUL_OUTPUT_SYLLABLE); - hangul_ic_select_keyboard(hic, keyboard); - - hangul_buffer_clear(&hic->buffer); - hic->preedit_string[0] = 0; hic->commit_string[0] = 0; hic->flushed_string[0] = 0; @@ -1159,6 +1176,13 @@ hangul_ic_new(const char* keyboard) hic->on_transition = NULL; hic->on_transition_data = NULL; + hic->use_jamo_mode_only = FALSE; + + hangul_ic_set_output_mode(hic, HANGUL_OUTPUT_SYLLABLE); + hangul_ic_select_keyboard(hic, keyboard); + + hangul_buffer_clear(&hic->buffer); + return hic; } |