Modified not to handle events from invalid engine 21/249021/2
authorInHong Han <inhong1.han@samsung.com>
Fri, 4 Dec 2020 08:43:03 +0000 (17:43 +0900)
committerInHong Han <inhong1.han@samsung.com>
Mon, 7 Dec 2020 02:15:27 +0000 (11:15 +0900)
Change-Id: I3c8f8bd7251ae30ee5373e4e36417b4d4986917e

src/ise-dbus.cpp
src/ise.cpp
src/sdk/sdk.cpp

index 2779d92..29e6665 100644 (file)
@@ -28,6 +28,7 @@
 
 static bool is_server_started = false;
 static engine_loader_dbus_info_s *dbus_info = NULL;
+static ISELanguageManager _language_manager;
 
 static void _server_appeared_cb(GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data)
 {
@@ -88,6 +89,13 @@ static void _handle_engine_loader_cb(GDBusConnection *connection,
 {
     LOGD("own_name : %s, signal_name : %s", g_dbus_connection_get_unique_name(connection), signal_name);
 
+    const sclchar *cur_lang = _language_manager.get_current_language();
+    if (cur_lang) {
+        LANGUAGE_INFO *info = _language_manager.get_language_info(cur_lang);
+        if (info && info->load_in_ime)
+            return;
+    }
+
     if (g_strcmp0(signal_name, "show_preedit_string") == 0) {
         int ret = ime_show_preedit_string();
         if (ret != IME_ERROR_NONE)
index 1ad851d..ca4d508 100644 (file)
@@ -335,7 +335,18 @@ static void set_caps_mode(sclboolean mode) {
             g_ui->set_shift_state(mode ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF);
             g_ui->set_autocapital_shift_state(!mode);
 
-            engine_loader_send_imengine_event(mode ? MVK_Shift_On : MVK_Shift_Off, 0);
+            bool load_in_ime = false;
+            const sclchar *cur_lang = _language_manager.get_current_language();
+            if (cur_lang) {
+                LANGUAGE_INFO *info = _language_manager.get_language_info(cur_lang);
+                if (info)
+                    load_in_ime = info->load_in_ime;
+            }
+
+            if (load_in_ime)
+                ime_send_imengine_event(mode ? MVK_Shift_On : MVK_Shift_Off, 0);
+            else
+                engine_loader_send_imengine_event(mode ? MVK_Shift_On : MVK_Shift_Off, 0);
         }
     }
 }
@@ -1138,12 +1149,26 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                     g_need_send_shift_event = TRUE;
                     //ise_send_event (MVK_Shift_Lock, KEY_MASK_NULL);
                 } else if (strncmp(event_desc.key_value, caps_lock, strlen(caps_lock)) == 0) {
+                    bool load_in_ime = false;
+                    const sclchar *cur_lang = _language_manager.get_current_language();
+                    if (cur_lang) {
+                        LANGUAGE_INFO *info = _language_manager.get_language_info(cur_lang);
+                        if (info)
+                            load_in_ime = info->load_in_ime;
+                    }
+
                     if (g_ui->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
                         g_ui->set_shift_state(SCL_SHIFT_STATE_LOCK);
-                        engine_loader_send_imengine_event(MVK_Shift_Lock, 0);
+                        if (load_in_ime)
+                            ime_send_imengine_event(MVK_Shift_Lock, 0);
+                        else
+                            engine_loader_send_imengine_event(MVK_Shift_Lock, 0);
                     } else {
                         g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
-                        engine_loader_send_imengine_event(MVK_Shift_Off, 0);
+                        if (load_in_ime)
+                            ime_send_imengine_event(MVK_Shift_Off, 0);
+                        else
+                            engine_loader_send_imengine_event(MVK_Shift_Off, 0);
                     }
                     //g_need_send_shift_event = TRUE;
                 } else if (strncmp(event_desc.key_value, delete_all, strlen(delete_all)) == 0) {
index 069f646..bc0f188 100644 (file)
@@ -422,7 +422,7 @@ sclboolean CSDKISE::on_language_selected(const sclchar *language, const sclchar
                             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_hide_lookup_table();
                                     ime_set_engine_loader_flag(false);
                                     ime_set_imengine(table[loop].keyboard_ise_uuid);
                                 }