From a889ae4997bbc921a2277ba292bbe02af5d8a357 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 20 Jun 2011 07:17:24 +0000 Subject: [PATCH] From: Jihoon Kim Subject: [E-devel] [PATCH] Add Ecore_IMF API to set the attirbute of input panel For supporting virtual keyboard, I'd like to add ecore_imf_context_input_panel_enabled_set/get APIs. The detail description of each API is included in the patch file as doxygen format. If input panel is in 'enabled' status, the immodule will request to show the input panel automatically When the input widget such as entry is clicked or has focus. In some case, application programmers want to control the input panel manually (not automatically), so I implement this API. SVN revision: 60504 --- legacy/ecore/ChangeLog | 3 ++ legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h | 2 + .../src/lib/ecore_imf/ecore_imf_context.c | 48 +++++++++++++++++++ .../src/lib/ecore_imf/ecore_imf_private.h | 1 + 4 files changed, 54 insertions(+) diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index 082443d5ec..5c1293fd93 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -234,3 +234,6 @@ * Removed support for evas xrender engine from ecore-evas as it is not a deprecated engine in evas and no longer needs support. +2011-06-20 Jihoon Kim + + * Ecore_IMF: Added ecore_imf_context_input_panel_enabled_set/get API diff --git a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h index 4266d53501..7afee2cf96 100644 --- a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h +++ b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h @@ -397,6 +397,8 @@ EAPI void ecore_imf_context_input_panel_layout_set(Ecor EAPI Ecore_IMF_Input_Panel_Layout ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang); EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable); +EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx); /* 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 0fe7f3d78a..382bf6a789 100644 --- a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c +++ b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c @@ -184,6 +184,10 @@ ecore_imf_context_add(const char *id) * set on the immodule */ ecore_imf_context_autocapital_type_set(ctx, ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE); + /* default input panel enabled status is EINA_TRUE, so let's make sure it's + * set on the immodule */ + ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE); + /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's * set on the immodule */ ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL); @@ -1073,3 +1077,47 @@ ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx) return ctx->input_panel_lang; } +/** + * Set whether the Input Method Context should request to show the input panel automatically + * when the widget has focus. + * + * @param ctx An #Ecore_IMF_Context. + * @param enabled If true, the input panel will be shown when the widget is clicked or has focus. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx, + Eina_Bool enabled) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_enabled_set"); + return; + } + + ctx->input_panel_enabled = enabled; +} + +/** + * Get whether the Input Method Context requests to show the input panel automatically. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return the attribute to show the input panel automatically + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI Eina_Bool +ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_enabled_get"); + return EINA_FALSE; + } + + return ctx->input_panel_enabled; +} + diff --git a/legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h b/legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h index 4255ec6741..07a5b0937a 100644 --- a/legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h +++ b/legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h @@ -51,6 +51,7 @@ struct _Ecore_IMF_Context Ecore_IMF_Input_Panel_Layout input_panel_layout; Ecore_IMF_Input_Panel_Lang input_panel_lang; Eina_Bool allow_prediction : 1; + Eina_Bool input_panel_enabled : 1; }; struct _Ecore_IMF_Module