From: Ji-hoon Lee Date: Mon, 28 May 2018 11:21:44 +0000 (+0900) Subject: Add optimization_hint for ISEs X-Git-Tag: accepted/tizen/unified/20180621.141405~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b15ebd501e0b8f3cc2fe246d3c9d2e5b1ef52d57;p=platform%2Fcore%2Fuifw%2Fisf.git Add optimization_hint for ISEs Change-Id: Ib81c0cdf95cef9527bcbe285d3690fc2b658491a --- 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 e266c93..c6d5a64 100644 --- a/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp +++ b/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp @@ -835,6 +835,17 @@ private: m_send_trans.write_to_socket(client_socket); } + void set_helper_optimization_hint(int client, uint32 context, const String& uuid, uint32& hint) { + Socket client_socket(client); + m_send_trans.clear(); + m_send_trans.put_command(SCIM_TRANS_CMD_REPLY); + m_send_trans.put_data(context); + m_send_trans.put_data(uuid); + m_send_trans.put_command(ISM_TRANS_CMD_SET_OPTIMIZATION_HINT); + m_send_trans.put_data(hint); + m_send_trans.write_to_socket(client_socket); + } + void finalize_content_helper(int client, uint32 context, const String& uuid, String& text, uint32& cursor_pos) { LOGD("client id:%d", client); @@ -3214,8 +3225,8 @@ private: trans.put_command(SCIM_TRANS_CMD_OK); trans.write_to_socket(client_socket); m_info_manager->hide_helper_ise (); - } else if (cmd == ISM_TRANS_CMD_LAUNCH_ISE) { - m_info_manager->launch_helper_ise(); + } else if (cmd == ISM_TRANS_CMD_PRELAUNCH_ISE) { + m_info_manager->prelaunch_helper_ise(); Transaction trans; Socket client_socket(client_id); diff --git a/ism/src/isf_control.cpp b/ism/src/isf_control.cpp index cb44448..877a58f 100644 --- a/ism/src/isf_control.cpp +++ b/ism/src/isf_control.cpp @@ -590,7 +590,7 @@ EXAPI int isf_control_prelaunch_ise (void) return -1; imcontrol_client.prepare (); - if (!imcontrol_client.launch_helper_ise ()) { + if (!imcontrol_client.prelaunch_helper_ise ()) { LOGW ("launch_helper_ise failed"); ret = -1; } diff --git a/ism/src/isf_imcontrol_client.cpp b/ism/src/isf_imcontrol_client.cpp index a767c6b..6d1e8a8 100644 --- a/ism/src/isf_imcontrol_client.cpp +++ b/ism/src/isf_imcontrol_client.cpp @@ -578,9 +578,9 @@ public: } } - bool launch_helper_ise (void) { + bool prelaunch_helper_ise (void) { int cmd; - m_trans.put_command (ISM_TRANS_CMD_LAUNCH_ISE); + m_trans.put_command (ISM_TRANS_CMD_PRELAUNCH_ISE); m_trans.write_to_socket (m_socket_imclient2panel); if (!m_trans.read_from_socket (m_socket_imclient2panel, m_socket_timeout)) { std::cerr << __func__ << " read_from_socket() may be timeout \n"; @@ -733,9 +733,9 @@ bool IMControlClient::hide_helper_ise (void) return m_impl->hide_helper_ise (); } -bool IMControlClient::launch_helper_ise (void) +bool IMControlClient::prelaunch_helper_ise (void) { - return m_impl->launch_helper_ise (); + return m_impl->prelaunch_helper_ise (); } void IMControlClient::set_socket_connect_timeout (int msec) diff --git a/ism/src/isf_imcontrol_client.h b/ism/src/isf_imcontrol_client.h index 0a43a61..6a202df 100644 --- a/ism/src/isf_imcontrol_client.h +++ b/ism/src/isf_imcontrol_client.h @@ -67,7 +67,7 @@ public: bool hide_helper_ise (void); void enable_remote_input (void); void disable_remote_input (void); - bool launch_helper_ise (void); + bool prelaunch_helper_ise (void); void set_socket_connect_timeout (int msec); }; diff --git a/ism/src/isf_info_manager.cpp b/ism/src/isf_info_manager.cpp index bc69500..781fca1 100644 --- a/ism/src/isf_info_manager.cpp +++ b/ism/src/isf_info_manager.cpp @@ -1392,6 +1392,22 @@ public: return false; } + bool set_helper_optimization_hint(const String& uuid, uint32& hint) { + HelperClientIndex::iterator it = m_helper_client_index.find(m_current_helper_uuid); + + if (it != m_helper_client_index.end()) { + int client; + uint32 context; + uint32 ctx; + get_focused_context(client, context); + ctx = get_helper_ic(client, context); + m_panel_agent_manager.set_helper_optimization_hint(it->second.id, ctx, uuid, hint); + return true; + } + + return false; + } + //ISM_TRANS_CMD_SHOW_ISF_CONTROL void show_isf_panel (int client_id) { SCIM_DEBUG_MAIN (4) << "InfoManager::show_isf_panel ()\n"; @@ -1492,9 +1508,26 @@ public: #endif } - void launch_helper_ise (void) { - SCIM_DEBUG_MAIN (4) << "InfoManager::launch_helper_ise ()\n"; - m_signal_start_default_ise (); + void prelaunch_helper_ise (void) { + SCIM_DEBUG_MAIN (4) << "InfoManager::prelaunch_helper_ise ()\n"; + + /* NOTE : + * Currenlty the SHOW_PREPARE hint is delivered only to the already-running ISEs. + * If the newly launched ise also has to be notified of given optimization hint, + * we'll need to mark the hint somewhere and send the message when a newly launched + * ise connects to the panel. + */ + HelperClientIndex::iterator it = m_helper_client_index.find(m_current_helper_uuid); + if (it != m_helper_client_index.end()) { + int client; + uint32 context; + uint32 ctx; + get_focused_context(client, context); + ctx = get_helper_ic(client, context); + m_panel_agent_manager.set_helper_optimization_hint(it->second.id, ctx, m_current_helper_uuid, ISE_OPTIMIZATION_HINT_SHOW_PREPARE); + } + + m_signal_start_default_ise(); } void set_default_ise (const DEFAULT_ISE_T& ise) { @@ -1894,7 +1927,6 @@ public: //ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE void set_ise_return_key_disable (int client_id, uint32 disabled) { SCIM_DEBUG_MAIN (4) << __func__ << "\n"; - if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) set_helper_return_key_disable (m_current_helper_uuid, disabled); } @@ -2065,6 +2097,13 @@ public: set_helper_prediction_hint_data (m_current_helper_uuid, key, value); } + //ISM_TRANS_CMD_SET_OPTIMIZATION_HINT + void set_optimization_hint(int client_id, uint32 hint) { + SCIM_DEBUG_MAIN(4) << "InfoManager::set_optimization_hint ()\n"; + if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) + set_helper_optimization_hint(m_current_helper_uuid, hint); + } + //ISM_TRANS_CMD_EXPAND_CANDIDATE void expand_candidate () { LOGD (""); @@ -4613,9 +4652,9 @@ void InfoManager::hide_helper_ise (void) } //ISM_TRANS_CMD_LAUNCH_ISE from ISF control -void InfoManager::launch_helper_ise (void) +void InfoManager::prelaunch_helper_ise (void) { - m_impl->launch_helper_ise (); + m_impl->prelaunch_helper_ise (); } //SCIM_TRANS_CMD_PROCESS_KEY_EVENT @@ -4889,6 +4928,12 @@ void InfoManager::set_prediction_hint_data (int client_id, String key, String va m_impl->set_prediction_hint_data (client_id, key, value); } +//ISM_TRANS_CMD_SET_OPTIMIZATION_HINT +void InfoManager::set_optimization_hint(int client_id, uint32 hint) +{ + m_impl->set_optimization_hint(client_id, hint); +} + //ISM_TRANS_CMD_EXPAND_CANDIDATE void InfoManager::expand_candidate () { diff --git a/ism/src/isf_info_manager.h b/ism/src/isf_info_manager.h index 5464c95..f729968 100644 --- a/ism/src/isf_info_manager.h +++ b/ism/src/isf_info_manager.h @@ -615,8 +615,8 @@ public: //ISM_TRANS_CMD_HIDE_ISE_PANEL from ISF control void hide_helper_ise (void); - //ISM_TRANS_CMD_LAUNCH_ISE - void launch_helper_ise (void); + //ISM_TRANS_CMD_PRELAUNCH_ISE + void prelaunch_helper_ise (void); //SCIM_TRANS_CMD_PROCESS_KEY_EVENT bool process_key_event (KeyEvent& key, uint32 serial); @@ -753,6 +753,9 @@ public: //ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA void set_prediction_hint_data (int client_id, String key, String value); + //ISM_TRANS_CMD_SET_OPTIMIZATION_HINT + void set_optimization_hint(int client_id, uint32 hint); + //ISM_TRANS_CMD_EXPAND_CANDIDATE void expand_candidate (); diff --git a/ism/src/isf_message_queue.h b/ism/src/isf_message_queue.h index 16d4e46..0619d2e 100644 --- a/ism/src/isf_message_queue.h +++ b/ism/src/isf_message_queue.h @@ -758,6 +758,18 @@ protected: String m_value; }; +/* ISM_TRANS_CMD_SET_OPTIMIZATION_HINT */ +class MessageItemSetOptimizationHint : public MessageItemHelper +{ +public: + MessageItemSetOptimizationHint() : m_hint(0) {} + virtual ~MessageItemSetOptimizationHint() {} + + uint32& get_hint_ref() { return m_hint; } +protected: + uint32 m_hint; +}; + template inline T* alloc_message() /* We could use memory pool in the future for performance enhancement */ @@ -1753,6 +1765,21 @@ public: } break; } + case ISM_TRANS_CMD_SET_OPTIMIZATION_HINT: + { + MessageItemSetOptimizationHint *message = alloc_message(); + if (message) { + message->get_command_ref() = cmd; + if (transaction.get_data(message->get_hint_ref())) { + m_list_messages.push_back(message); + } + else { + LOGW("wrong format of transaction\n"); + dealloc_message(message); + } + } + break; + } } } diff --git a/ism/src/isf_panel_agent_base.cpp b/ism/src/isf_panel_agent_base.cpp index f42a645..99f76a1 100644 --- a/ism/src/isf_panel_agent_base.cpp +++ b/ism/src/isf_panel_agent_base.cpp @@ -279,6 +279,10 @@ void PanelAgentBase::set_helper_prediction_hint_data (int client, uint32 context { } +void PanelAgentBase::set_helper_optimization_hint(int client, uint32 context, const String& uuid, uint32& hint) +{ +} + bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial) { return false; diff --git a/ism/src/isf_panel_agent_base.h b/ism/src/isf_panel_agent_base.h index 43f1078..39a27fb 100644 --- a/ism/src/isf_panel_agent_base.h +++ b/ism/src/isf_panel_agent_base.h @@ -521,6 +521,15 @@ public: virtual void set_helper_prediction_hint_data (int client, uint32 context, const String& uuid, String& key, String &value); /** + * @brief set_helper_optimization_hint. + * + * @param + * + * @return none. + */ + virtual void set_helper_optimization_hint (int client, uint32 context, const String& uuid, uint32& hint); + + /** * @brief process_key_event. * * @param diff --git a/ism/src/isf_panel_agent_manager.cpp b/ism/src/isf_panel_agent_manager.cpp index 9bfe8bc..6a57c4a 100644 --- a/ism/src/isf_panel_agent_manager.cpp +++ b/ism/src/isf_panel_agent_manager.cpp @@ -538,6 +538,14 @@ void PanelAgentManager::set_helper_prediction_hint_data (int id, uint32 context_ _p->set_helper_prediction_hint_data (id, context_id, uuid, key, value); } +void PanelAgentManager::set_helper_optimization_hint(int id, uint32 context_id, const String& uuid, uint32 hint) +{ + PanelAgentPointer _p = m_impl->get_panel_agent_by_id(id); + + if (!_p.null()) + _p->set_helper_optimization_hint(id, context_id, uuid, hint); +} + bool PanelAgentManager::process_key_event (int id, uint32 context_id, const String& uuid, KeyEvent& key, uint32 serial) { PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id); diff --git a/ism/src/isf_panel_agent_manager.h b/ism/src/isf_panel_agent_manager.h index 818c384..c9faa9f 100644 --- a/ism/src/isf_panel_agent_manager.h +++ b/ism/src/isf_panel_agent_manager.h @@ -310,6 +310,7 @@ public: void set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode); void set_helper_prediction_hint (int client, uint32 context, const String& uuid, String& prediction_hint); void set_helper_prediction_hint_data (int id, uint32 context_id, const String& uuid, String& key, String& value); + void set_helper_optimization_hint (int id, uint32 context_id, const String& uuid, uint32 hint); void set_helper_mime_type (int client, uint32 context, const String& uuid, String& mime_type); void finalize_content_helper (int client, uint32 context, const String& uuid, String& text, uint32& cursor_pos); bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial); diff --git a/ism/src/scim_helper.cpp b/ism/src/scim_helper.cpp index 5b6c876..0885031 100644 --- a/ism/src/scim_helper.cpp +++ b/ism/src/scim_helper.cpp @@ -230,6 +230,7 @@ public: HelperAgentSignalStringVoid signal_set_prediction_hint; HelperAgentSignalStringVoid signal_set_mime_type; HelperAgentSignalString signal_set_prediction_hint_data; + HelperAgentSignalUintVoid signal_set_optimization_hint; public: HelperAgentImpl (HelperAgent* thiz) : magic(0), magic_active(0), timeout(-1), focused_ic ((uint32) -1), thiz (thiz), @@ -1478,6 +1479,12 @@ HelperAgent::handle_message (MessageItem *message) m_impl->signal_set_prediction_hint_data (this, 0, subclass->get_key_ref(), subclass->get_value_ref()); break; } + case ISM_TRANS_CMD_SET_OPTIMIZATION_HINT: + { + MessageItemSetOptimizationHint *subclass = static_cast(message); + m_impl->signal_set_optimization_hint(this, subclass->get_hint_ref()); + break; + } default: break; } @@ -3546,6 +3553,20 @@ HelperAgent::signal_connect_set_prediction_hint_data (HelperAgentSlotString *slo return m_impl->signal_set_prediction_hint_data.connect (slot); } +/** + * @brief Connect a slot to Helper set optimization hint signal. + * + * This signal is used to send optimization hint to Helper ISE. + * + * The prototype of the slot is: + * void set_prediction_hint_data (const HelperAgent *agent, char *key, char *value); + */ +Connection +HelperAgent::signal_connect_set_optimization_hint (HelperAgentSlotUintVoid *slot) +{ + return m_impl->signal_set_optimization_hint.connect (slot); +} + } /* namespace scim */ /* diff --git a/ism/src/scim_helper.h b/ism/src/scim_helper.h index ea831e1..cb42967 100644 --- a/ism/src/scim_helper.h +++ b/ism/src/scim_helper.h @@ -1408,6 +1408,16 @@ public: * void set_prediction_hint_data (const HelperAgent *agent, char *key, char *value); */ Connection signal_connect_set_prediction_hint_data (HelperAgentSlotString *slot); + + /** + * @brief Connect a slot to Helper set optimization hint signal. + * + * This signal is used to send optimization hint to Helper ISE. + * + * The prototype of the slot is: + * void set_optimization_hint (const HelperAgent *agent, uint32 &hint); + */ + Connection signal_connect_set_optimization_hint (HelperAgentSlotUintVoid *slot); }; /** @} */ diff --git a/ism/src/scim_trans_commands.h b/ism/src/scim_trans_commands.h index ec6a3c5..7dbb3b9 100644 --- a/ism/src/scim_trans_commands.h +++ b/ism/src/scim_trans_commands.h @@ -646,7 +646,7 @@ const int ISM_REMOTE_TRANS_CMD_RECV_SURROUNDING_TEXT = 1029; const int ISM_REMOTE_TRANS_CMD_RECV_INPUT_RESOURCE = 1030; const int ISM_REMOTE_TRANS_CMD_CHECK_PRIVILEGE = 1031; const int ISM_REMOTE_TRANS_CMD_DELETE_SURROUNDING_TEXT = 1032; -const int ISM_TRANS_CMD_LAUNCH_ISE = 1033; +const int ISM_TRANS_CMD_PRELAUNCH_ISE = 1033; /* IMControl to ISE */ const int ISM_TRANS_CMD_SET_ISE_MODE = 1108; @@ -674,6 +674,7 @@ const int ISM_TRANS_CMD_SET_PREDICTION_HINT = 1129; const int ISM_TRANS_CMD_SET_MIME_TYPE = 1130; const int ISM_TRANS_CMD_FINALIZE_CONTENT = 1131; const int ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA = 1132; +const int ISM_TRANS_CMD_SET_OPTIMIZATION_HINT = 1133; /* ISE/Panel to IMControl */ const int ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT = 1151; diff --git a/ism/src/scim_utility.h b/ism/src/scim_utility.h index a007992..15dec53 100644 --- a/ism/src/scim_utility.h +++ b/ism/src/scim_utility.h @@ -518,6 +518,11 @@ typedef enum FOUR_LINE_CANDIDATE } ISF_CANDIDATE_PORTRAIT_LINE_T; +typedef enum +{ + ISE_OPTIMIZATION_HINT_NONE = 0, + ISE_OPTIMIZATION_HINT_SHOW_PREPARE, +} ISE_OPTMIZATION_HINT_T; #define PROP_X_EXT_KEYBOARD_INPUT_DETECTED "HW Keyboard Input Started" #define PROP_X_EXT_KEYBOARD_EXIST "X External Keyboard Exist"