context = ((helper_ic >> 16) & 0x7FFF);
}
+static bool
+clients_equal (int first, int second)
+{
+ return ((first & 0xFFFF) == (second & 0xFFFF));
+}
+
+static bool
+contexts_equal (uint32 first, uint32 second)
+{
+ return ((first & 0x7FFF) == (second & 0x7FFF));
+}
+
//==================================== InfoManager ===========================
class InfoManager::InfoManagerImpl
{
SCIM_DEBUG_MAIN (5) << "Target UUID = " << target_uuid << " Focused UUId = " << focused_uuid << "\nTarget Client = " << target_client << "\n";
if (client_info.type == FRONTEND_CLIENT) {
+ /* If the original context value is greater than 0x7FFF, the line below would not work properly
+ since the target_context acquired by get_imengnie_client_context() is always smaller than 0x7FFF.
+ But since the send_imengine_event() of scim_helper module will call IMEngine's
+ process_helper_event() function directly, instead of sending SEND_IMENGINE_EVENT message.
+ So we are not going to handle this kind of exceptional case for now. */
m_panel_agent_manager.process_helper_event (target_client, target_context, target_uuid, hiit->second.uuid, nest_trans);
}
}
if (target_client == -1) {
/* FIXUP: monitor 'Invalid Window' error */
LOGW ("focused target client is NULL");
- } else if (target_client == focused_client && target_context == focused_context && target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
+ } else if (target_uuid == focused_uuid &&
+ clients_equal (target_client, focused_client) &&
+ contexts_equal (target_context, focused_context)) {
+ ClientInfo client_info = socket_get_client_info (focused_client);
if (client_info.type == FRONTEND_CLIENT) {
- m_panel_agent_manager.socket_helper_key_event (target_client, target_context, cmd, key);
+ m_panel_agent_manager.socket_helper_key_event (focused_client, focused_context, cmd, key);
}
+ } else {
+ LOGD ("[target_client : %d, focused_client : %d] => %d, [target_context : %u, focused_context : %u] => %d",
+ target_client, focused_client, clients_equal (target_client, focused_client),
+ target_context, focused_context, contexts_equal (target_context, focused_context));
}
}
}
if (target_uuid.length () == 0)
target_uuid = focused_uuid;
- if (target_client == focused_client &&
- target_context == focused_context &&
- target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
+ if (target_uuid == focused_uuid &&
+ clients_equal (target_client, focused_client) &&
+ contexts_equal (target_context, focused_context)) {
+ ClientInfo client_info = socket_get_client_info (focused_client);
if (client_info.type == FRONTEND_CLIENT) {
- m_panel_agent_manager.commit_string (target_client, target_context, wstr);
+ m_panel_agent_manager.commit_string (focused_client, focused_context, wstr);
} else {
std::cerr << "target client is not existed!!!" << "\n";
}
if (target_uuid.length () == 0)
target_uuid = focused_uuid;
- if (target_client == focused_client &&
- target_context == focused_context &&
- target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
+ if (target_uuid == focused_uuid &&
+ clients_equal (target_client, focused_client) &&
+ contexts_equal (target_context, focused_context)) {
+ ClientInfo client_info = socket_get_client_info (focused_client);
if (client_info.type == FRONTEND_CLIENT) {
- m_panel_agent_manager.show_preedit_string (target_client, target_context);
+ m_panel_agent_manager.show_preedit_string (focused_client, focused_context);
}
}
}
if (target_uuid.length () == 0)
target_uuid = focused_uuid;
- if (target_client == focused_client &&
- target_context == focused_context &&
- target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
+ if (target_uuid == focused_uuid &&
+ clients_equal (target_client, focused_client) &&
+ contexts_equal (target_context, focused_context)) {
+ ClientInfo client_info = socket_get_client_info (focused_client);
if (client_info.type == FRONTEND_CLIENT) {
- m_panel_agent_manager.hide_preedit_string (target_client, target_context);
+ m_panel_agent_manager.hide_preedit_string (focused_client, focused_context);
}
}
}
if (target_uuid.length () == 0)
target_uuid = focused_uuid;
- if (target_client == focused_client &&
- target_context == focused_context &&
- target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
+ if (target_uuid == focused_uuid &&
+ clients_equal (target_client, focused_client) &&
+ contexts_equal (target_context, focused_context)) {
+ ClientInfo client_info = socket_get_client_info (focused_client);
if (client_info.type == FRONTEND_CLIENT) {
- m_panel_agent_manager.update_preedit_string (target_client, target_context, preedit, commit, attrs, caret);
+ m_panel_agent_manager.update_preedit_string (focused_client, focused_context, preedit, commit, attrs, caret);
}
}
}