From b71b0a3b6f87364d2cda26d29b34618fec9534f2 Mon Sep 17 00:00:00 2001 From: Choe Hwanjin Date: Wed, 15 Aug 2018 22:18:17 +0900 Subject: 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. --- src/engine.c | 26 +++++++++++++++----------- 1 file 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 -- cgit v1.2.1