From: InHong Han Date: Thu, 6 Oct 2022 09:54:24 +0000 (+0900) Subject: Add new APIs to support Korean input X-Git-Tag: accepted/tizen/unified/20230113.091225~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe8f4d7c3d97199468ddbe4a7e48098c3d6c6b2f;p=platform%2Fcore%2Fuifw%2Flibscl-ui-nui.git Add new APIs to support Korean input Change-Id: Ib339a261c9a9280459acf0d8ff5986648dfd0cfe --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d2b22e7..897ccab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,9 +95,6 @@ SET(PKGS_CHECK_MODULES vconf eldbus libscl-common - dbus-1 - gio-2.0 - capi-ui-inputmethod ) IF (with_wayland) diff --git a/capi/CMakeLists.txt b/capi/CMakeLists.txt index f7beb66..6d0c207 100644 --- a/capi/CMakeLists.txt +++ b/capi/CMakeLists.txt @@ -14,6 +14,9 @@ pkg_check_modules(pkgs REQUIRED eldbus libscl-common ecore-wl2 + dbus-1 + gio-2.0 + capi-ui-inputmethod ) FOREACH(flag ${pkgs_CFLAGS}) @@ -40,7 +43,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") AUX_SOURCE_DIRECTORY(src SOURCES) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../scl LIBSCL_SOURCES) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../res LIBSCL_RES_SOURCES) -ADD_LIBRARY(${fw_name} SHARED +ADD_LIBRARY(${fw_name} SHARED ${SOURCES} ${LIBSCL_SOURCES} ${LIBSCL_RES_SOURCES} diff --git a/capi/include/cscl-ui-inputmethod.h b/capi/include/cscl-ui-inputmethod.h new file mode 100644 index 0000000..1279d9c --- /dev/null +++ b/capi/include/cscl-ui-inputmethod.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __SCL_CAPI_INPUTMETHOD_H__ +#define __SCL_CAPI_INPUTMETHOD_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*scl_process_key_event_with_imengine_cb)(uint32_t code, uint32_t mask, uint32_t layout, uint32_t dev_class, uint32_t dev_subclass, const char *dev_name, uint32_t serial, void* user_data); + +int scl_set_imengine(const char *engine_id); +int scl_flush_imengine(); +int scl_reset_imengine(); +int scl_send_imengine_event(int command, uint32_t value); +int scl_set_engine_loader_flag(bool flag); +int scl_set_process_key_event_with_imengine_cb(scl_process_key_event_with_imengine_cb callback, void *user_data); + +#ifdef __cplusplus +} +#endif + +#endif /* __SCL_CAPI_INPUTMETHOD_H__ */ diff --git a/capi/src/cscl-ui-inputmethod.cpp b/capi/src/cscl-ui-inputmethod.cpp new file mode 100644 index 0000000..2bfb421 --- /dev/null +++ b/capi/src/cscl-ui-inputmethod.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include "cscl-ui-inputmethod.h" + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "CSCLUINUI" + +static scl_process_key_event_with_imengine_cb g_process_key_event_with_imengine_cb = NULL; +static void *g_process_key_event_with_imengine_cb_data = NULL; + +EXPORT_API int scl_set_imengine(const char *engine_id) +{ + int ret = IME_ERROR_NONE; + ret = ime_set_imengine(engine_id); + + LOGD("engine_id : %s, ret : %d", engine_id, ret); + return ret; +} + +EXPORT_API int scl_flush_imengine() +{ + int ret = IME_ERROR_NONE; + ret = ime_flush_imengine(); + + LOGD("ret : %d", ret); + return ret; +} + +EXPORT_API int scl_reset_imengine() +{ + int ret = IME_ERROR_NONE; + ret = ime_reset_imengine(); + + LOGD("ret : %d", ret); + return ret; +} + +EXPORT_API int scl_send_imengine_event(int command, uint32_t value) +{ + int ret = IME_ERROR_NONE; + ret = ime_send_imengine_event(command, value); + + LOGD("command : %d, value : %d, ret : %d", command, value, ret); + return ret; +} + +EXPORT_API int scl_set_engine_loader_flag(bool flag) +{ + int ret = IME_ERROR_NONE; + ret = ime_set_engine_loader_flag(flag); + + LOGD("flag : %d, ret : %d", flag, ret); + return ret; +} + +static void ime_app_process_key_event_with_imengine_cb(scim::KeyEvent &key, uint32_t serial, void *user_data) +{ + LOGD("process_key_event_with_imengine = key : %p, serial : %d", &key, serial); + if (g_process_key_event_with_imengine_cb) { + g_process_key_event_with_imengine_cb(key.code, key.mask, key.layout, key.dev_class, key.dev_subclass, (key.dev_name).c_str(), serial, user_data); + } +} + +EXPORT_API int scl_set_process_key_event_with_imengine_cb(scl_process_key_event_with_imengine_cb callback, void *user_data) +{ + int ret = IME_ERROR_NONE; + + g_process_key_event_with_imengine_cb = callback; + g_process_key_event_with_imengine_cb_data = user_data; + + ret = ime_event_set_process_key_event_with_imengine_cb(ime_app_process_key_event_with_imengine_cb, user_data); + + return ret; +}