Use MessageQueue for get_selection_text as well 63/85763/3
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 26 Aug 2016 11:57:25 +0000 (20:57 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 30 Aug 2016 02:06:58 +0000 (19:06 -0700)
Change-Id: Iae7836f950960ce2bf54ba89791119ef3bfcf059

ism/src/scim_helper.cpp

index 353177c..e92d188 100644 (file)
@@ -2106,15 +2106,15 @@ HelperAgent::get_selection_text (String &text)
         m_impl->selection_text = NULL;
     }
 
-    for (int i = 0; i < 3; i++) {
-        filter_event ();
-        if (!m_impl->socket.is_connected ())
-            break;
+    const int WAIT_FOR_SYNC_RESPONSE_TIMEOUT = 1000;
+    /* Now we are waiting for the ISM_TRANS_CMD_UPDATE_SELECTION message */
+    if (wait_for_message(ISM_TRANS_CMD_UPDATE_SELECTION, WAIT_FOR_SYNC_RESPONSE_TIMEOUT)) {
+        MessageItem *message = message_queue.get_pending_message_by_cmd(ISM_TRANS_CMD_UPDATE_SELECTION);
+        handle_message(message);
+        message_queue.remove_message(message);
         if (m_impl->selection_text) {
             text = m_impl->selection_text;
-            break;
         }
-        //timeout
     }
 
     if (m_impl->selection_text) {