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);
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);
return -1;
imcontrol_client.prepare ();
- if (!imcontrol_client.launch_helper_ise ()) {
+ if (!imcontrol_client.prelaunch_helper_ise ()) {
LOGW ("launch_helper_ise failed");
ret = -1;
}
}
}
- 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";
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)
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);
};
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";
#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) {
//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);
}
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 ("");
}
//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
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 ()
{
//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);
//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 ();
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 <typename T>
inline T*
alloc_message() /* We could use memory pool in the future for performance enhancement */
}
break;
}
+ case ISM_TRANS_CMD_SET_OPTIMIZATION_HINT:
+ {
+ MessageItemSetOptimizationHint *message = alloc_message<MessageItemSetOptimizationHint>();
+ 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<MessageItemSetOptimizationHint>(message);
+ }
+ }
+ break;
+ }
}
}
{
}
+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;
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
_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);
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);
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),
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<MessageItemSetOptimizationHint*>(message);
+ m_impl->signal_set_optimization_hint(this, subclass->get_hint_ref());
+ break;
+ }
default:
break;
}
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 */
/*
* 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);
};
/** @} */
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;
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;
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"