From: InHong Han Date: Thu, 9 Aug 2018 00:22:42 +0000 (+0900) Subject: Fix issue that IME didn't restart in on-demand mode X-Git-Tag: accepted/tizen/unified/20180823.072056~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e082c353a0cbfaff3e61892e0eb1a1b372439434;p=platform%2Fcore%2Fuifw%2Fisf.git Fix issue that IME didn't restart in on-demand mode Change-Id: I0ed981fc2da28476a892b189426a269064131cae --- diff --git a/ism/extras/efl_panel/isf_panel_efl.cpp b/ism/extras/efl_panel/isf_panel_efl.cpp index ee44dbe..9a156bf 100644 --- a/ism/extras/efl_panel/isf_panel_efl.cpp +++ b/ism/extras/efl_panel/isf_panel_efl.cpp @@ -6493,6 +6493,10 @@ static void slot_start_default_ise (void) if ((_info_manager->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE)) { String uuid = _config->read (SCIM_CONFIG_DEFAULT_HELPER_ISE, String ("")); int pid = aul_app_get_pid (uuid.c_str ()); + if (pid >= 0) { + if (STATUS_DYING == aul_app_get_status (uuid.c_str ())) + pid = -1; + } if (_launch_ise_on_request && !_soft_keyboard_launched && pid < 0) { LOGD ("Start helper (%s)", uuid.c_str ()); set_keyboard_engine (String (SCIM_COMPOSE_KEY_FACTORY_UUID)); diff --git a/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp b/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp index 3410014..dbdc1ef 100644 --- a/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp +++ b/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp @@ -2855,9 +2855,8 @@ private: } else { LOGW ("wrong format of transaction"); } - //FIXME: useless - //} else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_EXIT) { - // m_info_manager->UPDATE_ISE_EXIT(client_id); + } else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_EXIT) { + m_info_manager->UPDATE_ISE_EXIT(client_id); } else if (cmd == SCIM_TRANS_CMD_COMMIT_CONTENT) { String content; String description; diff --git a/ism/src/isf_info_manager.cpp b/ism/src/isf_info_manager.cpp index 8d59984..4887551 100644 --- a/ism/src/isf_info_manager.cpp +++ b/ism/src/isf_info_manager.cpp @@ -275,7 +275,9 @@ class InfoManager::InfoManagerImpl bool m_ise_exiting; bool m_is_imengine_aux; bool m_is_imengine_candidate; + bool m_refocus_needed; bool m_reshow_needed; + bool m_restart_needed; std::vector m_current_send_remoteinput_id; std::vector m_current_recv_remoteinput_id; @@ -434,7 +436,9 @@ public: m_active_client_id (-1), m_should_shared_ise (false), m_ise_exiting (false), m_is_imengine_aux (false), m_is_imengine_candidate (false), + m_refocus_needed (false), m_reshow_needed (false), + m_restart_needed (true), m_last_socket_client (-1), m_last_client_context (0), m_ise_context_buffer (NULL), m_ise_context_length (0), m_imdata_buffer (NULL), m_imdata_length (0) { @@ -1068,12 +1072,10 @@ public: if (it != m_helper_client_index.end ()) { Socket client_socket (it->second.id); m_panel_agent_manager.show_helper (it->second.id, ctx, uuid, data, len); - m_reshow_needed = false; return true; } LOGW ("Can't find %s", m_current_helper_uuid.c_str ()); - m_reshow_needed = true; return false; } @@ -1081,7 +1083,6 @@ public: void hide_helper (const String& uuid, uint32 ctx = 0) { HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid); - m_reshow_needed = false; if (it != m_helper_client_index.end ()) { int client; uint32 context; @@ -1454,6 +1455,7 @@ public: //ISM_TRANS_CMD_SHOW_ISE_PANEL void show_ise_panel (int client_id, uint32 client, uint32 context, char* data, size_t len) { SCIM_DEBUG_MAIN (4) << "InfoManager::show_ise_panel ()\n"; + m_reshow_needed = true; String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String ("")); String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String ("")); LOGD ("prepare to show ISE %d [%s] [%s]", client_id, initial_uuid.c_str (), default_uuid.c_str ()); @@ -1494,6 +1496,7 @@ public: LOGD ("prepare to hide ISE, %d %d", client_id, m_show_request_client_id); SCIM_DEBUG_MAIN (4) << __func__ << " (client:" << client << " context:" << context << ")\n"; + m_reshow_needed = false; if (m_panel_client_map[client_id] == m_current_socket_client || client_id == m_show_request_client_id) { // && (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) { int focused_client; @@ -2250,7 +2253,7 @@ public: void reshow_input_panel () { /* Check whether application is already focus_in */ - if (m_current_socket_client != -1) { + if (m_refocus_needed) { LOGD ("Re-focus in"); SCIM_DEBUG_MAIN (2) << "Application is already focus_in!\n"; @@ -2258,10 +2261,8 @@ public: reset_keyboard_ise (); } - if (!m_reshow_needed) return; - /* Check whether ISE panel is already shown */ - if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode && m_ise_context_length > 0) { + if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode && m_ise_context_length > 0 && m_reshow_needed) { LOGD ("Re-show input_panel"); SCIM_DEBUG_MAIN (2) << "Re-show ISE panel!\n"; @@ -2666,6 +2667,11 @@ public: //SCIM_TRANS_CMD_FOCUS_IN void focus_in (int client_id, uint32 context, String uuid) { + m_refocus_needed = true; + bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false); + if (launch_ise_on_request) + m_signal_start_default_ise (); + m_signal_focus_in (); focus_in_helper (m_current_helper_uuid, m_panel_client_map[client_id], context); SCIM_DEBUG_MAIN (2) << "PanelAgent::focus_in (" << client_id << "," << context << "," << uuid << ")\n"; @@ -2682,14 +2688,11 @@ public: m_current_client_context = context; m_current_context_uuid = uuid; unlock (); - - bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false); - if (launch_ise_on_request) - m_signal_start_default_ise (); } //SCIM_TRANS_CMD_FOCUS_OUT void focus_out (int client_id, uint32 context) { + m_refocus_needed = false; m_signal_focus_out (); lock (); focus_out_helper (m_current_helper_uuid, m_panel_client_map[client_id], context); @@ -2900,9 +2903,10 @@ public: m_signal_stop_default_ise (); - bool launch_ise_on_request = false; - launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), launch_ise_on_request); - if (restart && !m_ise_exiting && !launch_ise_on_request) { + if (m_refocus_needed || m_reshow_needed) + m_restart_needed = true; + + if (restart && !m_ise_exiting && m_restart_needed) { struct tms tiks_buf; static clock_t start_tiks = times (&tiks_buf); static double clock_tiks = (double)sysconf (_SC_CLK_TCK); @@ -2943,6 +2947,7 @@ public: } m_ise_exiting = false; + m_restart_needed = true; unlock (); socket_transaction_start (); m_signal_remove_helper (client_id); @@ -3970,21 +3975,12 @@ client context helpers: %d, helpers uuid count: %d", } } //ISM_TRANS_CMD_UPDATE_ISE_EXIT - //void UPDATE_ISE_EXIT (int client) { - // LOGD (""); - // HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client); - - // if (hiit != m_helper_active_info_repository.end ()) { - // String l_uuid = hiit->second.uuid; - // HelperClientIndex::iterator it = m_helper_client_index.find (l_uuid); - - // if (it != m_helper_client_index.end ()) { - // del_client (it->second.id); - // } - // } - - // del_client (client); - //} + void UPDATE_ISE_EXIT (int client) { + SCIM_DEBUG_MAIN (4) << __func__ << "\n"; + bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false); + if (launch_ise_on_request && !m_refocus_needed && !m_reshow_needed) + m_restart_needed = false; + } void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial) { int focused_client; @@ -5464,10 +5460,10 @@ void InfoManager::socket_helper_commit_content (int client, String content, Stri } //ISM_TRANS_CMD_UPDATE_ISE_EXIT -//void InfoManager::UPDATE_ISE_EXIT (int client) -//{ -// m_impl->UPDATE_ISE_EXIT (client); -//} +void InfoManager::UPDATE_ISE_EXIT (int client) +{ + m_impl->UPDATE_ISE_EXIT (client); +} //ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE void InfoManager::process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial) diff --git a/ism/src/isf_info_manager.h b/ism/src/isf_info_manager.h index f729968..24531e2 100644 --- a/ism/src/isf_info_manager.h +++ b/ism/src/isf_info_manager.h @@ -971,7 +971,7 @@ public: void socket_helper_commit_content (int client, String content, String description, String mime_types); //ISM_TRANS_CMD_UPDATE_ISE_EXIT - //void UPDATE_ISE_EXIT (int client); + void UPDATE_ISE_EXIT (int client); //ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial); diff --git a/ism/src/scim_helper.cpp b/ism/src/scim_helper.cpp index 2c9c654..91933a3 100644 --- a/ism/src/scim_helper.cpp +++ b/ism/src/scim_helper.cpp @@ -2568,20 +2568,25 @@ HelperAgent::select_candidate (int index) const /** * @brief Update our ISE is exiting. + * + * The IME must call this function before terminating IME itself in On-demand mode. + * If this function isn't called, IME will automatically restart. + * This function only works in On-demand mode. + * */ void HelperAgent::update_ise_exit (void) const { - //FIXME: maybe useless -#if 0 if (m_impl->socket_active.is_connected ()) { m_impl->send.clear (); m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST); m_impl->send.put_data (m_impl->magic_active); m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_EXIT); m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active); + + // The update_ise_exit must be delivered before del_client of isf_info_manager was called. + sync(); } -#endif } /**