Update language locale on LANGUAGE_EVENT only 45/195245/3
authorInhong Han <inhong1.han@samsung.com>
Wed, 12 Dec 2018 02:12:28 +0000 (11:12 +0900)
committerInhong Han <inhong1.han@samsung.com>
Wed, 12 Dec 2018 02:39:55 +0000 (11:39 +0900)
The previous changeID I4a078d5bcce5ea231007c06ab52416606093701c
introduces a code segment that updates language locale
whenever the HelperAgent::update_input_context() gets called.
This is inefficient, thus added if() statement for checking
if the event type is actually LANGUAGE_EVENT

Change-Id: I2ead55babe56d0bc04151ccc422095e6fcc568a2

ism/src/scim_helper.cpp

index 2196e96..673ea9c 100644 (file)
@@ -49,6 +49,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/time.h>
+#include <Ecore_IMF.h>
 
 #include "scim_private.h"
 #include "scim.h"
@@ -2026,21 +2027,23 @@ HelperAgent::update_associate_string (const LookupTable &table) const
 void
 HelperAgent::update_input_context (uint32 type, uint32 value) const
 {
-    /* Update all state variables that could be queried by the client application */
-    char *buf = NULL;
-    m_impl->signal_get_language_locale(this, -1, &buf);
-
-    if (buf != NULL) {
-        if (m_impl->socket_active.is_connected()) {
-            m_impl->send.clear();
-            m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
-            m_impl->send.put_data(m_impl->magic_active);
-            m_impl->send.put_command(ISM_TRANS_CMD_UPDATE_ISE_LANGUAGE_LOCALE);
-            m_impl->send.put_data(buf, strlen(buf));
-            m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
-        }
-        free(buf);
-        buf = NULL;
+    if (type == ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT) {
+        /* Update all state variables that could be queried by the client application */
+        char *buf = NULL;
+        m_impl->signal_get_language_locale(this, -1, &buf);
+
+        if (buf != NULL) {
+            if (m_impl->socket_active.is_connected()) {
+                m_impl->send.clear();
+                m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
+                m_impl->send.put_data(m_impl->magic_active);
+                m_impl->send.put_command(ISM_TRANS_CMD_UPDATE_ISE_LANGUAGE_LOCALE);
+                m_impl->send.put_data(buf, strlen(buf));
+                m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
+            }
+            free(buf);
+            buf = NULL;
+        }
     }
 
     if (m_impl->socket_active.is_connected ()) {