summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2018-08-15 22:18:17 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2018-08-17 23:10:35 +0900
commitb71b0a3b6f87364d2cda26d29b34618fec9534f2 (patch)
tree6864d0a8474d89de607ccd25c6ed8b98f4849cc8
parent9c2ce96c1f127aeb80277d22706fa1e45b91376b (diff)
downloadibus-hangul-b71b0a3b6f87364d2cda26d29b34618fec9534f2.tar.gz
Fix event processing priority for hanja conversion
If hangul engine context has hanja_list, we should process key event for lookup table first. Or lookup table may not receive a key event, i.g. Esc key event.
-rw-r--r--src/engine.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/engine.c b/src/engine.c
index 5f291fc..001aa89 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1063,6 +1063,21 @@ ibus_hangul_engine_process_key_event (IBusEngine *engine,
if (hangul->input_purpose == IBUS_INPUT_PURPOSE_PASSWORD)
return IBUS_ENGINE_CLASS (parent_class)->process_key_event (engine, keyval, keycode, modifiers);
+ /* Process candidate key event before hot keys,
+ * or lookup table can't receive important events.
+ * For example, if Esc key is pressed, this key event should be used for
+ * closing lookup table, not for turning to latin mode. */
+ if (hangul->hanja_list != NULL) {
+ retval = ibus_hangul_engine_process_candidate_key_event (hangul,
+ keyval, modifiers);
+ if (hangul->hanja_mode) {
+ if (retval)
+ return TRUE;
+ } else {
+ return TRUE;
+ }
+ }
+
// If a hotkey has any modifiers, we ignore that modifier
// keyval, or we cannot make the hanja key work.
// Because when we get the modifier key alone, we commit the
@@ -1106,17 +1121,6 @@ ibus_hangul_engine_process_key_event (IBusEngine *engine,
return TRUE;
}
- if (hangul->hanja_list != NULL) {
- retval = ibus_hangul_engine_process_candidate_key_event (hangul,
- keyval, modifiers);
- if (hangul->hanja_mode) {
- if (retval)
- return TRUE;
- } else {
- return TRUE;
- }
- }
-
// If we've got a key event with some modifiers, commit current
// preedit string and ignore this key event.
// So, if you want to add some key event handler, put it