Remove global emoticon list variable 64/249964/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 18 Dec 2020 04:06:47 +0000 (13:06 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 18 Dec 2020 05:08:32 +0000 (14:08 +0900)
Change-Id: I6637da736f650bbd86eb534c948d00b6b988b084
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/imdata.cpp
src/include/ise-emoticon-mode.h
src/include/ise-stt-option.h
src/include/ise.h
src/ise-emoticon-mode.cpp
src/ise-stt-option.cpp
src/ise.cpp

index ac7b0b1..edf9a3c 100644 (file)
@@ -29,7 +29,6 @@
 #define IMDATA_VALUE_DISABLE_EMOTICONS  "disable_emoticons"
 
 static ISELanguageManager _language_manager;
-extern int g_imdata_state;
 
 /* A macro that frees an array returned by eina_str_split() function -
  * We need to free the first element and the pointer itself. */
@@ -44,7 +43,6 @@ static void safe_release_splitted_eina_str(char **string_array)
     }
 }
 
-
 static void process_imdata_string_language(const char *language_string)
 {
     bool found = FALSE;
@@ -81,7 +79,7 @@ void set_ise_imdata(const char * buf, size_t &len)
                     } else if (strncmp(keyvalue[0], IMDATA_KEY_ACTION, strlen(IMDATA_KEY_ACTION)) == 0) {
                         if (keyvalue[1] != NULL) {
                             if (strncmp(keyvalue[1], IMDATA_VALUE_DISABLE_EMOTICONS, strlen(IMDATA_VALUE_DISABLE_EMOTICONS)) == 0) {  /* Hide Emoticon CM key */
-                                g_imdata_state = g_imdata_state | IMDATA_ACTION_DISABLE_EMOTICONS;
+                                ise_set_imdata_state(ise_get_imdata_state() | IMDATA_ACTION_DISABLE_EMOTICONS);
                             }
                         }
                     }
index f47cc0c..e2a82ac 100644 (file)
@@ -19,6 +19,7 @@
 #define ISE_EMOTICON_MODE_H_
 
 #include "ise-floating-mode.h"
+#include <stdlib.h>
 
 #ifdef SUPPORTS_EMOTICONS
 
@@ -61,7 +62,6 @@ enum emoticon_group_t
 };
 #endif
 
-
 void ise_show_emoticon_layout(emoticon_group_t emoticon_group, const int screen_degree, const bool is_candidate_on, void *main_window);
 void ise_change_emoticon_mode(emoticon_group_t emoticon_group);
 void ise_destroy_emoticon_layout(void);
@@ -70,6 +70,10 @@ bool is_emoticon_show(void);
 emoticon_group_t ise_get_emoticon_group_id(const char *group_name);
 const char *ise_get_emoticon_group_name(int id);
 void ise_set_private_key_for_emoticon_mode(const emoticon_group_t emoticon_group);
+size_t get_emoticon_list_recent_size();
+
+emoticon_group_t get_current_emoticon_group();
+void set_current_emoticon_group(emoticon_group_t emoticon_group);
 
 #endif /* SUPPORTS_EMOTICONS */
 #endif /* ISE_EMOTICON_MODE_H_ */
index 16721ee..7dcd8b3 100644 (file)
@@ -62,6 +62,8 @@ void create_setting_window();
 int get_language_value();
 int is_lang_supported_by_stt(char lang[]);
 
+Eina_Bool get_setting_window_open_status();
+void set_setting_window_open_status(Eina_Bool open);
 
 #ifdef __cplusplus
 }
index cec054a..9b009e9 100644 (file)
@@ -196,6 +196,9 @@ KEYBOARD_STATE* get_keyboard_state();
 class Candidate;
 Candidate* get_candidate();
 
+int ise_get_imdata_state();
+void ise_set_imdata_state(int state);
+
 void ise_send_string(const sclchar *key_value);
 void ise_update_preedit_string(const sclchar *str, const sclboolean underline = TRUE);
 void ise_send_event(sclulong key_event, sclulong key_mask);
index 5171513..830f17a 100644 (file)
 #define MAX_SIZE_AMONG_EMOTICON_GROUPS (EMOTICON_GROUP_4_NUM > EMOTICON_GROUP_5_NUM ? (EMOTICON_GROUP_4_NUM > MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS ? EMOTICON_GROUP_4_NUM : MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS) : (EMOTICON_GROUP_5_NUM > MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS ? EMOTICON_GROUP_5_NUM : MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS))
 
 static bool is_emoticon_mode = false;
-emoticon_group_t current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
-std::vector <int> emoticon_list_recent;
+static emoticon_group_t current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
+static std::vector <int> emoticon_list_recent;
 
-extern int * emoticon_list[];
+// extern int * emoticon_list[];
+
+size_t get_emoticon_list_recent_size()
+{
+    return emoticon_list_recent.size();
+}
+
+emoticon_group_t get_current_emoticon_group()
+{
+    return current_emoticon_group;
+}
+
+void set_current_emoticon_group(emoticon_group_t emoticon_group)
+{
+    current_emoticon_group = emoticon_group;
+}
 
 #ifdef _WEARABLE
 static unsigned short int emoticon_group_items[MAX_EMOTICON_GROUP] =
index 051177e..cb35e39 100644 (file)
@@ -124,6 +124,16 @@ static const char* get_lang_label(char lang[])
     return str;
 }
 
+Eina_Bool get_setting_window_open_status()
+{
+    return g_setting_window_open_status;
+}
+
+void set_setting_window_open_status(Eina_Bool open)
+{
+    g_setting_window_open_status = open;
+}
+
 int get_language_value()
 {
     int lang = 0, ret = 0;
index 3ef2834..ef2e91f 100644 (file)
@@ -69,10 +69,7 @@ static sclu32 cbhm_sel_type = 0;
 static sclboolean g_set_mime_type = FALSE;
 #endif
 
-int g_imdata_state = 0;
-
-extern emoticon_group_t current_emoticon_group;
-extern std::vector <int> emoticon_list_recent;
+static int g_imdata_state = 0;
 
 static sclboolean g_need_send_shift_event = FALSE;
 
@@ -111,8 +108,6 @@ static string g_resource_id;
 #define SOFT_CANDIDATE_DELETE_TIME (100.0/1000)
 static Ecore_Timer *g_softcandidate_hide_timer = NULL;
 
-extern sclboolean g_setting_window_open_status;
-
 static int g_ic = 0;
 static int g_ic_smartreply = -1;
 
@@ -260,6 +255,16 @@ public :
 
 static CUIEventCallback callback;
 
+int ise_get_imdata_state()
+{
+    return g_imdata_state;
+}
+
+void ise_set_imdata_state(int state)
+{
+    g_imdata_state = state;
+}
+
 static void update_candidate_table()
 {
     g_softcandidate_string.clear();
@@ -688,15 +693,15 @@ on_input_mode_changed(const sclchar *key_value, sclulong key_event, sclint key_t
             if (!strcmp(key_value, USER_KEYSTRING_EMOTICON)) {
                 ise_init_emoticon_list();
 #ifdef _WEARABLE
-                    current_emoticon_group = EMOTICON_GROUP_1;
+                    set_current_emoticon_group(EMOTICON_GROUP_1);
 #else
-                if (emoticon_list_recent.size() == 0)
-                    current_emoticon_group = EMOTICON_GROUP_1;
+                if (get_emoticon_list_recent_size() == 0)
+                    set_current_emoticon_group(EMOTICON_GROUP_1);
                 else
-                    current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
+                    set_current_emoticon_group(EMOTICON_GROUP_RECENTLY_USED);
 #endif
                 SCLRotation rotation = ui->get_rotation();
-                ise_show_emoticon_layout(current_emoticon_group, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
+                ise_show_emoticon_layout(get_current_emoticon_group(), ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
             }
         }
     }
@@ -1255,7 +1260,7 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
             }
 #endif
             if (strcmp(event_desc.key_value, USER_VOICE_LANGUAGE) == 0) {
-                if (!g_setting_window_open_status) {
+                if (!get_setting_window_open_status()) {
                     ise_hide_stt_mode();
 #ifdef _WEARABLE
                     hide_indicator_window();
@@ -1354,8 +1359,8 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                     }
 #ifdef _WEARABLE
                     emoticon_group_t group_id = EMOTICON_GROUP_1;
-                    if (current_emoticon_group < EMOTICON_GROUP_3)
-                        group_id = (emoticon_group_t)(current_emoticon_group + 1);
+                    if (get_current_emoticon_group() < EMOTICON_GROUP_3)
+                        group_id = (emoticon_group_t)(get_current_emoticon_group() + 1);
 
                     ise_set_emoticon_label(group_id);
 #else
@@ -1559,7 +1564,7 @@ ise_show(int ic)
         /* Reset input mode if the input context value has changed */
         if (ic != keyboard_state->ic) {
             /* Do not reset input mode if STT's setting window was opened */
-            if (g_setting_window_open_status && input_mode && strcmp(input_mode, "STT_3X4") == 0) {
+            if (get_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;
@@ -1577,7 +1582,7 @@ ise_show(int ic)
         /* No matter what, just reset the inputmode if it needs to */
         if (keyboard_state->need_reset) {
             /* Do not reset input mode if STT's setting window was opened */
-            if (g_setting_window_open_status && input_mode && strcmp(input_mode, "STT_3X4") == 0) {
+            if (get_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;
@@ -1669,16 +1674,16 @@ ise_show(int ic)
                 if (keyboard_state->layout == ISE_LAYOUT_STYLE_EMOTICON) {
                     ise_init_emoticon_list();
 #ifdef _WEARABLE
-                    current_emoticon_group = EMOTICON_GROUP_1;
+                    set_current_emoticon_group(EMOTICON_GROUP_1);
                     ise_set_emoticon_label(1);
 #else
-                    if (emoticon_list_recent.size() == 0)
-                        current_emoticon_group = EMOTICON_GROUP_1;
+                    if (get_emoticon_list_recent_size() == 0)
+                        set_current_emoticon_group(EMOTICON_GROUP_1);
                     else
-                        current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
+                        set_current_emoticon_group(EMOTICON_GROUP_RECENTLY_USED);
 #endif
                     SCLRotation rotation = ui->get_rotation();
-                    ise_show_emoticon_layout(current_emoticon_group, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
+                    ise_show_emoticon_layout(get_current_emoticon_group(), ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
                 }
             }
         }
@@ -1817,10 +1822,10 @@ ise_show(int ic)
     }
 #endif
 
-    if (g_setting_window_open_status) {
+    if (get_setting_window_open_status()) {
         ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
     }
-    g_setting_window_open_status = FALSE;
+    set_setting_window_open_status(FALSE);
 
     if (keyboard_state->layout == ISE_LAYOUT_STYLE_VOICE) {
         ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
@@ -2929,12 +2934,12 @@ static void ime_app_rotation_degree_changed_cb(int degree, void *user_data)
         ise_hide_stt_mode();
     }
     if (keyboard_state->layout == ISE_LAYOUT_STYLE_EMOTICON) {
-        ise_show_emoticon_layout(current_emoticon_group, degree, false, ime_get_main_window());
+        ise_show_emoticon_layout(get_current_emoticon_group(), degree, false, ime_get_main_window());
     } else if (ui) {
         const sclchar *input_mode = ui->get_input_mode();
         if (input_mode) {
             if (!(strcmp(input_mode, "EMOTICON_LAYOUT")))
-                ise_show_emoticon_layout(current_emoticon_group, degree, false, ime_get_main_window());
+                ise_show_emoticon_layout(get_current_emoticon_group(), degree, false, ime_get_main_window());
             else if (!(strcmp(input_mode, "STT_3X4")))
                 ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
         }