From 45bb2a5508398fb00299cf352fd8010fd8dba9c8 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 4 Jan 2021 11:02:14 +0900 Subject: [PATCH] Remove global variable to check the visibility of candidate Change-Id: I50addf90a17b81f09d7fbed0a6b05e7e7983d6da Signed-off-by: Jihoon Kim --- src/ise.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ise.cpp b/src/ise.cpp index 1aa4bb9..bb4fdcc 100644 --- a/src/ise.cpp +++ b/src/ise.cpp @@ -85,7 +85,6 @@ static const int MAX_DEFAULT_PUNCTUATION = 6; static string g_default_punctuation[MAX_DEFAULT_PUNCTUATION] = {"-", "@", "'", "!", "?", ","}; static string g_current_punctuation[MAX_DEFAULT_PUNCTUATION-1] = {"RCENT1", "RCENT2", "RCENT3", "RCENT4", "RCENT5"}; static vector g_softcandidate_string; -static bool g_softcandidate_show = false; static bool g_input_panel_show = false; static bool g_caps_mode_pending = false; static bool g_floating_mode = false; @@ -506,7 +505,6 @@ static Eina_Bool softcandidate_hide_timer_callback(void *data) Candidate *candidate = get_candidate(); if (candidate) { candidate->hide(); - g_softcandidate_show = false; } return ECORE_CALLBACK_CANCEL; } @@ -1185,7 +1183,8 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d if (keyboard_state->layout == ISE_LAYOUT_STYLE_NUMBER) { ime_send_key_event(IME_KEY_Print, IME_KEY_MASK_CONTROL, false); } else { - if (word_timer == NULL && (!get_candidate() || !g_softcandidate_show)) { + Candidate *candidate = get_candidate(); + if (word_timer == NULL && (!candidate || !candidate->get_visible())) { word_timer = ecore_timer_add(MULTITAP_TIMEOUT, _multi_tap_timer_cb, NULL); } ime_send_key_event(IME_KEY_Select, IME_KEY_MASK_CONTROL, false); @@ -1852,7 +1851,7 @@ ise_set_screen_rotation(int degree) Candidate *candidate = get_candidate(); if (candidate) { candidate->rotate(degree); - if (g_softcandidate_show) { + if (candidate->get_visible()) { candidate->update(g_softcandidate_string); } } @@ -1903,7 +1902,8 @@ ise_hide() } g_input_panel_show = false; - if (g_softcandidate_show && get_candidate()) + Candidate *candidate = get_candidate(); + if (candidate && candidate->get_visible()) set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW); #ifdef _WEARABLE hide_indicator_window(); @@ -2001,7 +2001,6 @@ static void ise_floating_mode_changed_cb(const char *key, void *user_data) create_softcandidate(); if (g_candidate && g_candidate->get_visible()) { - g_softcandidate_show = true; g_candidate->show(); set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW); return; @@ -2198,16 +2197,17 @@ void ise_app_candidate_show() { #ifdef _WEARABLE - if (!g_softcandidate_show) { + if (!g_candidate) + return; + + if (!g_candidate->get_visible()) return; - } #endif LOGD("Enter\n"); delete_softcandidate_hide_timer(); create_softcandidate(); - g_softcandidate_show = true; Candidate *candidate = get_candidate(); if (candidate) { candidate->show(); @@ -2221,7 +2221,7 @@ ise_app_candidate_hide() LOGD("Enter\n"); Candidate *candidate = get_candidate(); - if (!candidate || !g_softcandidate_show) { + if (!candidate || !candidate->get_visible()) { LOGD("No candidate\n"); return; } @@ -2252,7 +2252,6 @@ void ise_check_wearable_candidate() keyboard_state->layout == ISE_LAYOUT_STYLE_PASSWORD) { ise_app_candidate_hide(); } else { - g_softcandidate_show = true; ise_app_candidate_show(); } } @@ -2443,11 +2442,12 @@ void ise_get_language_locale(char **locale) void ise_update_table(const vector &vec_str) { - if (!get_candidate() || !g_softcandidate_show) { + Candidate *candidate = get_candidate(); + if (!candidate || !candidate->get_visible()) { create_softcandidate(); } - Candidate *candidate = get_candidate(); + candidate = get_candidate(); if (candidate) { candidate->update(vec_str); } @@ -2863,8 +2863,8 @@ static void ime_app_focus_in_cb(int context_id, void *user_data) LOGD("Enter\n"); ise_focus_in(context_id); Candidate *candidate = get_candidate(); - if (input_smartreply_get_reply_num() == 0 && g_softcandidate_show) { - if (candidate) { + if (input_smartreply_get_reply_num() == 0) { + if (candidate && candidate->get_visible()) { ise_app_candidate_hide(); candidate->hide(); } -- 2.7.4