jihoon pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=21106fd5f0bb96229f5fc6ff6ccb10eb2d57db3d

commit 21106fd5f0bb96229f5fc6ff6ccb10eb2d57db3d
Author: Jihoon Kim <jihoon48....@samsung.com>
Date:   Wed May 20 18:47:58 2015 +0900

    ecore_imf/wayland: support feature to change layout of virtual keyboard
---
 src/modules/ecore_imf/wayland/wayland_imcontext.c | 46 +++++++++++++++++++++++
 src/modules/ecore_imf/wayland/wayland_imcontext.h |  3 ++
 src/modules/ecore_imf/wayland/wayland_module.c    |  2 +-
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.c 
b/src/modules/ecore_imf/wayland/wayland_imcontext.c
index d6679bd..adc5367 100644
--- a/src/modules/ecore_imf/wayland/wayland_imcontext.c
+++ b/src/modules/ecore_imf/wayland/wayland_imcontext.c
@@ -75,6 +75,7 @@ struct _WaylandIMContext
 
    uint32_t serial;
    uint32_t reset_serial;
+   uint32_t content_purpose;
 };
 
 static unsigned int
@@ -643,6 +644,10 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
         wl_text_input_show_input_panel(imcontext->text_input);
         wl_text_input_activate(imcontext->text_input, seat,
                                ecore_wl_window_surface_get(imcontext->window));
+
+        wl_text_input_set_content_type(imcontext->text_input,
+                                       WL_TEXT_INPUT_CONTENT_HINT_NONE,
+                                       imcontext->content_purpose);
      }
 }
 
@@ -813,6 +818,47 @@ wayland_im_context_cursor_location_set(Ecore_IMF_Context 
*ctx, int x, int y, int
      }
 }
 
+EAPI void
+wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx, 
Ecore_IMF_Input_Panel_Layout layout)
+{
+   WaylandIMContext *imcontext = (WaylandIMContext 
*)ecore_imf_context_data_get(ctx);
+
+   switch (layout) {
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_EMAIL;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_URL:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_URL;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PHONE;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_IP:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DATE;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS;
+        break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_TERMINAL;
+        break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD;
+        break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DATETIME;
+        break;
+      default:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL;
+        break;
+   }
+}
 
 WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager 
*text_input_manager)
 {
diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.h 
b/src/modules/ecore_imf/wayland/wayland_imcontext.h
index fb6906c..111dd5f 100644
--- a/src/modules/ecore_imf/wayland/wayland_imcontext.h
+++ b/src/modules/ecore_imf/wayland/wayland_imcontext.h
@@ -60,6 +60,9 @@ EAPI void 
wayland_im_context_cursor_location_set(Ecore_IMF_Context    *ctx,
                                                  int                   width,
                                                  int                   height);
 
+EAPI void wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx,
+                                                    
Ecore_IMF_Input_Panel_Layout layout);
+
 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 13d09f2..d189d6b 100644
--- a/src/modules/ecore_imf/wayland/wayland_module.c
+++ b/src/modules/ecore_imf/wayland/wayland_module.c
@@ -64,7 +64,7 @@ static Ecore_IMF_Context_Class wayland_imf_class =
    NULL,                                      /* autocapital_type_set */
    NULL,                                      /* control panel show */
    NULL,                                      /* control panel hide */
-   NULL,                                      /* input_panel_layout_set */
+   wayland_im_context_input_panel_layout_set, /* input_panel_layout_set */
    NULL,                                      /* input_panel_layout_get, */
    NULL,                                      /* input_panel_language_set, */
    NULL,                                      /* input_panel_language_get, */

-- 


Reply via email to