From ea8196e411c81db352e85800921fb621e151bb84 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 2 May 2017 16:28:10 +0900 Subject: [PATCH] ecore_imf: Add ecore_imf_context_prediction_hint_set API Summary: Added a new api to send the prediction hint string to IME. Test Plan: Tested in Tizen device Reviewers: woohyun, id213sin, jihoon Reviewed By: jihoon Subscribers: cedric, jsuya, z-wony, jpeg Differential Revision: https://phab.enlightenment.org/D4805 --- src/lib/ecore_imf/Ecore_IMF.h | 17 +++++++++++++++++ src/lib/ecore_imf/ecore_imf_context.c | 14 ++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/lib/ecore_imf/Ecore_IMF.h b/src/lib/ecore_imf/Ecore_IMF.h index e411728d0c..6e8804e77f 100644 --- a/src/lib/ecore_imf/Ecore_IMF.h +++ b/src/lib/ecore_imf/Ecore_IMF.h @@ -712,6 +712,7 @@ struct _Ecore_IMF_Context_Class void (*input_hint_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Hints input_hints); /**< Sets input hint to fine-tune input methods behavior */ void (*bidi_direction_set) (Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Direction direction); /**< Set bidirectionality at the cursor position */ Ecore_IMF_Input_Panel_Keyboard_Mode (*keyboard_mode_get) (Ecore_IMF_Context *ctx); /**< Return the current keyboard mode of the input panel */ + void (*prediction_hint_set) (Ecore_IMF_Context *ctx, const char *prediction_hint); /**< Set the prediction hint to the input panel */ }; /** @@ -1884,6 +1885,22 @@ EAPI Ecore_IMF_BiDi_Direction ecore_imf_context_bidi_direction_get(Ecore_IM */ EAPI Ecore_IMF_Input_Panel_Keyboard_Mode ecore_imf_context_keyboard_mode_get(Ecore_IMF_Context *ctx); +/** + * @ingroup Ecore_IMF_Context_Group + * @brief Set the prediction hint string to deliver to the input panel. + * + * This API can be used when you want to set prediction hint to use intelligent reply suggestion service. + * The intelligent reply suggestion service generates reply candidates for given prediction hint. + * Example + * prediction hint: How are you? -> result: I'm fine, Not bad, I'm all right. + * + * @since 1.20.0 + * + * @param[in] ctx An #Ecore_IMF_Context + * @param[in] prediction_hint The prediction hint string. + */ +EAPI void ecore_imf_context_prediction_hint_set(Ecore_IMF_Context *ctx, const char *prediction_hint); + /* The following entry points must be exported by each input method module */ diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c index 961c4ae3c3..e7f1f67d68 100644 --- a/src/lib/ecore_imf/ecore_imf_context.c +++ b/src/lib/ecore_imf/ecore_imf_context.c @@ -1406,4 +1406,18 @@ ecore_imf_context_keyboard_mode_get(Ecore_IMF_Context *ctx) mode = ctx->klass->keyboard_mode_get(ctx); return mode; +} + +EAPI void +ecore_imf_context_prediction_hint_set(Ecore_IMF_Context *ctx, const char *prediction_hint) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_prediction_hint_set"); + return; + } + + if (ctx->klass->prediction_hint_set) + ctx->klass->prediction_hint_set(ctx, prediction_hint); } \ No newline at end of file