2 * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <inputmethod.h>
20 #include <inputmethod_internal.h>
21 #include "cscl-ui-inputmethod.h"
26 #define LOG_TAG "CSCLUINUI"
28 static scl_process_key_event_with_imengine_cb g_process_key_event_with_imengine_cb = NULL;
29 static void *g_process_key_event_with_imengine_cb_data = NULL;
31 EXPORT_API int scl_set_imengine(const char *engine_id)
33 int ret = IME_ERROR_NONE;
34 ret = ime_set_imengine(engine_id);
36 LOGD("engine_id : %s, ret : %d", engine_id, ret);
40 EXPORT_API int scl_flush_imengine()
42 int ret = IME_ERROR_NONE;
43 ret = ime_flush_imengine();
45 LOGD("ret : %d", ret);
49 EXPORT_API int scl_reset_imengine()
51 int ret = IME_ERROR_NONE;
52 ret = ime_reset_imengine();
54 LOGD("ret : %d", ret);
58 EXPORT_API int scl_send_imengine_event(int command, uint32_t value)
60 int ret = IME_ERROR_NONE;
61 ret = ime_send_imengine_event(command, value);
63 LOGD("command : %d, value : %d, ret : %d", command, value, ret);
67 EXPORT_API int scl_set_engine_loader_flag(bool flag)
69 int ret = IME_ERROR_NONE;
70 ret = ime_set_engine_loader_flag(flag);
72 LOGD("flag : %d, ret : %d", flag, ret);
76 static void ime_app_process_key_event_with_imengine_cb(scim::KeyEvent &key, uint32_t serial, void *user_data)
78 LOGD("process_key_event_with_imengine = key : %p, serial : %d", &key, serial);
79 if (g_process_key_event_with_imengine_cb) {
80 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);
84 EXPORT_API int scl_set_process_key_event_with_imengine_cb(scl_process_key_event_with_imengine_cb callback, void *user_data)
86 int ret = IME_ERROR_NONE;
88 g_process_key_event_with_imengine_cb = callback;
89 g_process_key_event_with_imengine_cb_data = user_data;
91 ret = ime_event_set_process_key_event_with_imengine_cb(ime_app_process_key_event_with_imengine_cb, user_data);