Add ime_set_native_window_size API 52/262652/4
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 17 Aug 2021 08:00:17 +0000 (17:00 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 17 Aug 2021 08:04:22 +0000 (17:04 +0900)
It's used in NUI IME.

Change-Id: I700c10e241f75f58e73ff6849b3e2c6a4d2f0d08
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
CMakeLists.txt
inputmethod/include/inputmethod_internal.h
inputmethod/src/inputmethod.cpp
packaging/capi-ui-inputmethod.spec
tests/CMakeLists.txt

index b98c56a..2bc4ecb 100644 (file)
@@ -8,7 +8,7 @@ SET(description "Input Method APIs")
 SET(service "ui")
 SET(submodule "inputmethod")
 SET(remote_submodule "remote-input")
-SET(dependents "capi-base-common dlog evas eina ecore-imf libscl-core isf cynara-client cynara-session")
+SET(dependents "capi-base-common dlog evas eina ecore-imf ecore-wl2 libscl-core isf cynara-client cynara-session")
 SET(remote_dependents "capi-base-common dlog ecore-imf isf cynara-client cynara-session")
 SET(LIBDIR ${LIB_INSTALL_DIR})
 
index 3cf056a..b1d9dc2 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <tizen.h>
 #include <Eina.h>
+#include <Ecore_Wl2.h>
 #include <sclcore.h>
 
 #ifdef __cplusplus
@@ -1105,6 +1106,31 @@ int ime_set_engine_loader_flag(bool flag);
  */
 int ime_send_key_event_processing_result(scim::KeyEvent &key, uint32_t serial, bool is_success);
 
+/**
+ * @brief Updates the given input panel window's size information.
+ *
+ * @since_tizen 6.5
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] window The native window of IME
+ * @param[in] portrait_width The width in portrait mode
+ * @param[in] portrait_height The height in portrait mode
+ * @param[in] landscape_width The width in landscape mode
+ * @param[in] landscape_height The height in landscape mode
+ *
+ * @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_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop is not started yet
+ *
+ * @see ime_create_cb()
+ */
+int ime_set_native_window_size(Ecore_Wl2_Window *window, int portrait_width, int portrait_height, int landscape_width, int landscape_height);
+
 #ifdef __cplusplus
 }
 #endif
index 257c42f..5decdce 100644 (file)
@@ -1567,6 +1567,33 @@ EXPORT_API int ime_set_size(int portrait_width, int portrait_height, int landsca
     //LCOV_EXCL_STOP
 }
 
+EXPORT_API int ime_set_native_window_size(Ecore_Wl2_Window *window, int portrait_width, int portrait_height, int landscape_width, int landscape_height)
+{
+    ime_error_e retVal = IME_ERROR_NONE;
+
+    if (portrait_width < 1 || portrait_height < 1 || landscape_width < 1 || landscape_height < 1) {
+        LOGW("IME_ERROR_INVALID_PARAMETER");
+        return IME_ERROR_INVALID_PARAMETER;
+    }
+
+    if (!g_running) {
+        LOGW("IME_ERROR_NOT_RUNNING");
+        return IME_ERROR_NOT_RUNNING;
+    }
+
+    //LCOV_EXCL_START
+    retVal = _check_privilege();
+    if (retVal != IME_ERROR_NONE) return retVal;
+
+    ecore_wl2_window_rotation_geometry_set(window, 0, 0, 0, portrait_width, portrait_height);
+    ecore_wl2_window_rotation_geometry_set(window, 90, 0, 0, landscape_height, landscape_width);
+    ecore_wl2_window_rotation_geometry_set(window, 180, 0, 0, portrait_width, portrait_height);
+    ecore_wl2_window_rotation_geometry_set(window, 270, 0, 0, landscape_height, landscape_width);
+
+    return IME_ERROR_NONE;
+    //LCOV_EXCL_STOP
+}
+
 EXPORT_API int ime_create_option_window(void)
 {
     ime_error_e retVal = IME_ERROR_NONE;
index 88a8f6f..feafe7d 100644 (file)
@@ -11,6 +11,7 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(evas)
 BuildRequires:  pkgconfig(eina)
 BuildRequires:  pkgconfig(ecore-imf)
+BuildRequires:  pkgconfig(ecore-wl2)
 BuildRequires:  pkgconfig(libscl-core)
 BuildRequires:  pkgconfig(isf)
 BuildRequires:  pkgconfig(cynara-client)
index 4907164..b18ecd7 100644 (file)
@@ -9,6 +9,7 @@ pkg_check_modules(pkgs REQUIRED
        evas
        eina
        ecore-imf
+       ecore-wl2
        libscl-core
        isf
        gmock