From 4f139679904c9ae923b44b4b1a48092cd2023d98 Mon Sep 17 00:00:00 2001 From: Inhong Han Date: Fri, 19 Oct 2018 11:20:34 +0900 Subject: [PATCH] Fix the issue that IME doesn't work when ISF was terminated in On-demand mode Change-Id: I33539fe3a38c46920a5081d4dd3f7324111d5c30 --- ism/extras/efl_panel/isf_panel_efl.cpp | 37 +++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/ism/extras/efl_panel/isf_panel_efl.cpp b/ism/extras/efl_panel/isf_panel_efl.cpp index de92774..a5c95fc 100644 --- a/ism/extras/efl_panel/isf_panel_efl.cpp +++ b/ism/extras/efl_panel/isf_panel_efl.cpp @@ -290,6 +290,7 @@ static void show_ime_selector_notification (void); #endif static void set_language_and_locale (const char *lang_str); static bool app_control_launch (const char *app_id); +static void terminate_active_ise (const String uuid); ///////////////////////////////////////////////////////////////////////////// // Declaration of internal variables. @@ -6615,6 +6616,24 @@ static void add_ise_check_pid_alive_timer(const String &uuid) { ise_check_pid_alive_timer, NULL); } +static void terminate_active_ise (const String uuid) +{ + /* Check if IME with the same AppID is alive */ + int status_ret = aul_app_get_status (uuid.c_str ()); + if (status_ret >= STATUS_LAUNCHING) { + /* Request to terminate IME */ + int ime_pid = aul_app_get_pid (uuid.c_str ()); + status_ret = aul_terminate_pid (ime_pid); + if (status_ret < AUL_R_OK) { + LOGE ("aul_terminate_pid(%d) failed: %d", ime_pid, status_ret); + } + else { + LOGD ("Requested to terminate IME(%s)", uuid.c_str ()); + usleep (1000000); + } + } +} + static void slot_run_helper (const String &uuid, const String &config, const String &display) { ISF_SAVE_LOG ("time:%ld pid:%d %s %s uuid(%s)", @@ -6661,20 +6680,7 @@ static void slot_run_helper (const String &uuid, const String &config, const Str for (size_t i = 0; i < _ime_info.size (); ++i) { if (_ime_info[i].appid == uuid && _ime_info[i].module_name.length ()) { if (scim_helper_path != String (SCIM_HELPER_LAUNCHER_PROGRAM)) { - /* Check if IME with the same AppID is alive */ - int status_ret = aul_app_get_status (uuid.c_str ()); - if (status_ret >= STATUS_LAUNCHING) { - /* Request to terminate IME */ - int ime_pid = aul_app_get_pid (uuid.c_str ()); - status_ret = aul_terminate_pid (ime_pid); - if (status_ret < AUL_R_OK) { - LOGE ("aul_terminate_pid(%d) failed: %d", ime_pid, status_ret); - } - else { - LOGD ("Requested to terminate IME(%s)", uuid.c_str ()); - usleep (1000000); - } - } + terminate_active_ise (uuid); /* execute type IME */ LOGD ("Try to launch IME (%s)", uuid.c_str ()); app_control_launch (uuid.c_str ()); @@ -7956,6 +7962,9 @@ int main (int argc, char *argv []) } } + /* Request to terminate active IME */ + terminate_active_ise (_initial_ise_uuid); + /* Launches default soft keyboard when all conditions are satisfied */ launch_default_soft_keyboard (); -- 2.7.4