diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2020-09-08 17:37:00 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2020-09-08 17:37:00 +0900 |
commit | 5f010fad4533649e8278a0c151d24fda2d07dcfc (patch) | |
tree | 022ff07e187a89afdc1e1d896482d22764e0f7a8 | |
parent | ea8221155bcb1f05026626f22366ccc25f1a595b (diff) | |
parent | 7f02826793b0b1170bd9192fda5a7243fae8ba63 (diff) | |
download | ise-default-5f010fad4533649e8278a0c151d24fda2d07dcfc.tar.gz ise-default-5f010fad4533649e8278a0c151d24fda2d07dcfc.tar.bz2 ise-default-5f010fad4533649e8278a0c151d24fda2d07dcfc.zip |
Merge branch 'tizen_5.5' into tizen
Change-Id: Ibd68c5d19321e715e86efa6a82e848fa1dd3b510
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | data/layout/mobile/ise_lang_table.xml | 4 | ||||
-rw-r--r-- | data/layout/tv/ise_lang_table.xml | 4 | ||||
-rw-r--r-- | data/layout/wearable/ise_lang_table.xml | 2 | ||||
-rw-r--r-- | packaging/ise-default.spec | 7 | ||||
-rw-r--r-- | src/include/ise-dbus.h | 2 | ||||
-rw-r--r-- | src/include/ise.h | 1 | ||||
-rw-r--r-- | src/include/languages.h | 2 | ||||
-rw-r--r-- | src/ise-dbus.cpp | 145 | ||||
-rw-r--r-- | src/ise.cpp | 56 | ||||
-rw-r--r-- | src/sdk/ise_lang_table.cpp | 1 | ||||
-rw-r--r-- | src/sdk/ise_lang_table.h | 2 | ||||
-rw-r--r-- | src/sdk/sdk.cpp | 82 |
13 files changed, 221 insertions, 90 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 75cd325..3748000 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,7 @@ SET(PKGS_CHECK_MODULES stt capi-appfw-application capi-appfw-preference - capi-media-audio-io + capi-media-sound-manager capi-ui-inputmethod capi-system-system-settings smartreply @@ -84,6 +84,7 @@ SET(PKGS_CHECK_MODULES glib-2.0 dbus-1 gio-2.0 + pkgmgr-info ) IF (with_cbhm) diff --git a/data/layout/mobile/ise_lang_table.xml b/data/layout/mobile/ise_lang_table.xml index 8068f92..f4bba41 100644 --- a/data/layout/mobile/ise_lang_table.xml +++ b/data/layout/mobile/ise_lang_table.xml @@ -12,7 +12,7 @@ <rec name="uuid_clm_korean" uuid="org.tizen.ise-engine-glm.korean"/> </keyboard_uuid_table> <language_table> - <rec language="English" language_name="English" language_name_abbr="EN(US)" inputmode_QTY="ENGLISH_QTY" inputmode_QTY_name="Qwerty" keyboard_ise_uuid="uuid_clm_english" country_code_URL="uk" is_latin_language="true" accepts_caps_mode="true" locale_string="en_US"/> + <rec language="English" language_name="English" language_name_abbr="EN(US)" inputmode_QTY="ENGLISH_QTY" inputmode_QTY_name="Qwerty" keyboard_ise_uuid="uuid_clm_english" country_code_URL="uk" is_latin_language="true" accepts_caps_mode="true" locale_string="en_US" load_in_ime="true"/> <rec language="Italian" language_name="Italiano" language_name_abbr="IT" inputmode_QTY="ITALIAN_QTY" inputmode_QTY_name="Tastiera Qwerty" keyboard_ise_uuid="uuid_default" country_code_URL="it" is_latin_language="true" accepts_caps_mode="true" locale_string="it_IT"/> <rec language="Spanish" language_name="Español" language_name_abbr="ES(ES)" inputmode_QTY="SPANISH_QTY" inputmode_QTY_name="Teclado Qwerty" keyboard_ise_uuid="uuid_default" country_code_URL="es" is_latin_language="true" accepts_caps_mode="true" locale_string="es_ES"/> <rec language="Galician" language_name="Galego" language_name_abbr="GL" inputmode_QTY="GALICIAN_QTY" inputmode_QTY_name="Qwerty" keyboard_ise_uuid="uuid_default" country_code_URL="gl" is_latin_language="true" accepts_caps_mode="true" locale_string="gl_ES"/> @@ -56,7 +56,7 @@ <rec language="Hebrew" language_name="עברית" language_name_abbr="HE" inputmode_QTY="HEBREW_QTY" inputmode_QTY_name="Hebrew" keyboard_ise_uuid="uuid_default" country_code_URL="il"/> --> <rec language="Korean" language_name="한국어" language_name_abbr="KR" inputmode_QTY="KOREAN_QTY" inputmode_QTY_name="쿼티" keyboard_ise_uuid="uuid_korean" country_code_URL="kr" locale_string="ko_KR"/> - <rec language="Chinese" language_name="简体中文" language_name_abbr="CN" inputmode_QTY="CHINESE_QTY" inputmode_QTY_name="Qwerty键盘" main_keyboard_name="中" keyboard_ise_uuid="uuid_clm_chinese" country_code_URL="cn" locale_string="zh_CN"/> + <rec language="Chinese" language_name="简体中文" language_name_abbr="CN" inputmode_QTY="CHINESE_QTY" inputmode_QTY_name="Qwerty键盘" main_keyboard_name="中" keyboard_ise_uuid="uuid_clm_chinese" country_code_URL="cn" locale_string="zh_CN" load_in_ime="true"/> <rec language="Taiwan" language_name="繁體中文-註音" language_name_abbr="TW" inputmode_QTY="ZHUYIN_QTY" inputmode_QTY_name="註音" main_keyboard_name="中" keyboard_ise_uuid="uuid_zhuyin_big" country_code_URL="tw" locale_string="zh_TW"/> <rec language="Hongkong" language_name="繁體中文-倉頡" language_name_abbr="HK" inputmode_QTY="CANGJIE_QTY" inputmode_QTY_name="倉頡" main_keyboard_name="中" keyboard_ise_uuid="uuid_cangjie_3" country_code_URL="hk" locale_string="zh_HK"/> <rec language="Japanese" language_name="日本語" language_name_abbr="JA" inputmode_QTY="JAPANESE_QTY" inputmode_QTY_name="Qwerty" main_keyboard_name="あ" keyboard_ise_uuid="uuid_anthy" country_code_URL="jp" locale_string="ja_JP"/> diff --git a/data/layout/tv/ise_lang_table.xml b/data/layout/tv/ise_lang_table.xml index 52366cb..2b76d59 100644 --- a/data/layout/tv/ise_lang_table.xml +++ b/data/layout/tv/ise_lang_table.xml @@ -12,7 +12,7 @@ <rec name="uuid_clm_korean" uuid="org.tizen.ise-engine-glm.korean"/> </keyboard_uuid_table> <language_table> - <rec language="English" language_name="English" inputmode_QTY="ENGLISH_QTY" inputmode_QTY_name="Qwerty" keyboard_ise_uuid="uuid_clm_english" country_code_URL="uk" is_latin_language="true" accepts_caps_mode="true" locale_string="en_US"/> + <rec language="English" language_name="English" inputmode_QTY="ENGLISH_QTY" inputmode_QTY_name="Qwerty" keyboard_ise_uuid="uuid_clm_english" country_code_URL="uk" is_latin_language="true" accepts_caps_mode="true" locale_string="en_US" load_in_ime="true"/> <rec language="Italian" language_name="Italiano" inputmode_QTY="ITALIAN_QTY" inputmode_QTY_name="Tastiera Qwerty" keyboard_ise_uuid="uuid_default" country_code_URL="it" is_latin_language="true" accepts_caps_mode="true" locale_string="it_IT"/> <rec language="Spanish" language_name="Español" inputmode_QTY="SPANISH_QTY" inputmode_QTY_name="Teclado Qwerty" keyboard_ise_uuid="uuid_default" country_code_URL="es" is_latin_language="true" accepts_caps_mode="true" locale_string="es_ES"/> <rec language="Galician" language_name="Galego" inputmode_QTY="GALICIAN_QTY" inputmode_QTY_name="Qwerty" keyboard_ise_uuid="uuid_default" country_code_URL="gl" is_latin_language="true" accepts_caps_mode="true" locale_string="gl_ES"/> @@ -56,7 +56,7 @@ <rec language="Hebrew" language_name="עברית" inputmode_QTY="HEBREW_QTY" inputmode_QTY_name="Hebrew" keyboard_ise_uuid="uuid_default" country_code_URL="il"/> --> <rec language="Korean" language_name="한국어" inputmode_QTY="KOREAN_QTY" inputmode_QTY_name="쿼티" keyboard_ise_uuid="uuid_korean" country_code_URL="kr" locale_string="ko_KR"/> - <rec language="Chinese" language_name="简体中文" inputmode_QTY="CHINESE_QTY" inputmode_QTY_name="Qwerty键盘" main_keyboard_name="中" keyboard_ise_uuid="uuid_clm_chinese" country_code_URL="cn" locale_string="zh_CN"/> + <rec language="Chinese" language_name="简体中文" inputmode_QTY="CHINESE_QTY" inputmode_QTY_name="Qwerty键盘" main_keyboard_name="中" keyboard_ise_uuid="uuid_clm_chinese" country_code_URL="cn" locale_string="zh_CN" load_in_ime="true"/> <rec language="Taiwan" language_name="繁體中文-註音" inputmode_QTY="ZHUYIN_QTY" inputmode_QTY_name="註音" main_keyboard_name="中" keyboard_ise_uuid="uuid_zhuyin_big" country_code_URL="tw" locale_string="zh_TW"/> <rec language="Hongkong" language_name="繁體中文-倉頡" inputmode_QTY="CANGJIE_QTY" inputmode_QTY_name="倉頡" main_keyboard_name="中" keyboard_ise_uuid="uuid_cangjie_3" country_code_URL="hk" locale_string="zh_HK"/> <rec language="Japanese" language_name="日本語" inputmode_QTY="JAPANESE_QTY" inputmode_QTY_name="Qwerty" main_keyboard_name="あ" keyboard_ise_uuid="uuid_anthy" country_code_URL="jp" locale_string="ja_JP"/> diff --git a/data/layout/wearable/ise_lang_table.xml b/data/layout/wearable/ise_lang_table.xml index d516d8a..0c62487 100644 --- a/data/layout/wearable/ise_lang_table.xml +++ b/data/layout/wearable/ise_lang_table.xml @@ -12,7 +12,7 @@ <rec name="uuid_clm_korean" uuid="org.tizen.ise-engine-glm.korean"/> </keyboard_uuid_table> <language_table> - <rec language="English" language_name="EN(US)" language_name_abbr="EN(US)" inputmode_QTY="ENGLISH_4X4" inputmode_QTY_name="3x4 keyboard" keyboard_ise_uuid="uuid_clm_english" country_code_URL="uk" is_latin_language="true" accepts_caps_mode="true" locale_string="en_US"/> + <rec language="English" language_name="EN(US)" language_name_abbr="EN(US)" inputmode_QTY="ENGLISH_4X4" inputmode_QTY_name="3x4 keyboard" keyboard_ise_uuid="uuid_clm_english" country_code_URL="uk" is_latin_language="true" accepts_caps_mode="true" locale_string="en_US" load_in_ime="true"/> <rec language="Italian" language_name="Italiano" language_name_abbr="IT" inputmode_QTY="ITALIAN_4X4" inputmode_QTY_name="3x4 keyboard" keyboard_ise_uuid="uuid_default" country_code_URL="it" is_latin_language="true" accepts_caps_mode="true" locale_string="it_IT"/> <rec language="Spanish" language_name="Español" language_name_abbr="ES(ES)" inputmode_QTY="SPANISH_4X4" inputmode_QTY_name="3x4 keyboard" keyboard_ise_uuid="uuid_default" country_code_URL="es" is_latin_language="true" accepts_caps_mode="true" locale_string="es_ES"/> <rec language="Galician" language_name="Galego" language_name_abbr="GL" inputmode_QTY="GALICIA_4X4" inputmode_QTY_name="3x4 keyboard" keyboard_ise_uuid="uuid_default" country_code_URL="gl" is_latin_language="true" accepts_caps_mode="true" locale_string="gl_ES"/> diff --git a/packaging/ise-default.spec b/packaging/ise-default.spec index 3c0aa63..61d83c9 100644 --- a/packaging/ise-default.spec +++ b/packaging/ise-default.spec @@ -19,7 +19,7 @@ BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(stt) BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-appfw-preference) -BuildRequires: pkgconfig(capi-media-audio-io) +BuildRequires: pkgconfig(capi-media-sound-manager) BuildRequires: pkgconfig(capi-ui-inputmethod) BuildRequires: pkgconfig(smartreply) BuildRequires: pkgconfig(key-manager) @@ -28,11 +28,8 @@ BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(gio-2.0) -Requires: ise-engine-tables -Requires: ise-engine-tables-zh -Requires: ise-engine-hangul +BuildRequires: pkgconfig(pkgmgr-info) Requires: ise-engine-glm -Requires: ise-engine-anthy Requires: ise-engine-default # This is for old profile-based OBS project optimizations. diff --git a/src/include/ise-dbus.h b/src/include/ise-dbus.h index c948b14..1deea46 100644 --- a/src/include/ise-dbus.h +++ b/src/include/ise-dbus.h @@ -44,7 +44,7 @@ typedef struct { bool engine_loader_dbus_init(void *data); bool engine_loader_dbus_shutdown(); -void engine_loader_set_imengine(const char *engine_id); +void engine_loader_set_imengine(const char *engine_id, const char *module_name); void engine_loader_flush_imengine(); void engine_loader_reset_imengine(); void engine_loader_send_imengine_event(int command, uint32_t value); diff --git a/src/include/ise.h b/src/include/ise.h index 4d016f4..0d1083d 100644 --- a/src/include/ise.h +++ b/src/include/ise.h @@ -41,6 +41,7 @@ #endif #define DEFAULT_KEYBOARD_ISE_UUID "org.tizen.ise-engine-default" +#define DEFAULT_KEYBOARD_ISE_PKGID "ise-engine-default" //#define INPUT_MODE_NATIVE MAX_INPUT_MODE /* Native mode. It will distinguish to the current user language */ diff --git a/src/include/languages.h b/src/include/languages.h index 00190b3..66b6522 100644 --- a/src/include/languages.h +++ b/src/include/languages.h @@ -61,6 +61,7 @@ typedef struct _LANGUAGE_INFO { priority = LANGAUGE_PRIORITY_NONE; is_latin_language = false; accepts_caps_mode = false; + load_in_ime = false; } /* Indicates whether this language was enabled in option window's language selection list */ sclboolean enabled; @@ -91,6 +92,7 @@ typedef struct _LANGUAGE_INFO { sclboolean is_latin_language; /* If this language accepts caps mode, try to handle AutoCapitalization option */ sclboolean accepts_caps_mode; + sclboolean load_in_ime; } LANGUAGE_INFO; diff --git a/src/ise-dbus.cpp b/src/ise-dbus.cpp index fcd4470..06260bb 100644 --- a/src/ise-dbus.cpp +++ b/src/ise-dbus.cpp @@ -17,6 +17,7 @@ #include <dlog.h> #include <inputmethod.h> #include <inputmethod_internal.h> +#include <pkgmgr-info.h> #include "ise-dbus.h" @@ -43,6 +44,11 @@ static bool _dbus_init() GError *error = NULL; int watch_id = 0; + if (!dbus_info) { + LOGW("dbus info is not allocated."); + return false; + } + if (dbus_info->gdbus_connection == NULL) { GDBusConnection *conn = NULL; conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); @@ -104,18 +110,20 @@ static void _handle_engine_loader_cb(GDBusConnection *connection, while (g_variant_iter_loop (attr_iter, "(v)", &iter_body)) { g_variant_get(iter_body, "(uuuu)", &start, &length, &type, &value); attr = (ime_preedit_attribute *)calloc(1, sizeof(ime_preedit_attribute)); - attr->start = start; - attr->length = length; - attr->type = (ime_attribute_type)type; - attr->value = value; - list = eina_list_append(list, attr); + if (attr) { + attr->start = start; + attr->length = length; + attr->type = (ime_attribute_type)type; + attr->value = value; + list = eina_list_append(list, attr); + } } int ret = ime_update_preedit_string(preedit_string, list); if (ret != IME_ERROR_NONE) { - EINA_LIST_FREE(list, attr) - free(attr); - } + EINA_LIST_FREE(list, attr) + free(attr); + } } else if (g_strcmp0(signal_name, "hide_preedit_string") == 0) { int ret = ime_hide_preedit_string(); if (ret != IME_ERROR_NONE) @@ -388,7 +396,7 @@ static void _handle_engine_loader_cb(GDBusConnection *connection, static bool _dbus_signal_init() { - if (dbus_info->monitor_id == 0) { + if (dbus_info && dbus_info->monitor_id == 0) { int id = g_dbus_connection_signal_subscribe(dbus_info->gdbus_connection, ENGINE_LOADER_DBUS_NAME, ENGINE_LOADER_ISE_INTERFACE_NAME, @@ -410,7 +418,7 @@ static bool _dbus_signal_init() return true; } -static GDBusMessage *_get_gbus_message(GVariant *body, const char *cmd) +static GDBusMessage *_get_gdbus_message(GVariant *body, const char *cmd) { GDBusMessage *message = NULL; message = g_dbus_message_new_method_call( @@ -468,7 +476,7 @@ static bool _send_sync_message(GDBusConnection *gdbus_connection, GVariant *body bool ret = false; GDBusMessage *msg = NULL; - msg = _get_gbus_message(body, cmd); + msg = _get_gdbus_message(body, cmd); if (msg == NULL) return false; @@ -485,7 +493,7 @@ static bool _send_async_message(GDBusConnection *gdbus_connection, GVariant *bod GDBusMessage *msg = NULL; GError *err = NULL; - msg = _get_gbus_message(body, cmd); + msg = _get_gdbus_message(body, cmd); if (msg == NULL) return false; @@ -509,6 +517,11 @@ static bool _monitor_register(GDBusConnection *gdbus_connection) GDBusMessage *reply = NULL; GVariant *reply_body = NULL; + if (!dbus_info) { + LOGW("dbus info is not allocated."); + return false; + } + ret = _send_sync_message(gdbus_connection, g_variant_new("()"), &reply, "loader_service_register"); if (!ret) { LOGE("_send_sync_message() failed"); @@ -531,8 +544,13 @@ static void _on_name_appeared(GDBusConnection *connection, const gchar *name_owner, gpointer user_data) { + if (!dbus_info) { + LOGW("dbus info is not allocated."); + return; + } + if (!is_server_started) { - dbus_info->server_watcher_id = (int)user_data; + dbus_info->server_watcher_id = (intptr_t)user_data; _monitor_register(connection); } } @@ -580,7 +598,7 @@ bool engine_loader_dbus_init(void *data) G_BUS_NAME_WATCHER_FLAGS_NONE, _on_name_appeared, _on_name_vanished, - (void *)dbus_info->server_watcher_id, + (void *)((intptr_t)dbus_info->server_watcher_id), NULL); if (dbus_info->server_monitor_id == 0) { @@ -606,35 +624,44 @@ cleanup: bool engine_loader_dbus_shutdown() { - bool ret; + bool ret = false; - if (dbus_info->server_watcher_id) { - ret = _send_async_message(dbus_info->gdbus_connection, g_variant_new("(i)", dbus_info->server_watcher_id), "loader_service_unregister"); - if (!ret) { - LOGE("Failed to unregister client"); - return ret; + if (dbus_info) { + if (dbus_info->server_watcher_id) { + ret = _send_async_message(dbus_info->gdbus_connection, g_variant_new("(i)", dbus_info->server_watcher_id), "loader_service_unregister"); + if (!ret) { + LOGE("Failed to unregister client"); + return ret; + } } - } - if (dbus_info->server_monitor_id) - g_bus_unwatch_name(dbus_info->server_monitor_id); + if (dbus_info->server_monitor_id) + g_bus_unwatch_name(dbus_info->server_monitor_id); - if (dbus_info->monitor_id) - g_dbus_connection_signal_unsubscribe(dbus_info->gdbus_connection, dbus_info->monitor_id); + if (dbus_info->monitor_id) + g_dbus_connection_signal_unsubscribe(dbus_info->gdbus_connection, dbus_info->monitor_id); - free(dbus_info); + free(dbus_info); + } dbus_info = NULL; return true; } -void engine_loader_set_imengine(const char *engine_id) +void engine_loader_set_imengine(const char *engine_id, const char *module_name) { GDBusMessage *reply = NULL; GVariant *reply_body = NULL; - bool result; + bool result = false; + + LOGD("engine id : %s, module name : %s", engine_id, module_name); + + if (!dbus_info) { + LOGW("dbus info is not allocated."); + return; + } - if (_send_sync_message(dbus_info->gdbus_connection, g_variant_new("(s)", engine_id), &reply, "set_imengine")) { + if (_send_sync_message(dbus_info->gdbus_connection, g_variant_new("(ss)", engine_id, module_name), &reply, "set_imengine")) { reply_body = g_dbus_message_get_body(reply); g_variant_get(reply_body, "(b)", &result); } @@ -648,29 +675,34 @@ void engine_loader_set_imengine(const char *engine_id) void engine_loader_flush_imengine() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "flush_imengine")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "flush_imengine")) LOGE("Failed to flush imengine"); } void engine_loader_reset_imengine() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "reset_imengine")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "reset_imengine")) LOGE("Failed to reset imengine"); } void engine_loader_send_imengine_event(int command, uint32_t value) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(iu)", command, value), "send_imengine_event")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(iu)", command, value), "send_imengine_event")) LOGE("Failed to send imengine event"); } bool engine_loader_process_key_event(scim::KeyEvent& key) { - bool result; + bool result = false; GDBusMessage *reply = NULL; GVariant *reply_body = NULL; GVariantBuilder *key_event_builder = NULL; + if (!dbus_info) { + LOGW("dbus info is not allocated."); + return false; + } + key_event_builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); g_variant_builder_add(key_event_builder, "{sv}", "key_code", g_variant_new_uint32(key.code)); g_variant_builder_add(key_event_builder, "{sv}", "key_mask", g_variant_new_uint16(key.mask)); @@ -693,109 +725,109 @@ bool engine_loader_process_key_event(scim::KeyEvent& key) void engine_loader_focus_in() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "focus_in")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "focus_in")) LOGE("Failed to send focus_in event"); } void engine_loader_focus_out() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "focus_out")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "focus_out")) LOGE("Failed to send focus_out event"); } void engine_loader_update_cursor_position(int cursor_pos) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(i)", cursor_pos), "update_cursor_position")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(i)", cursor_pos), "update_cursor_position")) LOGE("Failed to update cursor position"); } void engine_loader_set_autocapital_type(uint32_t type) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", type), "set_autocapital_type")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", type), "set_autocapital_type")) LOGE("Failed to send autocapital type"); } void engine_loader_set_prediction_allow(uint32_t prediction_allow) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", prediction_allow), "set_prediction_allow")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", prediction_allow), "set_prediction_allow")) LOGE("Failed to send prediction allow"); } void engine_loader_reset_input_context() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "reset_input_context")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "reset_input_context")) LOGE("Failed to reset input context"); } void engine_loader_set_layout(uint32_t layout) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", layout), "set_layout")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", layout), "set_layout")) LOGE("Failed to set layout"); } void engine_loader_set_imdata(const char *imdata, uint32_t len) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(su)", imdata, len), "set_imdata")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(su)", imdata, len), "set_imdata")) LOGE("Failed to set imdata"); } void engine_loader_set_input_hint(uint32_t input_hint) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", input_hint), "set_input_hint")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", input_hint), "set_input_hint")) LOGE("Failed to set input hint"); } void engine_loader_update_bidi_direction(uint32_t direction) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", direction), "update_bidi_direction")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", direction), "update_bidi_direction")) LOGE("Failed to update bidi direction"); } void engine_loader_trigger_property(const char *property) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(s)", property), "trigger_property")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(s)", property), "trigger_property")) LOGE("Failed to send trigger property"); } void engine_loader_show_candidate_more_window() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "show_candidate_more_window")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "show_candidate_more_window")) LOGE("Failed to show candidate more window"); } void engine_loader_hide_candidate_more_window() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "hide_candidate_more_window")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "hide_candidate_more_window")) LOGE("Failed to hide candidate more window"); } void engine_loader_select_aux(uint32_t item) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", item), "select_aux")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", item), "select_aux")) LOGE("Failed to select aux"); } void engine_loader_select_candidate(uint32_t item) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", item), "select_candidate")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", item), "select_candidate")) LOGE("Failed to select candidate"); } void engine_loader_candidate_table_page_up() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "candidate_table_page_up")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "candidate_table_page_up")) LOGE("Failed to page up the candidate table"); } void engine_loader_candidate_table_page_down() { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "candidate_table_page_down")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("()"), "candidate_table_page_down")) LOGE("Failed to page down the candidate table"); } void engine_loader_change_candidate_page_size(uint32_t size) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", size), "change_candidate_page_size")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", size), "change_candidate_page_size")) LOGE("Failed to change candidate page size"); } @@ -808,6 +840,11 @@ void engine_loader_set_candidate_item_layout(std::vector<uint32_t> item) GVariant *body = NULL; std::vector<uint32_t>::iterator it; + if (!dbus_info) { + LOGW("dbus info is not allocated."); + return; + } + item_builder = g_variant_builder_new(G_VARIANT_TYPE("a(v)")); for (it = item.begin(); it != item.end(); ++it) { body = g_variant_new("(u)", *it); @@ -830,12 +867,12 @@ void engine_loader_set_candidate_item_layout(std::vector<uint32_t> item) void engine_loader_change_candidate_number(uint32_t page_num) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", page_num), "change_candidate_number")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", page_num), "change_candidate_number")) LOGE("Failed to change candidate number"); } void engine_loader_long_press_candidate_item(uint32_t index) { - if (!_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", index), "long_press_candidate_item")) + if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", index), "long_press_candidate_item")) LOGE("Failed to send long pressed item"); -}
\ No newline at end of file +} diff --git a/src/ise.cpp b/src/ise.cpp index 56d6df2..6543966 100644 --- a/src/ise.cpp +++ b/src/ise.cpp @@ -145,12 +145,16 @@ static sclu32 _context_layout_variation = 0; Candidate *g_candidate = NULL; +static ISELanguageManager _language_manager; + class CandidateEventListener: public EventListener { public: void on_event(const EventDesc &desc) { const MultiEventDesc &multidesc = dynamic_cast<const MultiEventDesc &>(desc); + LANGUAGE_INFO *info = _language_manager.get_language_info(_language_manager.get_current_language()); + switch (multidesc.type) { case MultiEventDesc::CANDIDATE_ITEM_MOUSE_DOWN: if (g_autofill_exist) { @@ -163,13 +167,20 @@ class CandidateEventListener: public EventListener } else if (multidesc.index < (int)g_smartreply_size + 1) { ise_send_string(g_softcandidate_string[multidesc.index].c_str()); } else { - engine_loader_select_candidate(multidesc.index - g_smartreply_size - 1); + if (info && info->load_in_ime) + ime_select_candidate(multidesc.index - g_smartreply_size - 1); + else + engine_loader_select_candidate(multidesc.index - g_smartreply_size - 1); } } else { if (multidesc.index < (int)g_smartreply_size) ise_send_string(g_softcandidate_string[multidesc.index].c_str()); - else - engine_loader_select_candidate(multidesc.index - g_smartreply_size); + else { + if (info && info->load_in_ime) + ime_select_candidate(multidesc.index - g_smartreply_size); + else + engine_loader_select_candidate(multidesc.index - g_smartreply_size); + } } break; case MultiEventDesc::CANDIDATE_MORE_VIEW_SHOW: @@ -194,7 +205,6 @@ class CandidateEventListener: public EventListener }; static CandidateEventListener g_candidate_event_listener; -static ISELanguageManager _language_manager; #define MVK_Shift_L 0xffe1 #define MVK_Caps_Lock 0xffe5 #define MVK_Shift_Off 0xffe1 @@ -618,10 +628,18 @@ on_input_mode_changed(const sclchar *key_value, sclulong key_event, sclint key_t LANGUAGE_INFO *info = _language_manager.get_language_info(cur_lang); if (info) { if (info->accepts_caps_mode) { - engine_loader_send_imengine_event(MVK_Shift_Enable, 0); + if (info->load_in_ime) + ime_send_imengine_event(MVK_Shift_Enable, 0); + else + engine_loader_send_imengine_event(MVK_Shift_Enable, 0); + set_caps_mode(g_keyboard_state.caps_mode); } else { - engine_loader_send_imengine_event(MVK_Shift_Disable, 0); + if (info->load_in_ime) + ime_send_imengine_event(MVK_Shift_Disable, 0); + else + engine_loader_send_imengine_event(MVK_Shift_Disable, 0); + g_ui->set_shift_state(SCL_SHIFT_STATE_OFF); } } @@ -685,11 +703,20 @@ SCLEventReturnType CUIEventCallback::on_event_notification(SCLUINotiType noti_ty if (info->accepts_caps_mode) { LOGD("shift state: %d\n", desc->shift_state); if (desc->shift_state == SCL_SHIFT_STATE_OFF) { - engine_loader_send_imengine_event(MVK_Shift_Off, 0); + if (info->load_in_ime) + ime_send_imengine_event(MVK_Shift_Off, 0); + else + engine_loader_send_imengine_event(MVK_Shift_Off, 0); } else if (desc->shift_state == SCL_SHIFT_STATE_ON) { - engine_loader_send_imengine_event(MVK_Shift_On, 0); + if (info->load_in_ime) + ime_send_imengine_event(MVK_Shift_On, 0); + else + engine_loader_send_imengine_event(MVK_Shift_On, 0); } else if (desc->shift_state == SCL_SHIFT_STATE_LOCK) { - engine_loader_send_imengine_event(MVK_Shift_Lock, 0); + if (info->load_in_ime) + ime_send_imengine_event(MVK_Shift_Lock, 0); + else + engine_loader_send_imengine_event(MVK_Shift_Lock, 0); } ret = SCL_EVENT_PASS_ON; } @@ -1412,10 +1439,11 @@ ise_show(int ic) if (ic == g_keyboard_state.focused_ic) { if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER || - g_keyboard_state.layout == ISE_LAYOUT_STYLE_IP || - g_keyboard_state.layout == ISE_LAYOUT_STYLE_MONTH || - g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY) { - engine_loader_set_imengine(DEFAULT_KEYBOARD_ISE_UUID); + g_keyboard_state.layout == ISE_LAYOUT_STYLE_IP || + g_keyboard_state.layout == ISE_LAYOUT_STYLE_MONTH || + g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY) { + ime_set_engine_loader_flag(true); + engine_loader_set_imengine(DEFAULT_KEYBOARD_ISE_UUID, DEFAULT_KEYBOARD_ISE_PKGID); } } @@ -3084,7 +3112,7 @@ static void ime_app_candidate_table_page_size_chaned_cb(uint32_t size, void *use static void ime_app_candidate_item_layout_set_cb(vector<uint32_t> item, void *user_data) { - LOGD("item layout size : %d", item.size()); + LOGD("item layout size : %zu", item.size()); engine_loader_set_candidate_item_layout(item); } diff --git a/src/sdk/ise_lang_table.cpp b/src/sdk/ise_lang_table.cpp index f6e8f50..eaee35b 100644 --- a/src/sdk/ise_lang_table.cpp +++ b/src/sdk/ise_lang_table.cpp @@ -264,6 +264,7 @@ ISELangTableMgr::parse_lang_table(const xmlNodePtr p_node) { m_table[m_size].flush_command = get_prop_int(cur_node, "flush_command"); m_table[m_size].is_latin_language = get_prop_bool(cur_node, "is_latin_language"); m_table[m_size].accepts_caps_mode = get_prop_bool(cur_node, "accepts_caps_mode"); + m_table[m_size].load_in_ime = get_prop_bool(cur_node, "load_in_ime"); m_size++; } diff --git a/src/sdk/ise_lang_table.h b/src/sdk/ise_lang_table.h index 945186d..1327e42 100644 --- a/src/sdk/ise_lang_table.h +++ b/src/sdk/ise_lang_table.h @@ -38,6 +38,7 @@ typedef struct ISE_LANG_TABLE { flush_command = 0; is_latin_language = false; accepts_caps_mode = false; + load_in_ime = false; } /* This is the string ID of this language, used in ISE side. For example, ISE developer can use this string to select this language, by passing "Korean" to ISELanguageManager::select_language() function */ char *language; @@ -78,6 +79,7 @@ typedef struct ISE_LANG_TABLE { bool is_latin_language; /* If this language accepts caps mode, try to handle AutoCapitalization option */ bool accepts_caps_mode; + bool load_in_ime; } ISE_LANG_TABLE; typedef struct Keyboard_UUID { diff --git a/src/sdk/sdk.cpp b/src/sdk/sdk.cpp index 88aee26..ee3ecf0 100644 --- a/src/sdk/sdk.cpp +++ b/src/sdk/sdk.cpp @@ -19,6 +19,7 @@ #include <iconv.h> #include <inputmethod.h> #include <inputmethod_internal.h> +#include <pkgmgr-info.h> #include "ise.h" #include "sdk.h" @@ -78,6 +79,7 @@ public : language.resource_file = MAIN_ENTRY_XML_PATH; language.is_latin_language = table[loop].is_latin_language; language.accepts_caps_mode = table[loop].accepts_caps_mode; + language.load_in_ime = table[loop].load_in_ime; /* These variable should be read from stored setting values */ language.enabled = FALSE; @@ -263,15 +265,26 @@ SCLEventReturnType CSDKISE::on_event_key_clicked(SclUIEventDesc event_desc) { SCLEventReturnType ret = SCL_EVENT_PASS_ON; const sclchar *cur_lang = _language_manager.get_current_language(); - if (event_desc.key_modifier == KEY_MODIFIER_LONGKEY) - engine_loader_flush_imengine(); + LANGUAGE_INFO *info = NULL; + if (cur_lang) + info = _language_manager.get_language_info(cur_lang); + if (event_desc.key_modifier == KEY_MODIFIER_LONGKEY) { + if (info && info->load_in_ime) + ime_flush_imengine(); + else + engine_loader_flush_imengine(); + } switch (event_desc.key_type) { case KEY_TYPE_CHAR: ret = process_key_type_char(event_desc); break; case KEY_TYPE_STRING: - engine_loader_flush_imengine(); + if (info && info->load_in_ime) + ime_flush_imengine(); + else + engine_loader_flush_imengine(); + if (cur_lang && strcmp(cur_lang, "Korean") == 0) { process_korean_automata(false, SIPKEY_ERROR); } @@ -282,7 +295,11 @@ SCLEventReturnType CSDKISE::on_event_key_clicked(SclUIEventDesc event_desc) break; case KEY_TYPE_MODECHANGE: { - engine_loader_flush_imengine(); + if (info && info->load_in_ime) + ime_flush_imengine(); + else + engine_loader_flush_imengine(); + if (cur_lang && strcmp(cur_lang, "Korean") == 0) { process_korean_automata(false, SIPKEY_ERROR); } @@ -302,14 +319,20 @@ SCLEventReturnType CSDKISE::on_event_key_clicked(SclUIEventDesc event_desc) } else if (event_desc.key_event == MVK_space) { if (_language_manager.get_enabled_languages_num() > 1) { if (event_desc.key_modifier == KEY_MODIFIER_DIRECTION_LEFT) { - engine_loader_flush_imengine(); + if (info && info->load_in_ime) + ime_flush_imengine(); + else + engine_loader_flush_imengine(); /* If flick event upon space key was detected, perform a language change and don't proceed anymore */ _language_manager.select_previous_language(); g_keyboard_state.disable_force_latin = TRUE; ret = SCL_EVENT_DONE; } else if (event_desc.key_modifier == KEY_MODIFIER_DIRECTION_RIGHT) { - engine_loader_flush_imengine(); + if (info && info->load_in_ime) + ime_flush_imengine(); + else + engine_loader_flush_imengine(); /* If flick event upon space key was detected, perform a language change and don't proceed anymore */ _language_manager.select_next_language(); @@ -390,7 +413,35 @@ sclboolean CSDKISE::on_language_selected(const sclchar *language, const sclchar if (strcmp(language, table[loop].language) == 0) { if (g_ui) { if (table[loop].keyboard_ise_uuid) { - engine_loader_set_imengine(table[loop].keyboard_ise_uuid); + int ret = 0; + char *pkgid = NULL; + pkgmgrinfo_appinfo_h handle; + ret = pkgmgrinfo_appinfo_get_appinfo(table[loop].keyboard_ise_uuid, &handle); + if (ret == PMINFO_R_OK) { + ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid); + if (ret == PMINFO_R_OK) { + if (table[loop].load_in_ime) { + engine_loader_set_imengine(DEFAULT_KEYBOARD_ISE_UUID, DEFAULT_KEYBOARD_ISE_PKGID); + ime_set_engine_loader_flag(false); + ime_set_imengine(table[loop].keyboard_ise_uuid); + } + else { + ime_set_imengine(DEFAULT_KEYBOARD_ISE_UUID); + ime_set_engine_loader_flag(true); + engine_loader_set_imengine(table[loop].keyboard_ise_uuid, pkgid); + } + } + else { + LOGE("Retrieve pkgid failed : %s, %p", table[loop].keyboard_ise_uuid, handle); + } + + pkgmgrinfo_appinfo_destroy_appinfo(handle); + } + else { + LOGE("Retrieve app info failed : %s", table[loop].keyboard_ise_uuid); + } + + handle = NULL; /* g_core.send_imengine_event(-1, table[loop].keyboard_ise_uuid, table[loop].language_command, table[loop].language_code); @@ -408,11 +459,18 @@ sclboolean CSDKISE::on_language_selected(const sclchar *language, const sclchar if (info->accepts_caps_mode) { if (g_keyboard_state.caps_mode) { g_ui->set_shift_state(SCL_SHIFT_STATE_ON); - engine_loader_send_imengine_event(MVK_Shift_On, 0); + if (table[loop].load_in_ime) + ime_send_imengine_event(MVK_Shift_On, 0); + else + engine_loader_send_imengine_event(MVK_Shift_On, 0); g_keyboard_state.caps_mode = TRUE; } else { g_ui->set_shift_state(SCL_SHIFT_STATE_OFF); - engine_loader_send_imengine_event(MVK_Shift_Off, 0); + if (table[loop].load_in_ime) + ime_send_imengine_event(MVK_Shift_Off, 0); + else + engine_loader_send_imengine_event(MVK_Shift_Off, 0); + g_keyboard_state.caps_mode = FALSE; } } else { @@ -553,7 +611,11 @@ sclboolean CSDKISE::flush_imengine(const sclchar *language) */ bRet = true; } else { - engine_loader_reset_imengine(); + if (table[lang_id].load_in_ime) + ime_reset_imengine(); + else + engine_loader_reset_imengine(); + bRet = true; } } |