Hello, 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. Would you please review it?
Index: AUTHORS =================================================================== --- AUTHORS (revision 57251) +++ AUTHORS (working copy) @@ -37,3 +37,4 @@ Mike Blumenkrantz <m...@zentific.com> Leif Middelschulte <leif.middelschu...@gmail.com> Mike McCormack <mj.mccorm...@samsung.com> Sangho Park <gouach...@gmail.com> +Jihoon Kim <jihoon48....@samsung.com> <imfin...@gmail.com> Index: src/lib/ecore_imf/ecore_imf_context.c =================================================================== --- src/lib/ecore_imf/ecore_imf_context.c (revision 57251) +++ src/lib/ecore_imf/ecore_imf_context.c (working copy) @@ -381,6 +381,38 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Con } /** + * 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. * Index: src/lib/ecore_imf/Ecore_IMF.h =================================================================== --- src/lib/ecore_imf/Ecore_IMF.h (revision 57251) +++ src/lib/ecore_imf/Ecore_IMF.h (working copy) @@ -55,6 +55,9 @@ typedef struct _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_conte 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: ChangeLog =================================================================== --- ChangeLog (revision 57251) +++ ChangeLog (working copy) @@ -64,3 +64,6 @@ on fork. Have it detecti this on next monitor add and re-init the inotify fd and fd handler. +2011-02-23 Jihoon Kim + + * Add ecore_imf_context_preedit_string_with_attributes_get API.
------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel