From 6fa2405fd2e3998645f23f198fadaee9c9663088 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 26 Aug 2016 20:57:25 +0900 Subject: [PATCH] Use MessageQueue for get_selection_text as well Change-Id: Iae7836f950960ce2bf54ba89791119ef3bfcf059 --- ism/src/scim_helper.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ism/src/scim_helper.cpp b/ism/src/scim_helper.cpp index 353177c..e92d188 100644 --- a/ism/src/scim_helper.cpp +++ b/ism/src/scim_helper.cpp @@ -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) { -- 2.7.4