static void slot_close_connection (int fd);
static void slot_exit (void);
+static void slot_register_helper (int id, const HelperInfo& info);
static void slot_register_helper_properties (int id, const PropertyList &props);
static void slot_show_ise (void);
static void slot_hide_ise (void);
static void show_ime_selector_notification (void);
#endif
static void set_language_and_locale (const char *lang_str);
-static void app_control_launch (const char *app_id);
+static bool app_control_launch (const char *app_id);
/////////////////////////////////////////////////////////////////////////////
// Declaration of internal variables.
static String ime_selector_app = "";
static String ime_list_app = "";
+static Ecore_Timer *_ise_check_pid_alive_timer = NULL;
+static const double _ise_check_pid_alive_time = 1.0f;
+static String _ise_check_pid_alive_uuid;
+
enum {
EMOJI_IMAGE_WIDTH = 0,
EMOJI_IMAGE_HEIGHT,
_info_manager->signal_connect_close_connection (slot (slot_close_connection));
_info_manager->signal_connect_exit (slot (slot_exit));
+ _info_manager->signal_connect_register_helper (slot(slot_register_helper));
_info_manager->signal_connect_register_helper_properties (slot (slot_register_helper_properties));
_info_manager->signal_connect_show_ise (slot (slot_show_ise));
_info_manager->signal_connect_hide_ise (slot (slot_hide_ise));
#endif /* CANDIDATE */
}
+static void delete_ise_check_pid_alive_timer(void)
+{
+ LOGD("deleting ise_check_alive_timer\n");
+ if (_ise_check_pid_alive_timer) {
+ ecore_timer_del(_ise_check_pid_alive_timer);
+ _ise_check_pid_alive_timer = NULL;
+ }
+}
+
+static Eina_Bool ise_check_pid_alive_timer(void *data)
+{
+ Eina_Bool ret = ECORE_CALLBACK_RENEW;
+ int ime_pid = (int)data;
+
+ int status = aul_app_get_status_bypid(ime_pid);
+ LOGD("STATUS : %d %d", status, ime_pid);
+
+ /* If the status is not one of STATUS_LAUNCHING, STATUS_VISIBLE, STATUS_BG */
+ if (status >= STATUS_DYING || status == -1) {
+ _soft_keyboard_launched = false;
+
+ String uuid = _config->read(SCIM_CONFIG_DEFAULT_HELPER_ISE, String(""));
+ /* The start_helper() function below will going to call slot_run_helper,
+ which will going to assign a new timer handle to the _ise_check_pid_alive_timer variable.
+ */
+ if (_info_manager->start_helper(uuid))
+ _soft_keyboard_launched = true;
+
+ ret = ECORE_CALLBACK_CANCEL;
+ }
+
+ return ret;
+}
+
+static void slot_register_helper(int id, const HelperInfo& info)
+{
+ LOGD ("");
+ /* Do we need to check whether the pid of this helper is the one we are watching? */
+ if (info.uuid.compare(_ise_check_pid_alive_uuid) == 0) {
+ delete_ise_check_pid_alive_timer();
+ }
+}
+
static void slot_register_helper_properties (int id, const PropertyList &props)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
}
}
-static void app_control_launch (const char *app_id)
+static bool app_control_launch (const char *app_id)
{
app_control_h app_control;
int ret;
ret = app_control_create (&app_control);
if (ret != APP_CONTROL_ERROR_NONE) {
LOGW ("app_control_create returned %08x\n", ret);
- return;
+ return false;
}
ret = app_control_set_operation (app_control, APP_CONTROL_OPERATION_DEFAULT);
if (ret != APP_CONTROL_ERROR_NONE) {
LOGW ("app_control_set_operation returned %08x\n", ret);
app_control_destroy (app_control);
- return;
+ return false;
}
ret = app_control_set_app_id (app_control, app_id);
if (ret != APP_CONTROL_ERROR_NONE) {
LOGW ("app_control_set_app_id returned %08x\n", ret);
app_control_destroy (app_control);
- return;
+ return false;
}
int tries = 0;
} else {
LOGD ("Succeeded to launch IME (%s)\n", app_id);
}
+
+ return (ret == APP_CONTROL_ERROR_NONE);
}
static void slot_run_helper (const String &uuid, const String &config, const String &display)
String strDisplay = display;
String scim_helper_path;
+ delete_ise_check_pid_alive_timer();
+
#ifdef HAVE_PKGMGR_INFO
char *execpath = NULL;
int ret;
}
/* execute type IME */
LOGD ("Try to launch IME (%s)\n", uuid.c_str ());
- app_control_launch (uuid.c_str ());
+ bool launched = app_control_launch (uuid.c_str ());
+
+ if (launched) {
+ int ime_pid = aul_app_get_pid(uuid.c_str());
+ if (ime_pid > 0) {
+ LOGD ("Register check_alive timer for pid : %d", ime_pid);
+ _ise_check_pid_alive_uuid = uuid;
+ _ise_check_pid_alive_timer = ecore_timer_add (_ise_check_pid_alive_time,
+ ise_check_pid_alive_timer, (void*)ime_pid);
+ }
+ }
}
else {
/* shared object (so) type IME */
pkgmgr = NULL;
}
#endif
+ delete_ise_check_pid_alive_timer();
#ifdef HAVE_TTS
ui_close_tts ();
lock ();
/*if (m_current_toolbar_mode != TOOLBAR_HELPER_MODE || m_current_helper_uuid.compare (uuid) != 0)*/ {
SCIM_DEBUG_MAIN (1) << "Run_helper\n";
+
+ uint32 ic = get_helper_ic (m_panel_client_map[client], context);
+ String ic_uuid;
+ /* Get the context uuid from the client context registration table. */
+ {
+ ClientContextUUIDRepository::iterator it =
+ m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client], context));
+
+ if (it != m_client_context_uuids.end ())
+ ic_uuid = it->second;
+ }
+ m_start_helper_ic_index [uuid].push_back (std::make_pair (ic, ic_uuid));
m_signal_run_helper (uuid, m_config_name, m_display_name);
}
m_current_helper_uuid = uuid;
ISF_SAVE_LOG ("send SCIM_TRANS_CMD_EXIT message to %s\n", uuid.c_str ());
}
+ /* Since we are stopping this helper, erase information from start_helper_ic_index too */
+ m_start_helper_ic_index.erase (uuid);
+
unlock ();
return true;
}
if (restart_uuid != uuid || secs > MIN_REPEAT_TIME) {
scim_usleep (100000);
+
+ int client;
+ uint32 context;
+ get_focused_context(client, context);
+
+ uint32 ic = get_helper_ic (client, context);
+ String ic_uuid;
+ /* Get the context uuid from the client context registration table. */
+ {
+ ClientContextUUIDRepository::iterator it =
+ m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client], context));
+
+ if (it != m_client_context_uuids.end ())
+ ic_uuid = it->second;
+ }
+
+ m_start_helper_ic_index[uuid].push_back(std::make_pair(ic, ic_uuid));
m_signal_run_helper (uuid, m_config_name, m_display_name);
restart_uuid = uuid;
LOGE ("Auto restart soft ISE:%s", uuid.c_str ());