From e7ddd50e491147b7f40a1866453db7c94b0c3aa9 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 17 Aug 2021 17:00:17 +0900 Subject: [PATCH] Add ime_set_native_window_size API It's used in NUI IME. Change-Id: I700c10e241f75f58e73ff6849b3e2c6a4d2f0d08 Signed-off-by: Jihoon Kim --- CMakeLists.txt | 2 +- inputmethod/include/inputmethod_internal.h | 26 +++++++++++++++++++++ inputmethod/src/inputmethod.cpp | 27 ++++++++++++++++++++++ packaging/capi-ui-inputmethod.spec | 1 + tests/CMakeLists.txt | 1 + 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b98c56a..2bc4ecb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/inputmethod/include/inputmethod_internal.h b/inputmethod/include/inputmethod_internal.h index 3cf056a..b1d9dc2 100644 --- a/inputmethod/include/inputmethod_internal.h +++ b/inputmethod/include/inputmethod_internal.h @@ -24,6 +24,7 @@ #include #include +#include #include #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 diff --git a/inputmethod/src/inputmethod.cpp b/inputmethod/src/inputmethod.cpp index 257c42f..5decdce 100644 --- a/inputmethod/src/inputmethod.cpp +++ b/inputmethod/src/inputmethod.cpp @@ -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; diff --git a/packaging/capi-ui-inputmethod.spec b/packaging/capi-ui-inputmethod.spec index 88a8f6f..feafe7d 100644 --- a/packaging/capi-ui-inputmethod.spec +++ b/packaging/capi-ui-inputmethod.spec @@ -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) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4907164..b18ecd7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,6 +9,7 @@ pkg_check_modules(pkgs REQUIRED evas eina ecore-imf + ecore-wl2 libscl-core isf gmock -- 2.34.1