Add a new API to update input panel event 89/192489/8
authorInhong Han <inhong1.han@samsung.com>
Tue, 6 Nov 2018 04:27:09 +0000 (13:27 +0900)
committerInhong Han <inhong1.han@samsung.com>
Wed, 14 Nov 2018 06:59:59 +0000 (15:59 +0900)
Change-Id: I5d6b655c75f456950a5183802a789fd7387a3a99

include/inputmethod.h
src/inputmethod.cpp

index 83fbd0fb9bf94427e2e5038fe50ec7c461875b42..0710aff2813467a4a2323ac2408a018c317d014b 100644 (file)
@@ -99,6 +99,19 @@ typedef enum {
        IME_ATTR_FONTSTYLE, /**< A font style attribute, e.g., underline, etc. */
 } ime_attribute_type;
 
+/**
+ * @brief Enumeration containing input panel events.
+ *
+ * @since_tizen 5.5
+ *
+ * @see ime_update_input_panel_event()
+ */
+typedef enum {
+       IME_EVENT_TYPE_LANGUAGE = 1, /**< The language of the input panel */
+       IME_EVENT_TYPE_SHIFT_MODE, /**< The shift key state of the input panel */
+       IME_EVENT_TYPE_GEOMETRY, /**< The size of the input panel */
+} ime_event_type_e;
+
 /**
  * @brief Value for #IME_ATTR_FONTSTYLE. Draw a line under the text.
  * @since_tizen @if MOBILE 2.4 @else 3.0 @endif
@@ -2429,6 +2442,28 @@ int ime_event_set_prediction_hint_data_set_cb(ime_prediction_hint_data_set_cb ca
  */
 int ime_request_hide(void);
 
+/**
+ * @brief Updates the state of input panel event.
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] type The input panel event type
+ * @param[in] value The value of event type
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @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
+ *
+ * @see ime_event_type_e
+ */
+int ime_update_input_panel_event(ime_event_type_e type, unsigned int value);
+
 /**
  * @}
  */
index 930dc4050522bdeaacd0edd8e10abc7024a95454..bfb465001e29e26572c26ce0a6a6cff1af30aa3f 100644 (file)
@@ -2064,4 +2064,26 @@ EXPORT_API int ime_event_set_optimization_hint_set_cb(ime_optimization_hint_set_
 
     return IME_ERROR_NONE;
 }
-//LCOV_EXCL_STOP
\ No newline at end of file
+//LCOV_EXCL_STOP
+
+EXPORT_API int ime_update_input_panel_event(ime_event_type_e type, unsigned int value)
+{
+    ime_error_e retVal = IME_ERROR_NONE;
+
+    if (type >= IME_EVENT_TYPE_LANGUAGE && type <= IME_EVENT_TYPE_GEOMETRY) {
+        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) return retVal;
+
+    g_core.update_input_context(type, value);
+
+    return IME_ERROR_NONE;
+}