From 13df5b397c2ad0547dc7f4eed7f0061a3da1e3d6 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 16 May 2017 08:02:10 +0900 Subject: [PATCH] Add ime_send_private_command API Change-Id: Ie1c12b5cffd8d5c45e19bad3914affc7cd4ea391 Signed-off-by: Jihoon Kim --- include/inputmethod.h | 20 ++++++++++++++++++++ src/inputmethod.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/include/inputmethod.h b/include/inputmethod.h index 85d4ec2..b67cd6a 100644 --- a/include/inputmethod.h +++ b/include/inputmethod.h @@ -2170,6 +2170,26 @@ EXPORT_API int ime_device_info_get_subclass(ime_device_info_h dev_info, Ecore_IM EXPORT_API int ime_event_set_prediction_hint_cb(ime_prediction_hint_set_cb callback_func, void *user_data); /** + * @brief Send a private command to the associated text input UI control. + * This can be used by IME to deliver specific data to an application. + * The data format MUST be negotiated by both application and IME. + * + * @since_tizen 4.0 + * + * @privlevel public + * + * @privilege %http://tizen.org/privilege/ime + * + * @param[in] command The UTF-8 string to be sent + * + * @return 0 on success, otherwise a negative error value + * @retval #IME_ERROR_NONE No error + * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function + * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet + */ +EXPORT_API int ime_send_private_command(const char *command); + +/** * @} */ diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp index 7fd9080..183d152 100644 --- a/src/inputmethod.cpp +++ b/src/inputmethod.cpp @@ -1477,6 +1477,31 @@ int ime_select_candidate(unsigned int index) return IME_ERROR_NONE; } +int ime_send_private_command(const char *command) +{ + ime_error_e retVal = IME_ERROR_NONE; + + if (!command) { + LOGW("IME_ERROR_INVALID_PARAMETER"); + return IME_ERROR_INVALID_PARAMETER; + } + + if (!g_running) { + LOGW("IME_ERROR_NOT_RUNNING"); + return IME_ERROR_NOT_RUNNING; + } + + retVal = _check_privilege(); + if (retVal != IME_ERROR_NONE) { + LOGE("_check_privilege returned %d.", retVal); + return retVal; + } + + g_core.send_private_command(command); + + return IME_ERROR_NONE; +} + int ime_context_get_layout(ime_context_h context, Ecore_IMF_Input_Panel_Layout *layout) { ime_error_e retVal = IME_ERROR_NONE; -- 2.7.4