jihoon pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7564d49a832ada9ca889539561760605f1d7db39

commit 7564d49a832ada9ca889539561760605f1d7db39
Author: Jihoon Kim <jihoon48....@samsung.com>
Date:   Thu Feb 4 11:56:13 2016 +0900

    ecore_imf/wayland: Add support to get input panel language locale
---
 src/modules/ecore_imf/wayland/wayland_imcontext.c | 27 +++++++++++++++++++++--
 src/modules/ecore_imf/wayland/wayland_imcontext.h |  4 ++++
 src/modules/ecore_imf/wayland/wayland_module.c    |  2 +-
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.c 
b/src/modules/ecore_imf/wayland/wayland_imcontext.c
index 1c92cca..dd36f0f 100644
--- a/src/modules/ecore_imf/wayland/wayland_imcontext.c
+++ b/src/modules/ecore_imf/wayland/wayland_imcontext.c
@@ -44,6 +44,7 @@ struct _WaylandIMContext
 
    char *preedit_text;
    char *preedit_commit;
+   char *language;
    Eina_List *preedit_attrs;
    int32_t preedit_cursor;
 
@@ -591,11 +592,17 @@ text_input_input_panel_state(void                 *data 
EINA_UNUSED,
 }
 
 static void
-text_input_language(void                 *data EINA_UNUSED,
+text_input_language(void                 *data,
                     struct wl_text_input *text_input EINA_UNUSED,
                     uint32_t              serial EINA_UNUSED,
-                    const char           *language EINA_UNUSED)
+                    const char           *language)
 {
+    WaylandIMContext *imcontext = (WaylandIMContext *)data;
+
+    if (imcontext->language)
+      free(imcontext->language);
+
+    imcontext->language = strdup(language ? language : "");
 }
 
 static void
@@ -646,6 +653,12 @@ wayland_im_context_del(Ecore_IMF_Context *ctx)
 
    EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "context_del");
 
+   if (imcontext->language)
+     {
+        free(imcontext->language);
+        imcontext->language = NULL;
+     }
+
    if (imcontext->text_input)
      wl_text_input_destroy(imcontext->text_input);
 
@@ -951,6 +964,16 @@ 
wayland_im_context_input_panel_language_set(Ecore_IMF_Context *ctx,
      imcontext->content_hint &= ~WL_TEXT_INPUT_CONTENT_HINT_LATIN;
 }
 
+EAPI void
+wayland_im_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx,
+                                                   char **locale)
+{
+   WaylandIMContext *imcontext = (WaylandIMContext 
*)ecore_imf_context_data_get(ctx);
+
+   if (locale)
+     *locale = strdup(imcontext->language ? imcontext->language : "");
+}
+
 WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager 
*text_input_manager)
 {
    WaylandIMContext *context = calloc(1, sizeof(WaylandIMContext));
diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.h 
b/src/modules/ecore_imf/wayland/wayland_imcontext.h
index a76203f..18925e5 100644
--- a/src/modules/ecore_imf/wayland/wayland_imcontext.h
+++ b/src/modules/ecore_imf/wayland/wayland_imcontext.h
@@ -79,6 +79,10 @@ EAPI void 
wayland_im_context_input_hint_set(Ecore_IMF_Context *ctx,
 EAPI void wayland_im_context_input_panel_language_set(Ecore_IMF_Context *ctx,
                                                       
Ecore_IMF_Input_Panel_Lang lang);
 
+EAPI void
+wayland_im_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx,
+                                                   char **locale);
+
 WaylandIMContext *wayland_im_context_new        (struct wl_text_input_manager 
*text_input_manager);
 
 extern int _ecore_imf_wayland_log_dom;
diff --git a/src/modules/ecore_imf/wayland/wayland_module.c 
b/src/modules/ecore_imf/wayland/wayland_module.c
index 3a24996..7fc2474 100644
--- a/src/modules/ecore_imf/wayland/wayland_module.c
+++ b/src/modules/ecore_imf/wayland/wayland_module.c
@@ -79,7 +79,7 @@ static Ecore_IMF_Context_Class wayland_imf_class =
    NULL,                                      /* input_panel_state_get */
    NULL,                                      /* 
input_panel_event_callback_add */
    NULL,                                      /* 
input_panel_event_callback_del */
-   NULL,                                      /* 
input_panel_language_locale_get */
+   wayland_im_context_input_panel_language_locale_get, /* 
input_panel_language_locale_get */
    NULL,                                      /* candidate_window_geometry_get 
*/
    wayland_im_context_input_hint_set,         /* input_hint_set */
    NULL                                       /* bidi_direction_set */

-- 


Reply via email to