ecore_imf/wayland: notify language changed
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 4 Feb 2016 02:58:03 +0000 (11:58 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 4 Feb 2016 02:58:03 +0000 (11:58 +0900)
src/modules/ecore_imf/wayland/wayland_imcontext.c

index dd36f0f..d58606e 100644 (file)
@@ -598,11 +598,24 @@ text_input_language(void                 *data,
                     const char           *language)
 {
     WaylandIMContext *imcontext = (WaylandIMContext *)data;
+    Eina_Bool changed = EINA_FALSE;
+
+    if (!imcontext || !language) return;
 
     if (imcontext->language)
-      free(imcontext->language);
+      {
+         free(imcontext->language);
+
+         if (strcmp(imcontext->language, language) != 0)
+           changed = EINA_TRUE;
+      }
+    else
+      changed = EINA_TRUE;
+
+    imcontext->language = strdup(language);
 
-    imcontext->language = strdup(language ? language : "");
+    if (imcontext->ctx && changed)
+      ecore_imf_context_input_panel_event_callback_call(imcontext->ctx, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, 0);
 }
 
 static void