}
}
+ 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);
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)
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");
}
#endif
typedef enum {
- INPUT_RESOURCE_NONE,
INPUT_RESOURCE_LOCAL,
- INPUT_RESOURCE_REMOTE
+ INPUT_RESOURCE_REMOTE,
+ INPUT_RESOURCE_NONE
} Input_Resource;
struct weescim;
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;
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 (" "))
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)
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;
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
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) {
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;
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
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;
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;
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;
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);
}
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";
{
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
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)
{
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);
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
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 ());
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 */
/*
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
* @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);
};
/** @} */
_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);
_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 */
/*
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<String>& list);
void socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode);
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);
};
/** @} */
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 ()
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) {
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;
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;
}
surrounding_text = m_surrounding_text;
*cursor = m_cursor;
}
+
+ void get_input_resource (int *input_resource) {
+ *input_resource = m_input_resource;
+ }
};
RemoteInputClient::RemoteInputClient ()
{
m_impl->get_surrounding_text (surrounding_text, cursor);
}
+
+void
+RemoteInputClient::get_input_resource (int *input_resource)
+{
+ m_impl->get_input_resource (input_resource);
+}
};
/*
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
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);
};
}
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
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<remote_control_input_resource> (resource));
+ }
+ break;
}
case REMOTE_CONTROL_CALLBACK_ERROR:
break;
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)
} 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
* @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.
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
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;