From: Li Zhang Date: Mon, 5 Dec 2016 07:38:06 +0000 (+0800) Subject: Implementing set_prediction_allow for IMEngine X-Git-Tag: accepted/tizen/3.0/common/20161206.125745~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F102220%2F4;p=platform%2Fcore%2Fuifw%2Fisf.git Implementing set_prediction_allow for IMEngine Change-Id: I412cee7d55d04aa52383499a5524230b5f49258b --- 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 97743d6..cfb5240 100755 --- a/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp +++ b/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp @@ -1570,7 +1570,7 @@ private: unlock(); } - void remote_delete_surrounding_text(int client, uint32 context_id, uint32 offset, uint32 len) { + void remote_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len) { SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n"; LOGD ("client id:%d\n", client); @@ -1585,6 +1585,21 @@ private: m_send_trans.write_to_socket(socket_client); unlock(); } + + void set_prediction_allow (int client, uint32 context, String uuid, int mode) { + LOGD ("client id:%d\n", 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_PREDICTION_ALLOW); + m_send_trans.put_data((uint32) mode); + + Socket client_socket(client); + m_send_trans.write_to_socket(client_socket); + } private: static void send_fail_reply (int client_id) diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index 2e5d981..80dd019 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -252,6 +252,8 @@ _wsc_im_ctx_content_type (void *data, struct wl_input_method_context *im_ctx, ui isf_wsc_context_input_panel_layout_set (wsc_ctx, wsc_context_input_panel_layout_get (wsc_ctx)); + g_info_manager->set_prediction_allow (WAYLAND_MODULE_CLIENT_ID, + wsc_context_prediction_allow_get (wsc_ctx)); isf_wsc_context_autocapital_type_set (wsc_ctx, wsc_context_autocapital_type_get (wsc_ctx)); diff --git a/ism/src/isf_info_manager.cpp b/ism/src/isf_info_manager.cpp index 767f9d1..b704ff7 100644 --- a/ism/src/isf_info_manager.cpp +++ b/ism/src/isf_info_manager.cpp @@ -3956,7 +3956,27 @@ client context helpers: %d, helpers uuid count: %d", std::cerr << __func__ << " is failed!!!\n"; return false; + } + + bool set_prediction_allow (int client, int mode) { + SCIM_DEBUG_MAIN (4) << __func__ << "\n"; + + if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || (m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) { + 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_prediction_allow (it->second.id, ctx, m_current_helper_uuid, mode); + return true; + } + } + + std::cerr << __func__ << " is failed!!!\n"; + return false; } const String& get_focused_context (int& client, uint32& context, bool force_last_context = false) const { @@ -5039,6 +5059,11 @@ bool InfoManager::set_autocapital_type (int mode) return m_impl->set_autocapital_type (mode); } +void InfoManager::set_prediction_allow (int client, bool mode) +{ + m_impl->set_prediction_allow (client, mode); +} + //////////////////////////////////Message function end///////////////////////////////////////// diff --git a/ism/src/isf_info_manager.h b/ism/src/isf_info_manager.h index 3179ed8..7a5b8c0 100644 --- a/ism/src/isf_info_manager.h +++ b/ism/src/isf_info_manager.h @@ -941,6 +941,8 @@ public: bool set_autocapital_type (int mode); + void set_prediction_allow (int client, bool mode); + //////////////////////////////////Message function end///////////////////////////////////////// diff --git a/ism/src/isf_message_queue.h b/ism/src/isf_message_queue.h index 31b57d7..bd79f51 100644 --- a/ism/src/isf_message_queue.h +++ b/ism/src/isf_message_queue.h @@ -668,6 +668,18 @@ protected: uint32 m_auto_capital_type; }; +/* ISM_TRANS_CMD_SET_PREDICTION_ALLOW */ +class MessageItemSetPredictionAllow : public MessageItemHelper +{ +public: + MessageItemSetPredictionAllow() : m_prediction_allow(1) {} + virtual ~MessageItemSetPredictionAllow() {} + + uint32& get_prediction_allow_ref() { return m_prediction_allow; } +protected: + uint32 m_prediction_allow; +}; + template inline T* alloc_message() /* We could use memory pool in the future for performance enhancement */ @@ -1542,6 +1554,20 @@ public: } break; } + case ISM_TRANS_CMD_SET_PREDICTION_ALLOW: + { + MessageItemSetPredictionAllow *message = alloc_message(); + if (message) { + message->get_command_ref() = cmd; + if (transaction.get_data(message->get_prediction_allow_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 a3ba20e..3cf42a4 100644 --- a/ism/src/isf_panel_agent_base.cpp +++ b/ism/src/isf_panel_agent_base.cpp @@ -565,6 +565,11 @@ void PanelAgentBase::remote_delete_surrounding_text (int client, uint32 context, LOGD ("not implemented "); } +void PanelAgentBase::set_prediction_allow (int client, uint32 context, String uuid, int mode) +{ + LOGW ("not implemented for %s", m_name.c_str ()); +} + } /* namespace scim */ /* diff --git a/ism/src/isf_panel_agent_base.h b/ism/src/isf_panel_agent_base.h index 8015dce..afc18be 100644 --- a/ism/src/isf_panel_agent_base.h +++ b/ism/src/isf_panel_agent_base.h @@ -906,6 +906,15 @@ public: * @return none. */ virtual void remote_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len); + + /** + * @brief set_prediction_allow. + * + * @param + * + * @return none. + */ + virtual void set_prediction_allow (int client, uint32 context, String uuid, int mode); }; /** @} */ diff --git a/ism/src/isf_panel_agent_manager.cpp b/ism/src/isf_panel_agent_manager.cpp index 7679a75..da886fe 100644 --- a/ism/src/isf_panel_agent_manager.cpp +++ b/ism/src/isf_panel_agent_manager.cpp @@ -886,6 +886,14 @@ void PanelAgentManager::remote_delete_surrounding_text (int id, uint32 context_i _p->remote_delete_surrounding_text (id, context_id, offset, len); } +void PanelAgentManager::set_prediction_allow (int id, uint32 context_id, String uuid, int mode) +{ + PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id); + + if (!_p.null ()) + _p->set_prediction_allow (id, context_id, uuid, mode); +} + } /* namespace scim */ /* diff --git a/ism/src/isf_panel_agent_manager.h b/ism/src/isf_panel_agent_manager.h index 9716775..530619a 100644 --- a/ism/src/isf_panel_agent_manager.h +++ b/ism/src/isf_panel_agent_manager.h @@ -355,6 +355,7 @@ public: void remote_forward_key_event (int target_client, uint32 target_context, const KeyEvent &key); void remote_commit_string (int target_client, uint32 target_context,const WideString& wstr); void remote_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len); + void set_prediction_allow (int id, uint32 context_id, String uuid, int mode); }; /** @} */ diff --git a/ism/src/scim_helper.cpp b/ism/src/scim_helper.cpp index 8b8a734..c6de7de 100644 --- a/ism/src/scim_helper.cpp +++ b/ism/src/scim_helper.cpp @@ -1356,6 +1356,12 @@ HelperAgent::handle_message (MessageItem *message) if (!m_impl->si.null ()) m_impl->si->set_autocapital_type(subclass->get_auto_capital_type_ref()); break; } + case ISM_TRANS_CMD_SET_PREDICTION_ALLOW: + { + MessageItemSetPredictionAllow *subclass = static_cast(message); + if (!m_impl->si.null ()) m_impl->si->set_prediction_allow(subclass->get_prediction_allow_ref() == 0 ? false : true); + break; + } default: break; }