For avoiding block, process_key_event will not wait for result value.
Change-Id: Ice3f418eb2b162741fd6ee0430d44ce22d97d929
m_send_trans.write_to_socket(client_socket);
}
- bool process_key_event(int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result) {
+ bool process_key_event(int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial) {
LOGD ("client id:%d\n", client);
Socket client_socket(client);
trans.put_data(uuid);
trans.put_command(SCIM_TRANS_CMD_PROCESS_KEY_EVENT);
trans.put_data(key);
- int cmd;
+ trans.put_data(serial);
- if (trans.write_to_socket(client_socket)
- && trans.read_from_socket(client_socket)
- && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
- && trans.get_data(result)) {
+ if (trans.write_to_socket(client_socket)) {
SCIM_DEBUG_MAIN(1) << __func__ << " success\n";
return true;
} else {
//FIXME: useless
//} else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_EXIT) {
// m_info_manager->UPDATE_ISE_EXIT(client_id);
+ } else if (cmd == ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE) {
+ KeyEvent key;
+ uint32 ret;
+ uint32 serial;
+
+ if (m_recv_trans.get_data(key) && m_recv_trans.get_data(ret) && m_recv_trans.get_data(serial)) {
+ m_info_manager->process_key_event_done(key, ret, serial);
+ } else {
+ LOGW ("wrong format of transaction\n");
+ }
} else {
LOGW ("unknow cmd: %d\n", cmd);
}
if (!wsc_ctx) return;
- Eina_Bool ret = EINA_FALSE;
KeyEvent key(symcode, wsc_ctx->modifiers);
bool ignore_key = filter_keys (keyname, SCIM_CONFIG_HOTKEYS_FRONTEND_IGNORE_KEY);
}
if (!ignore_key) {
- ret = EINA_TRUE;
if (!_focused_ic || !_focused_ic->impl || !_focused_ic->impl->is_on) {
LOGD ("ic is off");
- ret = EINA_FALSE;
} else {
- uint32 _ret;
- g_info_manager->process_key_event (key, _ret);
- ret = (Eina_Bool)_ret;
- }
-
- if (ret == EINA_FALSE) {
- if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
- if (key.code == SCIM_KEY_space ||
- key.code == SCIM_KEY_KP_Space)
- autoperiod_insert (wsc_ctx);
- }
+ static uint32 _serial = 0;
+ g_info_manager->process_key_event (key, ++_serial);
}
- }
-
- if (ret == EINA_FALSE) {
+ } else {
send_wl_key_event (wsc_ctx, key, false);
}
}
wl_input_method_context_get_selection_text (ic->im_ctx, fd);
}
}
+
+ void process_key_event_done(int id, uint32 context_id, KeyEvent &key, uint32 ret, uint32 serial) {
+ LOGD ("client id:%d", id);
+ WSCContextISF* ic = find_ic (context_id);
+ if (ret == EINA_FALSE) {
+ if (key.is_key_press()) {
+ if (key.code == SCIM_KEY_space ||
+ key.code == SCIM_KEY_KP_Space)
+ autoperiod_insert (ic);
+ }
+ }
+
+ if (ret == EINA_FALSE) {
+ send_wl_key_event (ic, key, false);
+ }
+ }
};
static scim::PanelAgentPointer instance;
m_should_shared_ise = should_shared_ise;
}
//SCIM_TRANS_CMD_PROCESS_KEY_EVENT
- bool process_key_event (KeyEvent& key, _OUT_ uint32& result) {
+ bool process_key_event (KeyEvent& key, uint32 serial) {
LOGD ("");
HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
uint32 ctx;
get_focused_context (client, context);
ctx = get_helper_ic (client, context);
- return m_panel_agent_manager.process_key_event (it->second.id, ctx, m_current_helper_uuid, key, result);
+ return m_panel_agent_manager.process_key_event (it->second.id, ctx, m_current_helper_uuid, key, serial);
}
return false;
// del_client (client);
//}
+ void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial) {
+ LOGD ("");
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.process_key_event_done (focused_client, focused_context, key, ret, serial);
+ }
+ }
+
void socket_reset_helper_input_context (const String& uuid, int client, uint32 context) {
HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
}
//SCIM_TRANS_CMD_PROCESS_KEY_EVENT
-bool InfoManager::process_key_event (KeyEvent& key, _OUT_ uint32& result)
+bool InfoManager::process_key_event (KeyEvent& key, uint32 serial)
{
- return m_impl->process_key_event (key, result);
+ return m_impl->process_key_event (key, serial);
}
//ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY
// m_impl->UPDATE_ISE_EXIT (client);
//}
+//ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE
+void InfoManager::process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial)
+{
+ m_impl->process_key_event_done (key, ret, serial);
+}
+
+
bool InfoManager::check_privilege_by_sockfd (int client_id, const String& privilege) {
return m_impl->check_privilege_by_sockfd (client_id, privilege);
}
void hide_helper_ise (void);
//SCIM_TRANS_CMD_PROCESS_KEY_EVENT
- bool process_key_event (KeyEvent& key, _OUT_ uint32& result);
+ bool process_key_event (KeyEvent& key, uint32 serial);
//ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY
void get_input_panel_geometry (int client_id, _OUT_ struct rectinfo& info);
//ISM_TRANS_CMD_UPDATE_ISE_EXIT
//void UPDATE_ISE_EXIT (int client);
+
+ //ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE
+ void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial);
+
bool check_privilege_by_sockfd (int client_id, const String& privilege);
void add_client (int client_id, uint32 key, ClientType type);
LOGW ("not implemented for %s", m_name.c_str ());
}
-bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result)
+bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial)
{
LOGW ("not implemented for %s", m_name.c_str ());
return false;
return false;
}
+void PanelAgentBase::process_key_event_done(int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial)
+{
+ LOGW("not implemented for %s", m_name.c_str());
+}
+
+
} /* namespace scim */
/*
*
* @return none.
*/
- virtual bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result);
+ virtual bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial);
/**
* @brief get_helper_geometry.
* @return none.
*/
virtual bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
+
+ /**
+ * @brief process_key_event_done.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void process_key_event_done(int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial);
};
/** @} */
_p->show_helper_option_window (id, context_id, uuid);
}
-bool PanelAgentManager::process_key_event (int id, uint32 context_id, const String& uuid, KeyEvent& key, _OUT_ uint32& result)
+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);
if (!_p.null ())
- return _p->process_key_event (id, context_id, uuid, key, result);
+ return _p->process_key_event (id, context_id, uuid, key, serial);
return false;
}
_p->hide_helper_ise (id, context);
}
+void PanelAgentManager::process_key_event_done(int id, uint32 context_id, KeyEvent &key, uint32 ret, uint32 serial)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->process_key_event_done (id, context_id, key, ret, serial);
+}
+
+
} /* namespace scim */
void set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction);
void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
void show_helper_option_window (int client, uint32 context, const String& uuid);
- bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result);
+ bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial);
bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
void get_helper_layout (int client, uint32 context, String& uuid, uint32& layout);
void helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen);
void hide_helper_ise (int id, uint32 context);
bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
+ void process_key_event_done(int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial);
};
/** @} */
si->signal_connect_send_private_command (
slot (this, &HelperAgent::HelperAgentImpl::slot_send_private_command));
}
+public:
+ void process_key_event_done(KeyEvent &key, uint32 ret, uint32 serial) {
+ if (socket_active.is_connected ()) {
+ send.clear ();
+ send.put_command (SCIM_TRANS_CMD_REQUEST);
+ send.put_data (magic_active);
+ send.put_command (ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE);
+ send.put_data (key);
+ send.put_data (ret);
+ send.put_data (serial);
+ send.write_to_socket (socket_active, magic_active);
+ }
+ }
private:
HelperAgentImpl () : magic (0), magic_active (0), timeout (-1), focused_ic ((uint32) -1) { }
};
{
KeyEvent key;
uint32 ret = 0;
- if (m_impl->recv.get_data (key))
+ uint32 serial = 0;
+ if (m_impl->recv.get_data (key) && m_impl->recv.get_data (serial))
m_impl->signal_process_key_event(this, key, ret);
else
LOGW ("wrong format of transaction\n");
ret = m_impl->si->process_key_event (key);
LOGD("imengine(%s) process key %d return %d", m_impl->si->get_factory_uuid().c_str(), key.code, ret);
}
- m_impl->send.clear ();
- m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
- m_impl->send.put_data (ret);
- m_impl->send.write_to_socket (m_impl->socket);
+
+ m_impl->process_key_event_done (key, ret, serial);
break;
}
case ISM_TRANS_CMD_SET_LAYOUT:
const int ISM_TRANS_CMD_CONTRACT_CANDIDATE = 1215;
const int ISM_TRANS_CMD_UPDATE_ISE_EXIT = 1216;
const int ISM_TRANS_CMD_SELECT_CANDIDATE = 1217;
+const int ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE = 1218;
+
/* Panel to ISE */
const int ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW = 1251;