From e2df8107593ea24aeddd781d3fe0dc8006eb1e11 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 21 Aug 2013 16:19:17 +0900 Subject: [PATCH] Hide IME when H/W back key is released even though there is no focus Change-Id: Ib16c5ceeab2614968fcba9ddb8f6c6c6435c24cd --- ism/extras/efl_immodule/isf_imf_context.cpp | 15 +++++++++------ ism/extras/efl_immodule/isf_imf_control_ui.cpp | 12 ++++++------ ism/extras/efl_immodule/isf_imf_control_ui.h | 1 + 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ism/extras/efl_immodule/isf_imf_context.cpp b/ism/extras/efl_immodule/isf_imf_context.cpp index 17d7048..347cc84 100644 --- a/ism/extras/efl_immodule/isf_imf_context.cpp +++ b/ism/extras/efl_immodule/isf_imf_context.cpp @@ -455,11 +455,12 @@ _key_down_cb (void *data, int type, void *event) SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event; - if (!ev || !_focused_ic || !_focused_ic->ctx) return ECORE_CALLBACK_RENEW; + Ecore_IMF_Context *active_ctx = get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW); + if (!ev || !active_ctx) return ECORE_CALLBACK_RENEW; if ((hw_keyboard_num_get () == 0) && !strcmp (ev->keyname, KEY_END) && - ecore_imf_context_input_panel_state_get (_focused_ic->ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) { + ecore_imf_context_input_panel_state_get (active_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) { LOGD ("END key is pressed\n"); return ECORE_CALLBACK_CANCEL; } @@ -472,15 +473,17 @@ _key_up_cb (void *data, int type, void *event) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + Ecore_IMF_Context *active_ctx = get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW); + Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event; - if (!ev || !_focused_ic || !_focused_ic->ctx) return ECORE_CALLBACK_RENEW; + if (!ev || !active_ctx) return ECORE_CALLBACK_RENEW; if ((hw_keyboard_num_get () == 0) && !strcmp (ev->keyname, KEY_END) && - ecore_imf_context_input_panel_state_get (_focused_ic->ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) { + ecore_imf_context_input_panel_state_get (active_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) { LOGD ("END key is released\n"); - isf_imf_context_input_panel_instant_hide (_focused_ic->ctx); - isf_imf_context_reset (_focused_ic->ctx); + isf_imf_context_input_panel_instant_hide (active_ctx); + isf_imf_context_reset (active_ctx); return ECORE_CALLBACK_CANCEL; } diff --git a/ism/extras/efl_immodule/isf_imf_control_ui.cpp b/ism/extras/efl_immodule/isf_imf_control_ui.cpp index 7be7af3..cdf2d06 100644 --- a/ism/extras/efl_immodule/isf_imf_control_ui.cpp +++ b/ism/extras/efl_immodule/isf_imf_control_ui.cpp @@ -62,7 +62,7 @@ static Eina_Bool will_hide = EINA_FALSE; static void _send_input_panel_hide_request (); -static Ecore_IMF_Context *_get_using_ic (Ecore_IMF_Input_Panel_Event type, int value) { +Ecore_IMF_Context *get_using_ic (Ecore_IMF_Input_Panel_Event type, int value) { Ecore_IMF_Context *using_ic = NULL; if (show_req_ic) using_ic = show_req_ic; @@ -83,14 +83,14 @@ static void _render_post_cb (void *data, Evas *e, void *event_info) LOGD ("[_render_post_cb]\n"); evas_event_callback_del_full (e, EVAS_CALLBACK_RENDER_POST, _render_post_cb, NULL); conformant_reset_done = EINA_TRUE; - isf_imf_context_input_panel_send_will_hide_ack (_get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW)); + isf_imf_context_input_panel_send_will_hide_ack (get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW)); } static void _candidate_render_post_cb (void *data, Evas *e, void *event_info) { LOGD ("[%s]\n", __func__); evas_event_callback_del_full (e, EVAS_CALLBACK_RENDER_POST, _candidate_render_post_cb, NULL); - isf_imf_context_input_panel_send_candidate_will_hide_ack (_get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW)); + isf_imf_context_input_panel_send_candidate_will_hide_ack (get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW)); } static void _clear_will_show_timer () @@ -198,7 +198,7 @@ static void _save_current_xid (Ecore_IMF_Context *ctx) static void _event_callback_call (Ecore_IMF_Input_Panel_Event type, int value) { - Ecore_IMF_Context *using_ic = _get_using_ic (type, value); + Ecore_IMF_Context *using_ic = get_using_ic (type, value); switch (type) { case ECORE_IMF_INPUT_PANEL_STATE_EVENT: @@ -437,7 +437,7 @@ void isf_imf_input_panel_shutdown (void) LOGD ("No hide timer\n"); } - isf_imf_context_input_panel_send_candidate_will_hide_ack (_get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW)); + isf_imf_context_input_panel_send_candidate_will_hide_ack (get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW)); if (_prop_change_handler) { ecore_event_handler_del (_prop_change_handler); @@ -942,7 +942,7 @@ static bool _process_ise_panel_hided (void) _event_callback_call (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_HIDE); received_will_hide_event = EINA_TRUE; - isf_imf_context_input_panel_send_will_hide_ack (_get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_HIDE)); + isf_imf_context_input_panel_send_will_hide_ack (get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_HIDE)); return true; } diff --git a/ism/extras/efl_immodule/isf_imf_control_ui.h b/ism/extras/efl_immodule/isf_imf_control_ui.h index b9da9bb..2853876 100644 --- a/ism/extras/efl_immodule/isf_imf_control_ui.h +++ b/ism/extras/efl_immodule/isf_imf_control_ui.h @@ -34,6 +34,7 @@ extern "C" void input_panel_event_callback_call (Ecore_IMF_Input_Panel_Event type, int value); int hw_keyboard_num_get (); bool process_update_input_context (int type, int value); + Ecore_IMF_Context *get_using_ic (Ecore_IMF_Input_Panel_Event type, int value); void isf_imf_input_panel_init (); void isf_imf_input_panel_shutdown (); -- 2.7.4