Send additional message for triggering ISE's filter_event 81/106081/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 20 Dec 2016 08:35:38 +0000 (17:35 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 20 Dec 2016 10:11:47 +0000 (19:11 +0900)
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

ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp
ism/src/isf_message_queue.h
ism/src/scim_helper.cpp

index 5770d62..0efb75d 100644 (file)
@@ -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 {
index 679465f..254c535 100644 (file)
@@ -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) {
index afb6947..cd77f26 100644 (file)
@@ -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;
         }