jihoon pushed a commit to branch master.

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

commit c5f0eea83d3259dd225ed09a805877853a4275e5
Author: Jihoon Kim <jihoon48....@samsung.com>
Date:   Wed May 27 14:39:37 2015 +0900

    ecore_imf/wayland: support autocapital mode in wayland text input
    
    @feature
---
 src/modules/ecore_imf/wayland/wayland_imcontext.c | 20 +++++++++++++++++++-
 src/modules/ecore_imf/wayland/wayland_imcontext.h |  3 +++
 src/modules/ecore_imf/wayland/wayland_module.c    |  2 +-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.c 
b/src/modules/ecore_imf/wayland/wayland_imcontext.c
index adc5367..3e13081 100644
--- a/src/modules/ecore_imf/wayland/wayland_imcontext.c
+++ b/src/modules/ecore_imf/wayland/wayland_imcontext.c
@@ -76,6 +76,7 @@ struct _WaylandIMContext
    uint32_t serial;
    uint32_t reset_serial;
    uint32_t content_purpose;
+   uint32_t content_hint;
 };
 
 static unsigned int
@@ -646,7 +647,7 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
                                ecore_wl_window_surface_get(imcontext->window));
 
         wl_text_input_set_content_type(imcontext->text_input,
-                                       WL_TEXT_INPUT_CONTENT_HINT_NONE,
+                                       imcontext->content_hint,
                                        imcontext->content_purpose);
      }
 }
@@ -818,6 +819,23 @@ wayland_im_context_cursor_location_set(Ecore_IMF_Context 
*ctx, int x, int y, int
      }
 }
 
+EAPI void wayland_im_context_autocapital_type_set(Ecore_IMF_Context *ctx,
+                                                  Ecore_IMF_Autocapital_Type 
autocapital_type)
+{
+   WaylandIMContext *imcontext = (WaylandIMContext 
*)ecore_imf_context_data_get(ctx);
+
+   imcontext->content_hint &= ~(WL_TEXT_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION 
|
+                                WL_TEXT_INPUT_CONTENT_HINT_UPPERCASE |
+                                WL_TEXT_INPUT_CONTENT_HINT_LOWERCASE);
+
+   if (autocapital_type == ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE)
+     imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION;
+   else if (autocapital_type == ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER)
+     imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_UPPERCASE;
+   else
+     imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_LOWERCASE;
+}
+
 EAPI void
 wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx, 
Ecore_IMF_Input_Panel_Layout layout)
 {
diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.h 
b/src/modules/ecore_imf/wayland/wayland_imcontext.h
index 111dd5f..9ec9f30 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_autocapital_type_set(Ecore_IMF_Context *ctx,
+                                                  Ecore_IMF_Autocapital_Type 
autocapital_type);
+
 EAPI void wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx,
                                                     
Ecore_IMF_Input_Panel_Layout layout);
 
diff --git a/src/modules/ecore_imf/wayland/wayland_module.c 
b/src/modules/ecore_imf/wayland/wayland_module.c
index d189d6b..3e83f74 100644
--- a/src/modules/ecore_imf/wayland/wayland_module.c
+++ b/src/modules/ecore_imf/wayland/wayland_module.c
@@ -61,7 +61,7 @@ static Ecore_IMF_Context_Class wayland_imf_class =
    wayland_im_context_filter_event,           /* filter_event */
    wayland_im_context_preedit_string_with_attributes_get, /* 
preedit_string_with_attribute_get */
    NULL,                                      /* prediction_allow_set */
-   NULL,                                      /* autocapital_type_set */
+   wayland_im_context_autocapital_type_set,   /* autocapital_type_set */
    NULL,                                      /* control panel show */
    NULL,                                      /* control panel hide */
    wayland_im_context_input_panel_layout_set, /* input_panel_layout_set */

-- 


Reply via email to