trans.put_command(SCIM_TRANS_CMD_REPLY);
trans.put_command(ret ? SCIM_TRANS_CMD_OK : SCIM_TRANS_CMD_FAIL);
trans.write_to_socket(client_socket);
+ } else if (cmd == ISM_TRANS_CMD_DELETE_REMOTE_SURROUNDING_TEXT) {
+ uint32 offset;
+ uint32 len;
+ 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;
+ } else {
+ LOGW ("wrong format of transaction\n");
+ }
+
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(ret ? SCIM_TRANS_CMD_OK : SCIM_TRANS_CMD_FAIL);
+ trans.write_to_socket(client_socket);
} else {
LOGW ("unknow cmd: %d\n", cmd);
}
return true;
}
+ bool delete_surrounding_text(int offset, int len) {
+ int cmd;
+
+ m_trans.put_command (ISM_TRANS_CMD_DELETE_REMOTE_SURROUNDING_TEXT);
+ m_trans.put_data (offset);
+ m_trans.put_data (len);
+ m_trans.write_to_socket (m_socket_remoteinput2panel);
+ if (!m_trans.read_from_socket (m_socket_remoteinput2panel, m_socket_timeout)) {
+ std::cerr << __func__ << " read_from_socket() may be timeout \n";
+ return false;
+ }
+
+ if (m_trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY &&
+ m_trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_OK) {
+ } else {
+ std::cerr << __func__ << " get_command() or get_data() may fail!!!\n";
+ return false;
+ }
+
+ return true;
+ }
+
remote_control_callback_type recv_callback_message(void) {
if (! m_socket_panel2remoteinput.is_connected () || ! m_trans_recv.read_from_socket(m_socket_panel2remoteinput, m_socket_timeout))
return REMOTE_CONTROL_CALLBACK_ERROR;
return m_impl->check_privilege ();
}
+bool
+RemoteInputClient::delete_surrounding_text (int offset, int len)
+{
+ return m_impl->delete_surrounding_text (offset, len);
+}
+
remote_control_callback_type
RemoteInputClient::recv_callback_message (void)
{
bool has_pending_event (void) const;
bool send_remote_input_message (const char* str);
bool check_privilege (void);
+ bool delete_surrounding_text(int offset, int len);
remote_control_callback_type recv_callback_message (void);
void get_entry_metadata (int *hint, int *layout, int *variation, int *autocapital_type);
void get_default_text (String &default_text, int *cursor);
static bool focus_flag, event_check_flag;
-enum remote_control_command_option{
- REMOTE_CONTROL_COMMAND_KEY = 0,
- REMOTE_CONTROL_COMMAND_COMMIT,
- REMOTE_CONTROL_COMMAND_PREEDIT,
-};
-
struct _remote_control_client {
RemoteInputClient remote_client;
Ecore_Fd_Handler *remote_fd_handler = NULL;
return REMOTE_CONTROL_ERROR_NONE;
}
return REMOTE_CONTROL_INVALID_OPERATION;
+}
+
+EXAPI int remote_control_delete_surrounding_text(remote_control_client *client, int offset, int len)
+{
+ if (client == NULL || len < 0)
+ 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;
+
+ if (!client->remote_client.prepare())
+ return REMOTE_CONTROL_REPLY_TIMEOUT;
+ if (focus_flag && client->remote_client.delete_surrounding_text(offset, len))
+ return REMOTE_CONTROL_ERROR_NONE;
+
+ return REMOTE_CONTROL_INVALID_OPERATION;
}
\ No newline at end of file
*/
EXAPI int remote_control_update_preedit_string(remote_control_client *client, const char *text, Eina_List *attrs, int cursor_pos);
+/**
+ * @brief Requests to delete surrounding text.
+ *
+ * @since_tizen @if TV 3.0 @endif
+ *
+ * @privlevel platform
+ *
+ * @privilege %http://tizen.org/privilege/imemanager
+ *
+ * @param[in] client The remote control client
+ * @param[in] offset The offset value from the cursor position
+ * @param[in] len The length of the text to delete
+ *
+ * @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_OPERATION Invalid operation
+ * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
+ * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Socket connection failed
+ */
+EXAPI int remote_control_delete_surrounding_text(remote_control_client *client, int offset, int len);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
const int ISM_TRANS_CMD_RECV_REMOTE_ENTRY_METADATA = 1028;
const int ISM_TRANS_CMD_RECV_REMOTE_DEFAULT_TEXT = 1029;
const int ISM_TRANS_CMD_CHECK_REMOTE_PRIVILEGE = 1030;
+const int ISM_TRANS_CMD_DELETE_REMOTE_SURROUNDING_TEXT = 1031;
/* IMControl to ISE */
const int ISM_TRANS_CMD_SET_ISE_MODE = 1108;