From 16cefdf35940180cd054122b805a355058c3e584 Mon Sep 17 00:00:00 2001 From: Brady Fomegne Date: Wed, 16 Oct 2024 07:13:00 +0100 Subject: [PATCH] reset the IME when the user stop typing When the user is doing something else than typing, like change the cursor position or change of input field, the `reset` signal is triggered. Unlike `focus-in` and `focus-out`, the `reset` signal handle the case where the user change the cursor position. This commit use the `reset` signal instead of the `focus-out` signal. --- apps/engine.c | 2 +- src/predict/lib/src/lib.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/engine.c b/apps/engine.c index 40a7390..e5b0a56 100644 --- a/apps/engine.c +++ b/apps/engine.c @@ -32,7 +32,7 @@ ibus_eei_engine_class_init (IBusEEIEngineClass *klass) engine_class->page_down = ibus_eei_engine_page_down_button; engine_class->page_up = ibus_eei_engine_page_up_button; engine_class->candidate_clicked = ibus_eei_engine_candidate_clicked; - engine_class->focus_out = ibus_eei_engine_focus_out; + engine_class->reset = ibus_eei_engine_reset; engine_class->enable = ibus_eei_engine_enable; } diff --git a/src/predict/lib/src/lib.rs b/src/predict/lib/src/lib.rs index 3090568..09eb398 100644 --- a/src/predict/lib/src/lib.rs +++ b/src/predict/lib/src/lib.rs @@ -444,21 +444,21 @@ pub unsafe extern "C" fn ibus_eei_engine_page_up_button(engine: *mut IBusEngine) } #[no_mangle] -pub unsafe extern "C" fn ibus_eei_engine_focus_out(engine: *mut IBusEngine) { +pub unsafe extern "C" fn ibus_eei_engine_reset(engine: *mut IBusEngine) { match EngineCore::get(engine) { Some(engine_core) => { engine_core.abort_table_input(); - match (*engine_core.parent_engine_class).focus_out { - Some(parent_focus_out) => { - parent_focus_out(engine); + match (*engine_core.parent_engine_class).reset { + Some(parent_reset) => { + parent_reset(engine); } None => { - log::error!("Could not retrieve parent function for focus out") + log::error!("Could not retrieve parent function for reset") } } } None => { - log::error!("Could not retrieve engine core for focus out"); + log::error!("Could not retrieve engine core for reset"); } } }