From: Jihoon Kim Date: Fri, 18 Dec 2020 04:06:47 +0000 (+0900) Subject: Remove global emoticon list variable X-Git-Tag: accepted/tizen/6.0/unified/20201221.010718~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6338488829dc7f0fcc87cfc7408ca1861cd4454c;p=platform%2Fcore%2Fuifw%2Fise-default.git Remove global emoticon list variable Change-Id: I6637da736f650bbd86eb534c948d00b6b988b084 Signed-off-by: Jihoon Kim --- diff --git a/src/imdata.cpp b/src/imdata.cpp index ac7b0b1..edf9a3c 100644 --- a/src/imdata.cpp +++ b/src/imdata.cpp @@ -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); } } } diff --git a/src/include/ise-emoticon-mode.h b/src/include/ise-emoticon-mode.h index f47cc0c..e2a82ac 100644 --- a/src/include/ise-emoticon-mode.h +++ b/src/include/ise-emoticon-mode.h @@ -19,6 +19,7 @@ #define ISE_EMOTICON_MODE_H_ #include "ise-floating-mode.h" +#include #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_ */ diff --git a/src/include/ise-stt-option.h b/src/include/ise-stt-option.h index 16721ee..7dcd8b3 100644 --- a/src/include/ise-stt-option.h +++ b/src/include/ise-stt-option.h @@ -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 } diff --git a/src/include/ise.h b/src/include/ise.h index cec054a..9b009e9 100644 --- a/src/include/ise.h +++ b/src/include/ise.h @@ -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); diff --git a/src/ise-emoticon-mode.cpp b/src/ise-emoticon-mode.cpp index 5171513..830f17a 100644 --- a/src/ise-emoticon-mode.cpp +++ b/src/ise-emoticon-mode.cpp @@ -109,10 +109,25 @@ #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 emoticon_list_recent; +static emoticon_group_t current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED; +static std::vector 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] = diff --git a/src/ise-stt-option.cpp b/src/ise-stt-option.cpp index 051177e..cb35e39 100644 --- a/src/ise-stt-option.cpp +++ b/src/ise-stt-option.cpp @@ -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; diff --git a/src/ise.cpp b/src/ise.cpp index 3ef2834..ef2e91f 100644 --- a/src/ise.cpp +++ b/src/ise.cpp @@ -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 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())); }