Check the result of getting input mode 57/178957/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 15 May 2018 05:23:14 +0000 (14:23 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 15 May 2018 06:01:51 +0000 (15:01 +0900)
Change-Id: Ic44699b6de70f239b4e8302501e5d37a726df497
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/ise-stt-mode.cpp
src/ise.cpp

index eec5aed..eeaa5c8 100644 (file)
@@ -709,11 +709,14 @@ Evas_Object *create_fullview(Evas_Object *win, VoiceData *r_voicedata)
 
     SCLDisplayMode display_mode = g_ui->get_display_mode();
     if (display_mode >= 0 && display_mode < DISPLAYMODE_MAX) {
-        SclSize rect = g_ui->get_input_mode_size(g_ui->get_input_mode(), display_mode);
-        if (g_config_values.floating_mode)
-            evas_object_resize(layout_main, rect.width * FLOATING_SCALE_RATE, rect.height * FLOATING_SCALE_RATE);
-        else
-            evas_object_resize(layout_main, rect.width, rect.height);
+        const char *input_mode = g_ui->get_input_mode();
+        if (input_mode) {
+            SclSize rect = g_ui->get_input_mode_size(input_mode, display_mode);
+            if (g_config_values.floating_mode)
+                evas_object_resize(layout_main, rect.width * FLOATING_SCALE_RATE, rect.height * FLOATING_SCALE_RATE);
+            else
+                evas_object_resize(layout_main, rect.width, rect.height);
+        }
     }
 
     evas_object_layer_set(layout_main, 32000);
index d6c4cff..3cc7af0 100644 (file)
@@ -723,13 +723,16 @@ SCLEventReturnType CUIEventCallback::on_event_notification(SCLUINotiType noti_ty
         if (desc && g_ui) {
             set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_NONE);
 
-            if (strcmp(g_ui->get_input_mode(), "STT_3X4") == 0 &&
-                strcmp(desc->input_mode, "STT_3X4") != 0) {
-                ise_hide_stt_mode();
-            }
-            if (strcmp(g_ui->get_input_mode(), "STT_3X4") != 0 &&
-                strcmp(desc->input_mode, "STT_3X4") == 0) {
-                ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
+            const char *input_mode = g_ui->get_input_mode();
+            if (input_mode) {
+                if (strcmp(input_mode, "STT_3X4") == 0 &&
+                        strcmp(desc->input_mode, "STT_3X4") != 0) {
+                    ise_hide_stt_mode();
+                }
+                if (strcmp(input_mode, "STT_3X4") != 0 &&
+                        strcmp(desc->input_mode, "STT_3X4") == 0) {
+                    ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
+                }
             }
         }
     }
@@ -1183,7 +1186,8 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                 ret = SCL_EVENT_DONE;
             } else if (strcmp(event_desc.key_value, "Cancel") == 0) {
                 ret = SCL_EVENT_DONE;
-                if (strcmp(g_ui->get_input_mode(), "STT_3X4") == 0 ) {
+                const sclchar *input_mode = g_ui->get_input_mode();
+                if (input_mode && strcmp(input_mode, "STT_3X4") == 0 ) {
                     g_keyboard_state.need_reset = TRUE;
                     voice_result_string_flush();
                     ise_set_layout(g_keyboard_state.layout, g_keyboard_state.layout_variation);
@@ -1386,10 +1390,12 @@ ise_show(int ic)
             }
         }
 
+        const char *input_mode = g_ui->get_input_mode();
+
         /* Reset input mode if the input context value has changed */
         if (ic != g_keyboard_state.ic) {
             /* Do not reset input mode if STT's setting window was opened */
-            if (g_setting_window_open_status && strcmp(g_ui->get_input_mode(), "STT_3X4") == 0) {
+            if (g_setting_window_open_status && input_mode && strcmp(input_mode, "STT_3X4") == 0) {
                 LOGD("Setting window was opened while using STT, skip resetting input mode");
             } else {
                 reset_inputmode = TRUE;
@@ -1407,7 +1413,7 @@ ise_show(int ic)
         /* No matter what, just reset the inputmode if it needs to */
         if (g_keyboard_state.need_reset) {
             /* Do not reset input mode if STT's setting window was opened */
-            if (g_setting_window_open_status && strcmp(g_ui->get_input_mode(), "STT_3X4") == 0) {
+            if (g_setting_window_open_status && input_mode && strcmp(input_mode, "STT_3X4") == 0) {
                 LOGD("Setting window was opened while using STT, skip resetting input mode");
             } else {
                 reset_inputmode = TRUE;
@@ -1703,10 +1709,12 @@ ise_hide()
     _reset_multitap_state(true);
 
     /* If we were in STT mode, try to reset input mode on our next show event */
-    const char *inputmode = (g_ui ? g_ui->get_input_mode() : NULL);
-    if (g_ui && inputmode && strcmp(inputmode, "STT_3X4") == 0 ) {
-        g_keyboard_state.need_reset = TRUE;
-        ise_hide_stt_mode();
+    if (g_ui) {
+        const char *inputmode = g_ui->get_input_mode();
+        if (inputmode && strcmp(inputmode, "STT_3X4") == 0 ) {
+            g_keyboard_state.need_reset = TRUE;
+            ise_hide_stt_mode();
+        }
     }
 
     g_input_panel_show = false;
@@ -2331,8 +2339,12 @@ static void set_ime_size(bool floating_mode, ISE_CANDIDATE_REQUEST candidate_req
     if (!g_ui)
         return;
 
-    SclSize size_portrait = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_PORTRAIT);
-    SclSize size_landscape = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_LANDSCAPE);
+    const char *input_mode = g_ui->get_input_mode();
+    if (!input_mode)
+        return;
+
+    SclSize size_portrait = g_ui->get_input_mode_size(input_mode, DISPLAYMODE_PORTRAIT);
+    SclSize size_landscape = g_ui->get_input_mode_size(input_mode, DISPLAYMODE_LANDSCAPE);
 
     if (floating_mode) {
         size_portrait.width *= FLOATING_SCALE_RATE;