From 389cc93d3eb509ef36abc90bb409be2efcddebd8 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 20 Dec 2016 17:35:38 +0900 Subject: [PATCH] Send additional message for triggering ISE's filter_event Since the filter_event() function would not be called for the messages that were retrieved while waiting for the get_surrounding_text or get_selection reply, temporarily added update_cursor_position message transmission to guarantee the filter_event() gets called afterward. Need to find a proper way to fix this problem. Change-Id: I38ea9c2e8954858e70a581bf92b3683f7b2424ec --- .../panelagent/wayland/wayland_panel_agent_module.cpp | 2 ++ ism/src/isf_message_queue.h | 13 +++++++++++++ ism/src/scim_helper.cpp | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index 5770d62..0efb75d 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -2824,6 +2824,7 @@ public: if (len == 0) { LOGD ("update, wsc_ctx->surrounding_cursor = %d\n", wsc_ctx->surrounding_cursor); g_info_manager->socket_update_surrounding_text (wsc_ctx->surrounding_text ? wsc_ctx->surrounding_text : "", wsc_ctx->surrounding_cursor); + g_info_manager->socket_update_cursor_position (wsc_ctx->surrounding_cursor); } else if (len < 0) { LOGW ("failed"); } else { @@ -2952,6 +2953,7 @@ public: if (len == 0) { LOGD ("update"); g_info_manager->socket_update_selection (wsc_ctx->selection_text ? wsc_ctx->selection_text : ""); + g_info_manager->socket_update_cursor_position (wsc_ctx->surrounding_cursor); } else if (len < 0) { LOGW ("failed"); } else { diff --git a/ism/src/isf_message_queue.h b/ism/src/isf_message_queue.h index 679465f..254c535 100644 --- a/ism/src/isf_message_queue.h +++ b/ism/src/isf_message_queue.h @@ -725,6 +725,7 @@ public: MessageItem* ret = NULL; if (!m_list_messages.empty()) { ret = m_list_messages.front(); + m_list_messages.pop_front(); } return ret; } @@ -736,11 +737,23 @@ public: !ret && iter != m_list_messages.end(); advance(iter, 1)) { if ((*iter)->get_command_ref() == cmd) { ret = (*iter); + m_list_messages.erase(iter); } } return ret; } + bool has_pending_message_by_cmd(int cmd) + { + for (MESSAGE_LIST::iterator iter = m_list_messages.begin(); + iter != m_list_messages.end(); advance(iter, 1)) { + if ((*iter)->get_command_ref() == cmd) { + return true; + } + } + return false; + } + void remove_message(MessageItem *message) { if (message) { diff --git a/ism/src/scim_helper.cpp b/ism/src/scim_helper.cpp index afb6947..cd77f26 100644 --- a/ism/src/scim_helper.cpp +++ b/ism/src/scim_helper.cpp @@ -841,7 +841,7 @@ HelperAgent::wait_for_message(int cmd, int timeout) return false; message_queue.read_from_transaction(m_impl->recv); - if (message_queue.get_pending_message_by_cmd(cmd)) { + if (message_queue.has_pending_message_by_cmd(cmd)) { return true; } -- 2.7.4