From ead58edfb16f14ece51d49017e5bf73d378fa19e Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 8 Sep 2016 15:15:33 +0900 Subject: [PATCH] Add remote_control_input_resource_changed_cb() Change-Id: Id4942df3eae7438815a52ae3f17ad171fba71eb3 --- .../ecore_socket_panel_agent_module.cpp | 37 +++++++++- ism/modules/panelagent/wayland/isf_wsc_context.h | 4 +- .../wayland/wayland_panel_agent_module.cpp | 34 +++++++-- ism/src/isf_info_manager.cpp | 43 ++++++++++- ism/src/isf_info_manager.h | 4 ++ ism/src/isf_panel_agent_base.cpp | 10 +++ ism/src/isf_panel_agent_base.h | 18 +++++ ism/src/isf_panel_agent_manager.cpp | 16 +++++ ism/src/isf_panel_agent_manager.h | 2 + ism/src/isf_remote_client.cpp | 29 +++++++- ism/src/isf_remote_client.h | 2 + ism/src/isf_remote_control.cpp | 48 +++++++++++++ ism/src/isf_remote_control.h | 83 +++++++++++++++++++++- ism/src/scim_trans_commands.h | 5 +- 14 files changed, 315 insertions(+), 20 deletions(-) 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 eac93a2..56c4621 100755 --- a/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp +++ b/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp @@ -1091,6 +1091,24 @@ private: } } + void socket_remoteinput_input_resource (int client, uint32 input_resource) { + SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n"; + LOGD ("client id:%d\n", client); + + bool ret; + ret = (client == -1) ? false : true; + + if (ret) { + Socket client_socket(client); + + m_send_trans.clear(); + m_send_trans.put_command(SCIM_TRANS_CMD_REPLY); + m_send_trans.put_command(ISM_REMOTE_TRANS_CMD_RECV_INPUT_RESOURCE); + m_send_trans.put_data(input_resource); + m_send_trans.write_to_socket(client_socket); + } + } + void socket_update_selection(int client, uint32 context, String& uuid, String text) { LOGD ("client id:%d\n", client); @@ -1562,6 +1580,22 @@ private: m_send_trans.write_to_socket(socket_client); unlock(); } + + 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); + + Socket socket_client(client); + lock(); + m_send_trans.clear(); + m_send_trans.put_command(SCIM_TRANS_CMD_REPLY); + m_send_trans.put_data(context_id); + m_send_trans.put_command(SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT); + m_send_trans.put_data(offset); + m_send_trans.put_data(len); + m_send_trans.write_to_socket(socket_client); + unlock(); + } private: static void send_fail_reply (int client_id) @@ -3056,8 +3090,7 @@ private: bool ret = false; if (m_recv_trans.get_data(offset) && m_recv_trans.get_data(len)) { - m_info_manager->socket_helper_delete_surrounding_text(client_id, offset, len); - ret = true; + ret = m_info_manager->remoteinput_delete_surrounding_text(offset, len); } else { LOGW ("wrong format of transaction\n"); } diff --git a/ism/modules/panelagent/wayland/isf_wsc_context.h b/ism/modules/panelagent/wayland/isf_wsc_context.h index 9528255..e6d8514 100644 --- a/ism/modules/panelagent/wayland/isf_wsc_context.h +++ b/ism/modules/panelagent/wayland/isf_wsc_context.h @@ -40,9 +40,9 @@ #endif typedef enum { - INPUT_RESOURCE_NONE, INPUT_RESOURCE_LOCAL, - INPUT_RESOURCE_REMOTE + INPUT_RESOURCE_REMOTE, + INPUT_RESOURCE_NONE } Input_Resource; struct weescim; diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index ef2923f..3c70949 100755 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -1314,6 +1314,9 @@ check_input_resource (WSCContextISF* wsc_ctx, Input_Resource input_res) if (context_scim->impl->input_resource == input_res) return; + if (context_scim->impl->input_resource != input_res && input_res != INPUT_RESOURCE_NONE) + g_info_manager->remoteinput_callback_input_resource (input_res); + if (context_scim->impl->input_resource == INPUT_RESOURCE_REMOTE && input_res == INPUT_RESOURCE_LOCAL) { WideString wstr = context_scim->impl->preedit_string; @@ -2637,7 +2640,9 @@ panel_slot_commit_string (int context, const WideString &wstr, bool remote_mode) LOGW ("block remote input\n"); return; } - check_input_resource(ic, INPUT_RESOURCE_REMOTE); + check_input_resource (ic, INPUT_RESOURCE_REMOTE); + } else { + check_input_resource (ic, INPUT_RESOURCE_LOCAL); } if (utf8_wcstombs (wstr) == String (" ") || utf8_wcstombs (wstr) == String (" ")) @@ -2667,7 +2672,9 @@ panel_slot_forward_key_event (int context, const KeyEvent &key, bool remote_mode LOGW ("block remote input\n"); return; } - check_input_resource(ic, INPUT_RESOURCE_REMOTE); + check_input_resource (ic, INPUT_RESOURCE_REMOTE); + } else { + check_input_resource (ic, INPUT_RESOURCE_LOCAL); } if (strlen (key.get_key_string ().c_str ()) >= 116) @@ -2734,8 +2741,6 @@ _show_preedit_string (int context) SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << "\n"; if (ic && ic->impl && _focused_ic == ic) { - check_input_resource(ic, INPUT_RESOURCE_LOCAL); - if (!ic->impl->is_on) ic->impl->is_on = true; @@ -3033,7 +3038,7 @@ public: void forward_key_event (int id, uint32 context_id, const KeyEvent &key) { LOGD ("client id:%d", id); - panel_slot_forward_key_event (context_id, key, true); + panel_slot_forward_key_event (context_id, key, false); } void @@ -3054,6 +3059,19 @@ public: panel_slot_forward_key_event (context_id, key, true); } + void + remote_delete_surrounding_text (int id, uint32 context_id, uint32 offset, uint32 len) { + LOGD ("client id:%d", id); + + if (_focused_ic) { + if (_focused_ic->impl->block_input_resource) + return; + + check_input_resource(_focused_ic, INPUT_RESOURCE_REMOTE); + wsc_context_delete_surrounding (_focused_ic, offset, len); + } + } + #if 0 void request_help (int id, uint32 context_id) { @@ -3111,6 +3129,8 @@ public: if (!ic->impl->is_on) ic->impl->is_on = true; + check_input_resource (ic, INPUT_RESOURCE_LOCAL); + ic->impl->preedit_string = preedit; ic->impl->preedit_attrlist = attrs; ic->impl->commit_string = commit; @@ -3230,8 +3250,10 @@ public: socket_helper_delete_surrounding_text (int id, uint32 context_id, uint32 offset, uint32 len) { LOGD ("client id:%d", id); //panel_slot_delete_surrounding_text (context_id, offset, len); - if (_focused_ic) + if (_focused_ic) { + check_input_resource(_focused_ic, INPUT_RESOURCE_LOCAL); wsc_context_delete_surrounding (_focused_ic, offset, len); + } } void diff --git a/ism/src/isf_info_manager.cpp b/ism/src/isf_info_manager.cpp index 0a13057..ad1c7b6 100644 --- a/ism/src/isf_info_manager.cpp +++ b/ism/src/isf_info_manager.cpp @@ -1959,7 +1959,7 @@ public: bool remoteinput_commit_string (const WideString &str) { - SCIM_DEBUG_MAIN(1) << "PanelAgent::commit_string ()\n"; + SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_commit_string ()\n"; int client = -1; uint32 context = 0; @@ -1977,7 +1977,7 @@ public: bool remoteinput_send_key_event (const KeyEvent &key) { - SCIM_DEBUG_MAIN(1) << "PanelAgent::send_key_event ()\n"; + SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_send_key_event ()\n"; int client = -1; uint32 context = 0; @@ -1991,7 +1991,7 @@ public: bool remoteinput_forward_key_event (const KeyEvent &key) { - SCIM_DEBUG_MAIN(1) << "PanelAgent::forward_key_event ()\n"; + SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_forward_key_event ()\n"; int client = -1; uint32 context = 0; @@ -2003,6 +2003,20 @@ public: return client >= 0; } + bool remoteinput_delete_surrounding_text (uint32 offset, uint32 len) + { + SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_delete_surrounding_text ()\n"; + int client = -1; + uint32 context = 0; + + get_focused_context (client, context); + if (client >= 0) { + m_panel_agent_manager.remote_delete_surrounding_text (client, context, offset, len); + } + + return client >= 0; + } + Connection signal_connect_turn_on (InfoManagerSlotVoid* slot) { return m_signal_turn_on.connect (slot); } @@ -2802,6 +2816,15 @@ client context helpers: %d, helpers uuid count: %d", unlock (); } + void remoteinput_callback_input_resource (uint32 input_resource) { + SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n"; + LOGD (""); + + lock(); + m_panel_agent_manager.socket_remoteinput_input_resource (m_current_recv_remoteinput_id, input_resource); + unlock (); + } + //ISM_TRANS_CMD_UPDATE_SELECTION void socket_update_selection (String text) { SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n"; @@ -4204,22 +4227,31 @@ InfoManager::remoteinput_update_preedit_string (WideString str, AttributeList &a { return m_impl->remoteinput_update_preedit_string (str, attrs, caret); } + bool InfoManager::remoteinput_commit_string (const WideString &str) { return m_impl->remoteinput_commit_string (str); } + bool InfoManager::remoteinput_send_key_event (const KeyEvent &key) { return m_impl->remoteinput_send_key_event (key); } + bool InfoManager::remoteinput_forward_key_event (const KeyEvent &key) { return m_impl->remoteinput_forward_key_event (key); } +bool +InfoManager::remoteinput_delete_surrounding_text (uint32 offset, uint32 len) +{ + return m_impl->remoteinput_delete_surrounding_text (offset, len); +} + /////////////////////////////////Message function begin///////////////////////////////////////// //ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE @@ -4627,6 +4659,11 @@ void InfoManager::remoteinput_callback_surrounding_text (String text, uint32 cur m_impl->remoteinput_callback_surrounding_text (text, cursor); } +void InfoManager::remoteinput_callback_input_resource (uint32 input_resource) +{ + m_impl->remoteinput_callback_input_resource (input_resource); +} + //ISM_TRANS_CMD_UPDATE_SELECTION void InfoManager::socket_update_selection (String text) { diff --git a/ism/src/isf_info_manager.h b/ism/src/isf_info_manager.h index 7fa90fe..82a37d7 100644 --- a/ism/src/isf_info_manager.h +++ b/ism/src/isf_info_manager.h @@ -570,6 +570,8 @@ public: bool remoteinput_send_input_message (int client_id, char* buf, size_t len); + bool remoteinput_delete_surrounding_text (uint32 offset, uint32 len); + void remoteinput_send_surrounding_text (const char* text, uint32 cursor); void remoteinput_callback_focus_in (void); @@ -580,6 +582,8 @@ public: void remoteinput_callback_surrounding_text (String text, uint32 cursor); + void remoteinput_callback_input_resource (uint32 input_resource); + /////////////////////////////////Message function begin///////////////////////////////////////// //ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE diff --git a/ism/src/isf_panel_agent_base.cpp b/ism/src/isf_panel_agent_base.cpp index 062982c..f8ad26d 100644 --- a/ism/src/isf_panel_agent_base.cpp +++ b/ism/src/isf_panel_agent_base.cpp @@ -373,6 +373,11 @@ void PanelAgentBase::socket_remoteinput_surrounding_text (int client, String& te LOGW ("not implemented for %s", m_name.c_str ()); } +void PanelAgentBase::socket_remoteinput_input_resource (int client, uint32 input_resource) +{ + LOGW ("not implemented for %s", m_name.c_str ()); +} + void PanelAgentBase::socket_update_selection (int client, uint32 context, String& uuid, String text) { LOGW ("not implemented for %s", m_name.c_str ()); @@ -550,6 +555,11 @@ void PanelAgentBase::remote_commit_string (int client, uint32 context,const Wide LOGW ("not implemented for %s", m_name.c_str ()); } +void PanelAgentBase::remote_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len) +{ + LOGD ("not implemented "); +} + } /* namespace scim */ /* diff --git a/ism/src/isf_panel_agent_base.h b/ism/src/isf_panel_agent_base.h index 3c74d63..bd8aac9 100644 --- a/ism/src/isf_panel_agent_base.h +++ b/ism/src/isf_panel_agent_base.h @@ -584,6 +584,15 @@ public: virtual void socket_remoteinput_surrounding_text (int client, String& text, uint32 cursor); /** + * @brief socket_remoteinput_input_resource. + * + * @param + * + * @return none. + */ + virtual void socket_remoteinput_input_resource (int client, uint32 input_resource); + + /** * @brief socket_update_selection. * * @param @@ -879,6 +888,15 @@ public: * @return none. */ virtual void remote_commit_string (int client, uint32 context,const WideString& wstr); + + /** + * @brief remote_delete_surrounding_text. + * + * @param + * + * @return none. + */ + virtual void remote_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len); }; /** @} */ diff --git a/ism/src/isf_panel_agent_manager.cpp b/ism/src/isf_panel_agent_manager.cpp index 3d83fae..dc99c5e 100644 --- a/ism/src/isf_panel_agent_manager.cpp +++ b/ism/src/isf_panel_agent_manager.cpp @@ -604,6 +604,14 @@ void PanelAgentManager::socket_remoteinput_surrounding_text (int id, String& tex _p->socket_remoteinput_surrounding_text (id, text, cursor); } +void PanelAgentManager::socket_remoteinput_input_resource (int id, uint32 input_resource) +{ + PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id); + + if (!_p.null ()) + _p->socket_remoteinput_input_resource (id, input_resource); +} + void PanelAgentManager::socket_update_selection (int id, uint32 context_id, String& uuid, String text) { PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id); @@ -862,6 +870,14 @@ void PanelAgentManager::remote_commit_string (int id, uint32 context_id, const W _p->remote_commit_string (id, context_id, wstr); } +void PanelAgentManager::remote_delete_surrounding_text (int id, uint32 context_id, uint32 offset, uint32 len) +{ + PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id); + + if (!_p.null ()) + _p->remote_delete_surrounding_text (id, context_id, offset, len); +} + } /* namespace scim */ /* diff --git a/ism/src/isf_panel_agent_manager.h b/ism/src/isf_panel_agent_manager.h index a485169..d73fce3 100644 --- a/ism/src/isf_panel_agent_manager.h +++ b/ism/src/isf_panel_agent_manager.h @@ -319,6 +319,7 @@ public: void socket_remoteinput_focus_out (int client); void socket_remoteinput_entry_metadata (int client, uint32 hint, uint32 layout, int variation, uint32 autocapital_type); void socket_remoteinput_surrounding_text (int client, String& text, uint32 cursor); + void socket_remoteinput_input_resource (int client, uint32 input_resource); void socket_update_selection (int client, uint32 context, String& uuid, String text); void socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector& list); void socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode); @@ -352,6 +353,7 @@ public: void remote_send_key_event (int target_client, uint32 target_context, const KeyEvent &key); 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); }; /** @} */ diff --git a/ism/src/isf_remote_client.cpp b/ism/src/isf_remote_client.cpp index 8d79060..b507756 100644 --- a/ism/src/isf_remote_client.cpp +++ b/ism/src/isf_remote_client.cpp @@ -139,7 +139,7 @@ class RemoteInputClient::RemoteInputClientImpl RemoteInputClientSignalVoid m_signal_hide_ise; String m_surrounding_text; - uint32 m_hint, m_cursor, m_layout, m_variation, m_autocapital_type; + uint32 m_hint, m_cursor, m_layout, m_variation, m_autocapital_type, m_input_resource; public: RemoteInputClientImpl () @@ -151,7 +151,8 @@ public: m_cursor (0), m_layout (0), m_variation (0), - m_autocapital_type (0) { + m_autocapital_type (0), + m_input_resource (0) { } int open_connection (void) { @@ -316,11 +317,15 @@ public: LOGD ("RemoteInput_Client::cmd = %d\n", cmd); switch (cmd) { case ISM_REMOTE_TRANS_CMD_RECV_FOCUS_IN: + { type = REMOTE_CONTROL_CALLBACK_FOCUS_IN; break; + } case ISM_REMOTE_TRANS_CMD_RECV_FOCUS_OUT: + { type = REMOTE_CONTROL_CALLBACK_FOCUS_OUT; break; + } case ISM_REMOTE_TRANS_CMD_RECV_ENTRY_METADATA: { type = REMOTE_CONTROL_CALLBACK_ENTRY_METADATA; @@ -342,6 +347,16 @@ public: LOGW ("wrong format of transaction\n"); break; } + case ISM_REMOTE_TRANS_CMD_RECV_INPUT_RESOURCE: + { + type = REMOTE_CONTROL_CALLBACK_INPUT_RESOURCE; + + if (m_trans_recv.get_data (m_input_resource)) { + } + else + LOGW ("wrong format of transaction\n"); + break; + } default: break; } @@ -360,6 +375,10 @@ public: surrounding_text = m_surrounding_text; *cursor = m_cursor; } + + void get_input_resource (int *input_resource) { + *input_resource = m_input_resource; + } }; RemoteInputClient::RemoteInputClient () @@ -443,6 +462,12 @@ RemoteInputClient::get_surrounding_text (String &surrounding_text, int *cursor) { m_impl->get_surrounding_text (surrounding_text, cursor); } + +void +RemoteInputClient::get_input_resource (int *input_resource) +{ + m_impl->get_input_resource (input_resource); +} }; /* diff --git a/ism/src/isf_remote_client.h b/ism/src/isf_remote_client.h index 40067bb..bb4ba77 100644 --- a/ism/src/isf_remote_client.h +++ b/ism/src/isf_remote_client.h @@ -34,6 +34,7 @@ typedef enum { REMOTE_CONTROL_CALLBACK_FOCUS_OUT, REMOTE_CONTROL_CALLBACK_ENTRY_METADATA, REMOTE_CONTROL_CALLBACK_TEXT_UPDATED, + REMOTE_CONTROL_CALLBACK_INPUT_RESOURCE, } remote_control_callback_type; class EXAPI RemoteInputClient @@ -57,6 +58,7 @@ public: remote_control_callback_type recv_callback_message (void); void get_entry_metadata (int *hint, int *layout, int *variation, int *autocapital_type); void get_surrounding_text (String &default_text, int *cursor); + void get_input_resource (int *input_resource); }; } diff --git a/ism/src/isf_remote_control.cpp b/ism/src/isf_remote_control.cpp index 89b00ad..11d5d07 100644 --- a/ism/src/isf_remote_control.cpp +++ b/ism/src/isf_remote_control.cpp @@ -29,6 +29,8 @@ struct _remote_control_client { void* metadata_cb_user_data; remote_control_text_updated_cb text_updated_cb; void* text_updated_cb_user_data; + remote_control_input_resource_changed_cb input_resource_changed_cb; + void* input_resource_changed_cb_user_data; }; static Eina_Bool @@ -76,6 +78,18 @@ remote_handler(void *data, Ecore_Fd_Handler *fd_handler) client->remote_client.get_surrounding_text (surrounding_text, &cursor); client->text_updated_cb (client->text_updated_cb_user_data, strdup (surrounding_text.c_str ()), cursor); } + break; + } + case REMOTE_CONTROL_CALLBACK_INPUT_RESOURCE: + { + if (focus_flag) { + int resource; + + client->remote_client.get_input_resource (&resource); + client->input_resource_changed_cb (client->input_resource_changed_cb_user_data, + static_cast (resource)); + } + break; } case REMOTE_CONTROL_CALLBACK_ERROR: break; @@ -285,6 +299,40 @@ EXAPI int remote_control_text_updated_callback_unset(remote_control_client *clie return REMOTE_CONTROL_ERROR_NONE; } +EXAPI int remote_control_input_resource_changed_callback_set(remote_control_client *client, remote_control_input_resource_changed_cb func , void *user_data) +{ + if (client == NULL) + return REMOTE_CONTROL_INVALID_PARAMETER; + + if (!client->remote_client.prepare()) + return REMOTE_CONTROL_REPLY_TIMEOUT; + + if (!client->remote_client.check_privilege()) + return REMOTE_CONTROL_PERMISSION_DENIED; + + client->input_resource_changed_cb = func; + client->input_resource_changed_cb_user_data = user_data; + + return REMOTE_CONTROL_ERROR_NONE; +} + +EXAPI int remote_control_input_resource_changed_callback_unset(remote_control_client *client) +{ + if (client == NULL) + return REMOTE_CONTROL_INVALID_PARAMETER; + + if (!client->remote_client.prepare()) + return REMOTE_CONTROL_REPLY_TIMEOUT; + + if (!client->remote_client.check_privilege()) + return REMOTE_CONTROL_PERMISSION_DENIED; + + client->input_resource_changed_cb = NULL; + client->input_resource_changed_cb_user_data = NULL; + + return REMOTE_CONTROL_ERROR_NONE; +} + EXAPI int remote_control_send_key_event(remote_control_client *client, remote_control_key_type_e key) { if (client == NULL || key < REMOTE_CONTROL_KEY_ENTER || key > REMOTE_CONTROL_KEY_PAGE_DOWN) diff --git a/ism/src/isf_remote_control.h b/ism/src/isf_remote_control.h index 64b77db..f672080 100644 --- a/ism/src/isf_remote_control.h +++ b/ism/src/isf_remote_control.h @@ -47,6 +47,18 @@ typedef enum { } remote_control_key_type_e; /** + * @brief Enumeration for input resources. + * + * @since_tizen @if TV 3.0 @endif + * + * @see remote_control_input_resource_changed_cb() + */ +typedef enum { + REMOTE_CONTROL_INPUT_RESOURCE_LOCAL, /**< Input event from TV IME, H/W keyboard */ + REMOTE_CONTROL_INPUT_RESOURCE_REMOTE, /**< Input event from remote control API */ +} remote_control_input_resource; + +/** * @brief The structure type to contain the attributes of text field. * * @since_tizen @if TV 3.0 @endif @@ -314,15 +326,15 @@ EXAPI int remote_control_entry_metadata_callback_unset(remote_control_client *cl * @remarks remote_control_text_updated_cb() called after remote_control_entry_metadata_cb() * * @param[in] user_data User data to be passed from the callback registration function - * @param[in] default_text The UTF-8 string requested + * @param[in] surrounding_text The UTF-8 string requested * @param[in] cursor_pos The cursor position * - * @pre The callback can be registered using remote_control_default_text_callback_set() function. + * @pre The callback can be registered using remote_control_text_updated_callback_set() function. * * @see remote_control_text_updated_callback_set() * @see remote_control_text_updated_callback_unset() */ -typedef void (*remote_control_text_updated_cb)(void *user_data, char *default_text, int cursor_pos); +typedef void (*remote_control_text_updated_cb)(void *user_data, char *surrounding_text, int cursor_pos); /** * @brief Register a remote_control_text_updated_cb() callback function. @@ -371,6 +383,71 @@ EXAPI int remote_control_text_updated_callback_set(remote_control_client *client EXAPI int remote_control_text_updated_callback_unset(remote_control_client *client); /** + * @brief Called when the input resource is changed. + * + * @since_tizen @if TV 3.0 @endif + * + * @privlevel platform + * + * @privilege %http://tizen.org/privilege/imemanager + * + * @param[in] user_data User data to be passed from the callback registration function + * @param[in] resource local input event callback function + * + * @pre The callback can be registered using remote_control_input_resource_changed_callback_set() function. + * + * @see remote_control_local_input_callback_set() + * @see remote_control_local_input_callback_unset() + */ +typedef void (*remote_control_input_resource_changed_cb)(void *user_data, remote_control_input_resource resource); + +/** + * @brief Register a callback function to be called when the input resource is changed. + * + * @since_tizen @if TV 3.0 @endif + * + * @privlevel platform + * + * @privilege %http://tizen.org/privilege/imemanager + * + * @param[in] client The remote control client + * @param[in] func Input resource changed callback function + * @param[in] user_data User data to be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #REMOTE_CONTROL_ERROR_NONE No error + * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function + * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter + * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Socket connection failed + * + * @see remote_control_input_resource_changed_cb() + * @see remote_control_input_resource_changed_callback_unset() + */ +EXAPI int remote_control_input_resource_changed_callback_set(remote_control_client *client, remote_control_input_resource_changed_cb func , void *user_data); + +/** + * @brief Remove a remote_control_input_resource_changed_cb() callback function. + * + * @since_tizen @if TV 3.0 @endif + * + * @privlevel platform + * + * @privilege %http://tizen.org/privilege/imemanager + * + * @param[in] client The remote control client + * + * @return 0 on success, otherwise a negative error value + * @retval #REMOTE_CONTROL_ERROR_NONE No error + * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function + * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter + * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Socket connection failed + * + * @see remote_control_input_resource_changed_cb() + * @see remote_control_input_resource_changed_callback_set() + */ +EXAPI int remote_control_input_resource_changed_callback_unset(remote_control_client *client); + +/** * @brief Sends the key event to the associated text field. * * @since_tizen @if TV 3.0 @endif diff --git a/ism/src/scim_trans_commands.h b/ism/src/scim_trans_commands.h index 23f7269..7cc18af 100644 --- a/ism/src/scim_trans_commands.h +++ b/ism/src/scim_trans_commands.h @@ -642,8 +642,9 @@ const int ISM_REMOTE_TRANS_CMD_RECV_FOCUS_IN = 1026; const int ISM_REMOTE_TRANS_CMD_RECV_FOCUS_OUT = 1027; const int ISM_REMOTE_TRANS_CMD_RECV_ENTRY_METADATA = 1028; const int ISM_REMOTE_TRANS_CMD_RECV_SURROUNDING_TEXT = 1029; -const int ISM_REMOTE_TRANS_CMD_CHECK_PRIVILEGE = 1030; -const int ISM_REMOTE_TRANS_CMD_DELETE_SURROUNDING_TEXT = 1031; +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; /* IMControl to ISE */ const int ISM_TRANS_CMD_SET_ISE_MODE = 1108; -- 2.7.4