From: Jihoon Kim <jihoon48.kim@samsung.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 27 Feb 2011 11:20:35 +0000 (11:20 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 27 Feb 2011 11:20:35 +0000 (11:20 +0000)
Subject: [E-devel] [PATCH] Add
ecore_imf_context_preedit_string_with_attributes_get API

This is patch for adding
ecore_imf_context_preedit_string_with_attributes_get API.
In ecore_imf, there is ecore_imf_context_preedit_string_get API, but the
attribute info from input method engine cannot be got from it.

After discussing rater, we decided to add new API.
Attribute infomation can be got as Eina_List type containing
Ecore_IMF_Preedit_Attr structure items.

In this patch, ECORE_IMF_PREEDIT_TYPE_SUB1,2,3 means the depth of
preedit
style.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@57372 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

AUTHORS
ChangeLog
src/lib/ecore_imf/Ecore_IMF.h
src/lib/ecore_imf/ecore_imf_context.c

diff --git a/AUTHORS b/AUTHORS
index cef6952..c8f7095 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -37,3 +37,4 @@ Mike Blumenkrantz <mike@zentific.com>
 Leif Middelschulte <leif.middelschulte@gmail.com>
 Mike McCormack <mj.mccormack@samsung.com>
 Sangho Park <gouache95@gmail.com>
+Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
index b84e709..bf0d343 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,3 +68,7 @@
 
        * Ecore_File: fix compilation when ecore_con and curl are not
        available
+
+2011-02-27 Jihoon Kim
+
+        * Add ecore_imf_context_preedit_string_with_attributes_get API.
index e67e5af..e015bde 100644 (file)
@@ -55,6 +55,9 @@ typedef struct _Ecore_IMF_Context                  Ecore_IMF_Context;
 typedef struct _Ecore_IMF_Context_Class            Ecore_IMF_Context_Class;            /**< An Input Method Context class */
 typedef struct _Ecore_IMF_Context_Info             Ecore_IMF_Context_Info;             /**< An Input Method Context info */
 
+/* Preedit attribute info */
+typedef struct _Ecore_IMF_Preedit_Attr             Ecore_IMF_Preedit_Attr;
+
 EAPI extern int ECORE_IMF_EVENT_PREEDIT_START;
 EAPI extern int ECORE_IMF_EVENT_PREEDIT_END;
 EAPI extern int ECORE_IMF_EVENT_PREEDIT_CHANGED;
@@ -109,6 +112,14 @@ typedef enum
    ECORE_IMF_INPUT_MODE_AUTOCAP      = 1 << 30
 } Ecore_IMF_Input_Mode;
 
+typedef enum
+{
+   ECORE_IMF_PREEDIT_TYPE_NONE,
+   ECORE_IMF_PREEDIT_TYPE_SUB1,
+   ECORE_IMF_PREEDIT_TYPE_SUB2,
+   ECORE_IMF_PREEDIT_TYPE_SUB3
+} Ecore_IMF_Preedit_Type;
+
 struct _Ecore_IMF_Event_Preedit_Start
 {
    Ecore_IMF_Context *ctx;
@@ -260,6 +271,13 @@ union _Ecore_IMF_Event
    Ecore_IMF_Event_Key_Up      key_up;
 };
 
+struct _Ecore_IMF_Preedit_Attr
+{
+   Ecore_IMF_Preedit_Type preedit_type;
+   unsigned int start_index;
+   unsigned int end_index;
+};
+
 struct _Ecore_IMF_Context_Class
 {
    void (*add)                 (Ecore_IMF_Context *ctx);
@@ -276,6 +294,7 @@ struct _Ecore_IMF_Context_Class
    void (*use_preedit_set)     (Ecore_IMF_Context *ctx, Eina_Bool use_preedit);
    void (*input_mode_set)      (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
    Eina_Bool (*filter_event)   (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
+   void (*preedit_string_with_attributes_get) (Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos);
 };
 
 struct _Ecore_IMF_Context_Info
@@ -308,6 +327,7 @@ EAPI void                         *ecore_imf_context_client_canvas_get(Ecore_IMF
 EAPI void                          ecore_imf_context_show(Ecore_IMF_Context *ctx);
 EAPI void                          ecore_imf_context_hide(Ecore_IMF_Context *ctx);
 EAPI void                          ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
+EAPI void                          ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos);
 EAPI void                          ecore_imf_context_focus_in(Ecore_IMF_Context *ctx);
 EAPI void                          ecore_imf_context_focus_out(Ecore_IMF_Context *ctx);
 EAPI void                          ecore_imf_context_reset(Ecore_IMF_Context *ctx);
index 45590ad..d99136a 100644 (file)
@@ -381,6 +381,38 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu
 }
 
 /**
+ * Retrieve the current preedit string, atrributes and
+ * cursor position for the Input Method Context.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @param str Location to store the retrieved string. The
+ *            string retrieved must be freed with free().
+ * @param attrs an Eina_List of attributes
+ * @param cursor_pos Location to store position of cursor (in characters)
+ *                   within the preedit string.
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.1.0
+ */
+EAPI void
+ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos)
+{
+   if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+     {
+        ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+                         "ecore_imf_context_preedit_string_with_attributes_get");
+        return;
+     }
+   if (ctx->klass->preedit_string_with_attributes_get)
+     ctx->klass->preedit_string_with_attributes_get(ctx, str, attrs, cursor_pos);
+   else
+     {
+        if (str) *str = strdup("");
+        if (attrs) *attrs = NULL;
+        if (cursor_pos) *cursor_pos = 0;
+     }
+}
+
+/**
  * Notify the Input Method Context that the widget to which its
  * correspond has gained focus.
  *