From 1d5c7fd1ecc0d4d3a7c31945467a89b7a267f0f9 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Tue, 3 Jul 2012 07:39:08 +0000 Subject: [PATCH] Ecore_Imf: Merge Tizen changes to upstream EFL. SVN revision: 73204 --- legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h | 41 +++++ .../src/lib/ecore_imf/ecore_imf_context.c | 156 ++++++++++++++++++ 2 files changed, 197 insertions(+) diff --git a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h index d9cff62fcd..2f233ef708 100644 --- a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h +++ b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h @@ -38,6 +38,35 @@ extern "C" { * * @{ */ +/* ecore_imf_context_input_panel_event_callback_add() flag */ +typedef enum +{ + ECORE_IMF_INPUT_PANEL_STATE_EVENT, /**< called when the state of the input panel is changed. */ + ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, /**< called when the language of the input panel is changed. */ + ECORE_IMF_INPUT_PANEL_SHIFT_MODE_EVENT, /**< called when the shift key state of the input panel is changed */ + ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, /**< called when the size of the input panel is changed. */ + ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, /**< called when the state of the candidate word panel is changed. */ + ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT /**< called when the size of the candidate word panel is changed. */ +} Ecore_IMF_Input_Panel_Event; + +typedef enum +{ + ECORE_IMF_INPUT_PANEL_STATE_SHOW, /**< Notification after the display of the input panel */ + ECORE_IMF_INPUT_PANEL_STATE_HIDE, /**< Notification prior to the dismissal of the input panel */ + ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW /**< Notification prior to the display of the input panel */ +} Ecore_IMF_Input_Panel_State; + +typedef enum +{ + ECORE_IMF_INPUT_PANEL_SHIFT_MODE_OFF, + ECORE_IMF_INPUT_PANEL_SHIFT_MODE_ON +} Ecore_IMF_Input_Panel_Shift_Mode; + +typedef enum +{ + ECORE_IMF_CANDIDATE_PANEL_SHOW, /**< Notification after the display of the candidate word panel */ + ECORE_IMF_CANDIDATE_PANEL_HIDE /**< Notification prior to the dismissal of the candidate word panel */ +} Ecore_IMF_Candidate_Panel_State; /* Events sent by the Input Method */ typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start; @@ -428,6 +457,12 @@ struct _Ecore_IMF_Context_Class void (*input_panel_return_key_type_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type); void (*input_panel_return_key_disabled_set) (Ecore_IMF_Context *ctx, Eina_Bool disabled); void (*input_panel_caps_lock_mode_set) (Ecore_IMF_Context *ctx, Eina_Bool mode); + void (*input_panel_geometry_get)(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h); + Ecore_IMF_Input_Panel_State (*input_panel_state_get) (Ecore_IMF_Context *ctx); + void (*input_panel_event_callback_add) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value), void *data); + void (*input_panel_event_callback_del) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value)); + void (*input_panel_language_locale_get) (Ecore_IMF_Context *ctx, char **lang); + void (*candidate_panel_geometry_get)(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h); }; struct _Ecore_IMF_Context_Info @@ -513,6 +548,12 @@ EAPI void ecore_imf_context_input_panel_return_key_disa EAPI Eina_Bool ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode); EAPI Eina_Bool ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h); +EAPI Ecore_IMF_Input_Panel_State ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value), const void *data); +EAPI void ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value)); +EAPI void ecore_imf_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx, char **lang); +EAPI void ecore_imf_context_candidate_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h); /* The following entry points must be exported by each input method module */ diff --git a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c index 5f4e5dc0c6..dbac20135a 100644 --- a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c +++ b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c @@ -1736,3 +1736,159 @@ ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx) return ctx->input_panel_caps_lock_mode; } +/** + * Get the position of the current active input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param x top-left x co-ordinate of the input panel + * @param y top-left y co-ordinate of the input panel + * @param w width of the input panel + * @param h height of the input panel + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_geometry_get"); + return; + } + + if (ctx->klass->input_panel_geometry_get) + ctx->klass->input_panel_geometry_get(ctx, x, y, w, h); +} + +/** + * Get state of current active input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param The state of input panel. + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI Ecore_IMF_Input_Panel_State +ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx) +{ + Ecore_IMF_Input_Panel_State state = ECORE_IMF_INPUT_PANEL_STATE_HIDE; + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_state_get"); + return ECORE_IMF_INPUT_PANEL_STATE_HIDE; + } + + if (ctx->klass->input_panel_state_get) + state = ctx->klass->input_panel_state_get(ctx); + + return state; +} + +/** + * Register a callback function which will be called if there is change in input panel state,language,mode etc. + * In order to deregister the callback function + * Use @ref ecore_imf_context_input_panel_event_callback_del. + * + * @param ctx An #Ecore_IMF_Context + * @param type event type + * @param func the callback function + * @param data application-input panel specific data. + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx, + Ecore_IMF_Input_Panel_Event type, + void (*func) (void *data, Ecore_IMF_Context *ctx, int value), + const void *data) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_event_callback_add"); + return; + } + + if (ctx->klass->input_panel_event_callback_add) + ctx->klass->input_panel_event_callback_add(ctx, type, func, (void *)data); +} + +/** + * Unregister a callback function which will be called if there is change in input panel state, language, mode etc. + * + * @param ctx An #Ecore_IMF_Context. + * @param func the callback function + * @param data application-input panel specific data. + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx, + Ecore_IMF_Input_Panel_Event type, + void (*func) (void *data, Ecore_IMF_Context *ctx, int value)) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_event_callback_del"); + return; + } + + if (ctx->klass->input_panel_event_callback_del) + ctx->klass->input_panel_event_callback_del(ctx, type, func); +} + +/** + * Get the current language locale of the input panel. + * + * ex) fr_FR + * + * @param ctx An #Ecore_IMF_Context. + * @param lang Location to store the retrieved language string. The + * string retrieved must be freed with free(). + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx, char **lang) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_language_locale_get"); + return; + } + + if (ctx->klass->input_panel_language_locale_get) + ctx->klass->input_panel_language_locale_get(ctx, lang); + else + { + if (lang) *lang = strdup(""); + } +} + +/** + * Get the geometry information of the candidate panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param x top-left x co-ordinate of the candidate panel + * @param y top-left y co-ordinate of the candidate panel + * @param w width of the candidate panel + * @param h height of the candidate panel + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_candidate_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_candidate_panel_geometry_get"); + return; + } + + if (ctx->klass->candidate_panel_geometry_get) + ctx->klass->candidate_panel_geometry_get(ctx, x, y, w, h); +} +