From: Jihoon Kim <jihoon48.kim@samsung.com>

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.



SVN revision: 57372
This commit is contained in:
Jihoon Kim 2011-02-27 11:20:35 +00:00 committed by Carsten Haitzler
parent be83c603b2
commit 1832a6a84b
4 changed files with 57 additions and 0 deletions

View File

@ -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>

View File

@ -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.

View 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);

View File

@ -380,6 +380,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.