From 43873db157ba4a1b57dd821812544eae74312344 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 27 Jul 2020 15:51:12 +0900 Subject: [PATCH] Send module name of keyboard Engine Change-Id: I744970c31df4e485e941c448450357bd3b338c1d Signed-off-by: Jihoon Kim --- CMakeLists.txt | 1 + packaging/ise-default.spec | 1 + src/include/ise-dbus.h | 2 +- src/include/ise.h | 1 + src/ise-dbus.cpp | 9 +++++---- src/ise.cpp | 9 +++++---- src/sdk/sdk.cpp | 21 ++++++++++++++++++++- 7 files changed, 34 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f50d646..0ce650f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,7 @@ SET(PKGS_CHECK_MODULES glib-2.0 dbus-1 gio-2.0 + pkgmgr-info ) IF (with_cbhm) diff --git a/packaging/ise-default.spec b/packaging/ise-default.spec index 5f5b11c..04dcf86 100644 --- a/packaging/ise-default.spec +++ b/packaging/ise-default.spec @@ -27,6 +27,7 @@ BuildRequires: pkgconfig(ode) BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(pkgmgr-info) # This is for old profile-based OBS project optimizations. # In 4.0 unified build env, this if statement is always true. 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 8cd9db0..02e38f0 100644 --- a/src/include/ise.h +++ b/src/include/ise.h @@ -39,6 +39,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/ise-dbus.cpp b/src/ise-dbus.cpp index 4b6ce7c..fd2186e 100644 --- a/src/ise-dbus.cpp +++ b/src/ise-dbus.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "ise-dbus.h" @@ -628,13 +629,13 @@ bool engine_loader_dbus_shutdown() 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; - 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); } @@ -666,7 +667,7 @@ void engine_loader_send_imengine_event(int command, uint32_t value) 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; diff --git a/src/ise.cpp b/src/ise.cpp index 4a73511..e01508f 100644 --- a/src/ise.cpp +++ b/src/ise.cpp @@ -1412,10 +1412,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) { + + engine_loader_set_imengine(DEFAULT_KEYBOARD_ISE_UUID, DEFAULT_KEYBOARD_ISE_PKGID); } } diff --git a/src/sdk/sdk.cpp b/src/sdk/sdk.cpp index 88aee26..bfd6ea3 100644 --- a/src/sdk/sdk.cpp +++ b/src/sdk/sdk.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "ise.h" #include "sdk.h" @@ -390,7 +391,25 @@ 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) { + engine_loader_set_imengine(table[loop].keyboard_ise_uuid, pkgid); + } + else { + LOGE("Retrieve pkgid failed : %s, %p", table[loop].keyboard_ise_uuid, handle); + } + } + else { + LOGE("Retrieve app info failed : %s", table[loop].keyboard_ise_uuid); + } + + pkgmgrinfo_appinfo_destroy_appinfo(handle); + handle = NULL; /* g_core.send_imengine_event(-1, table[loop].keyboard_ise_uuid, table[loop].language_command, table[loop].language_code); -- 2.7.4