Add ime_send_private_command API 54/129254/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 15 May 2017 23:02:10 +0000 (08:02 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 16 May 2017 08:30:43 +0000 (17:30 +0900)
Change-Id: Ie1c12b5cffd8d5c45e19bad3914affc7cd4ea391
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
include/inputmethod.h
src/inputmethod.cpp

index 85d4ec2..b67cd6a 100644 (file)
@@ -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);
+
+/**
  * @}
  */
 
index 7fd9080..183d152 100644 (file)
@@ -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;