#include <sys/stat.h>
#include <fcntl.h>
#include <vconf.h>
+#include <Ecore.h>
#include <Ecore_IMF.h>
#include <Elementary.h>
#include <sclui.h>
#include <app_control.h>
#include <app_preference.h>
#include <ode/internal-encryption.h>
-#ifdef HAVE_CBHM
-#include <cbhm.h>
-#endif
+#include <notification.h>
#include "autofill.h"
#include "ise.h"
#include "utils.h"
#include "languages.h"
#include "candidate-factory.h"
#include "ise-emoticon-mode.h"
+#include "ise-emoticon-list.h"
#include "ise-stt-mode.h"
#include "ise-stt-option.h"
#include "ise-language-change.h"
#include "modeindicator.h"
#include "w-input-smartreply.h"
#include "ise-floating-mode.h"
-
-#define EDJ_FILE RESDIR"/edje/mobile/customised_ctxpopup.edj"
+#include "ise-dbus.h"
+#include "ise-sticker-mode.h"
+#include "ise-nmt-mode.h"
+#include "nmt.h"
+#include "guidepopup.h"
#define EXIT_ISE_ON_HIDE 0
#define DEFER_ISE_CREATION 0
#include <vector>
using namespace std;
-CSCLUI *g_ui = NULL;
-
-#ifdef HAVE_CBHM
-static cbhm_h cbhm_handle;
-static sclu32 cbhm_sel_type = 0;
-static sclboolean g_set_mime_type = FALSE;
-#endif
-
-int g_imdata_state = 0;
+static CSCLUI *g_ui = NULL;
+CSCLUI* get_ui() { return g_ui; }
-extern emoticon_group_t current_emoticon_group;
-extern std::vector <int> emoticon_list_recent;
+static int g_imdata_state = 0;
-extern CONFIG_VALUES g_config_values;
static sclboolean g_need_send_shift_event = FALSE;
extern void set_ise_imdata(const char * buf, size_t &len);
static string g_default_punctuation[MAX_DEFAULT_PUNCTUATION] = {"-", "@", "'", "!", "?", ","};
static string g_current_punctuation[MAX_DEFAULT_PUNCTUATION-1] = {"RCENT1", "RCENT2", "RCENT3", "RCENT4", "RCENT5"};
static vector<string> g_softcandidate_string;
-static bool g_softcandidate_show = false;
static bool g_input_panel_show = false;
-static bool g_smartreply_reply_exist = false;
-static unsigned int g_smartreply_size = 0;
static bool g_caps_mode_pending = false;
static bool g_floating_mode = false;
static bool g_candidate_more_view = false;
static bool g_ise_created = false;
-static bool g_autofill_exist = false;
-static int g_autofill_hint = 0;
-static string g_autofill_string;
static vector<string> g_lookup_table_strings;
static vector<string> g_smartreply_strings;
#if EXIT_ISE_ON_HIDE
static Ecore_Timer *exit_timer = NULL;
#endif
-static string g_app_id;
-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;
-KEYBOARD_STATE g_keyboard_state = {
+static KEYBOARD_STATE g_keyboard_state = {
0,
0,
ISE_LAYOUT_STYLE_NORMAL,
FALSE,
"",
KEY_MODIFIER_NONE,
+ FALSE,
FALSE
};
+KEYBOARD_STATE* get_keyboard_state() {
+ return &g_keyboard_state;
+}
+
#define ISE_LAYOUT_NUMBERONLY_VARIATION_MAX 4
/*static const sclchar *_ise_numberonly_variation_name[ISE_LAYOUT_NUMBERONLY_VARIATION_MAX] = {
"DEFAULT", "SIG", "DEC", "SIGDEC"
static sclu32 _context_layout = ISE_LAYOUT_STYLE_NORMAL;
static sclu32 _context_layout_variation = 0;
-Candidate *g_candidate = NULL;
+static Candidate *g_candidate = NULL;
+Candidate* get_candidate() {
+ return g_candidate;
+}
+
+static ISELanguageManager _language_manager;
class CandidateEventListener: public EventListener
{
public:
void on_event(const EventDesc &desc)
{
+ CSCLUI *ui = get_ui();
const MultiEventDesc &multidesc = dynamic_cast<const MultiEventDesc &>(desc);
+ LANGUAGE_INFO *info = _language_manager.get_language_info(_language_manager.get_current_language());
+
+ unsigned int smartreply_size = input_smartreply_get_reply_num();
+
switch (multidesc.type) {
case MultiEventDesc::CANDIDATE_ITEM_MOUSE_DOWN:
- if (g_autofill_exist) {
+ if (ime_autofill_get_exist()) {
if (multidesc.index == 0) {
- char *text = autofill_get_string(g_app_id.c_str(), g_resource_id.c_str(), (Ecore_IMF_Input_Hints)g_autofill_hint);
- if (text) {
- ise_send_string(text);
- free(text);
- }
- } else if (multidesc.index < (int)g_smartreply_size + 1) {
+ string autofill_string = ime_autofill_get_string();
+ ise_send_string(autofill_string.c_str());
+ } else if (multidesc.index < (int)smartreply_size + 1) {
ise_send_string(g_softcandidate_string[multidesc.index].c_str());
+ ise_update_table(g_smartreply_strings);
} else {
- ime_select_candidate(multidesc.index - g_smartreply_size - 1);
+ if (info && info->load_in_ime)
+ ime_select_candidate(multidesc.index - smartreply_size - 1);
+ else
+ engine_loader_select_candidate(multidesc.index - smartreply_size - 1);
}
} else {
- if (multidesc.index < (int)g_smartreply_size)
+ if (multidesc.index < (int)smartreply_size) {
ise_send_string(g_softcandidate_string[multidesc.index].c_str());
- else
- ime_select_candidate(multidesc.index - g_smartreply_size);
+ ise_update_table(g_smartreply_strings);
+ }
+ else {
+ if (info && info->load_in_ime)
+ ime_select_candidate(multidesc.index - smartreply_size);
+ else
+ engine_loader_select_candidate(multidesc.index - smartreply_size);
+ }
}
break;
case MultiEventDesc::CANDIDATE_MORE_VIEW_SHOW:
g_candidate_more_view = true;
if (!g_input_panel_show)
set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
- if (g_ui)
- g_ui->disable_input_events(TRUE);
+ if (ui)
+ ui->disable_input_events(TRUE);
break;
case MultiEventDesc::CANDIDATE_MORE_VIEW_HIDE:
g_candidate_more_view = false;
if (!g_input_panel_show)
set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
- if (g_ui)
- g_ui->disable_input_events(FALSE);
+ if (ui)
+ ui->disable_input_events(FALSE);
break;
default: break;
}
};
static CandidateEventListener g_candidate_event_listener;
-static ISELanguageManager _language_manager;
#define MVK_Shift_L 0xffe1
#define MVK_Caps_Lock 0xffe5
#define MVK_Shift_Off 0xffe1
#define MVK_Shift_Enable 0x9fe7
#define MVK_Shift_Disable 0x9fe8
#define MVK_space 0x020
+#define MVK_Done 0xff0d
-#define CM_KEY_LIST_SIZE 5
+#define CM_KEY_LIST_SIZE 7
+#define MULTITAP_TIMEOUT 3.0
#define USER_KEYSTRING_OPTION "OPTION"
#define USER_KEYSTRING_EMOTICON "EMOTICON_LAYOUT"
-#define USER_KEYSTRING_CLIPBOARD "CLIPBOARD"
#define USER_KEYSTRING_VOICE "STT_3X4"
#define USER_KEYSTRING_FLOATING "FLOATING"
+#define USER_KEYSTRING_STICKER "STICKER_LAYOUT"
+#define USER_KEYSTRING_TRANSLATION "TRANSLATION_LAYOUT"
#define USER_VOICE_LANGUAGE "LANGUAGE"
static sclboolean _cm_popup_opened = FALSE;
-static const char *_cm_key_list[CM_KEY_LIST_SIZE] = {USER_KEYSTRING_OPTION, USER_KEYSTRING_EMOTICON, USER_KEYSTRING_CLIPBOARD, USER_KEYSTRING_VOICE, USER_KEYSTRING_FLOATING};
+static const char *_cm_key_list[CM_KEY_LIST_SIZE] = {USER_KEYSTRING_OPTION, USER_KEYSTRING_EMOTICON,
+ USER_KEYSTRING_VOICE, USER_KEYSTRING_FLOATING, USER_KEYSTRING_STICKER, USER_KEYSTRING_TRANSLATION};
static scluint _current_cm_key_id = 0;
-Evas_Object* _guide_popup_setting = NULL;
-Evas_Object* _guide_popup_space = NULL;
/*
* This callback class will receive all response events from SCL
class CUIEventCallback : public ISCLUIEventCallback
{
public :
+ Ecore_Timer* word_timer = NULL;
+ static Eina_Bool _multi_tap_timer_cb(void *data)
+ {
+ LOGD("Time Out");
+ ise_send_event(MVK_Done, KEY_MASK_NULL);
+ return ECORE_CALLBACK_CANCEL;
+ }
SCLEventReturnType on_event_key_clicked(SclUIEventDesc event_desc);
SCLEventReturnType on_event_drag_state_changed(SclUIEventDesc event_desc);
SCLEventReturnType on_event_notification(SCLUINotiType noti_type, SclNotiDesc *etc_info);
+
+private:
+ void on_event_string_key(CSCLUI *ui, SclUIEventDesc event_desc);
+ void on_event_control_key(CSCLUI *ui, SclUIEventDesc event_desc, KEYBOARD_STATE *keyboard_state);
+ void on_event_character_key(CSCLUI *ui, SclUIEventDesc event_desc, KEYBOARD_STATE *keyboard_state);
+ void on_event_modechange_key(CSCLUI *ui, SclUIEventDesc event_desc, KEYBOARD_STATE *keyboard_state, SCLEventReturnType &ret);
+ void process_user_key(CSCLUI *ui, SclUIEventDesc event_desc, KEYBOARD_STATE *keyboard_state, SCLEventReturnType &ret);
};
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();
vector<string>::iterator iter;
+ g_smartreply_strings.clear();
+ input_smartreply_deinit();
+ g_ic_smartreply = -1;
+
// add autofill string
- if (g_autofill_exist)
- g_softcandidate_string.push_back(g_autofill_string);
+ if (ime_autofill_get_exist())
+ g_softcandidate_string.push_back(ime_autofill_get_string());
// add lookup table string(s)
iter = g_lookup_table_strings.begin();
candidate = reply;
if (candidate) {
g_smartreply_strings.push_back(string(candidate));
- g_smartreply_size++;
free(candidate);
candidate = NULL;
}
}
g_ic_smartreply = g_ic;
- g_smartreply_reply_exist = true;
ise_app_candidate_show();
g_softcandidate_string = g_smartreply_strings;
static void _reset_shift_state(void)
{
- if (g_ui) {
+ CSCLUI *ui = get_ui();
+ if (ui) {
/* Reset all shift state variables */
- SCLShiftState old_shift_state = g_ui->get_shift_state();
+ SCLShiftState old_shift_state = ui->get_shift_state();
SCLShiftState new_shift_state = SCL_SHIFT_STATE_OFF;
if (old_shift_state != new_shift_state) {
g_need_send_shift_event = true;
- g_ui->set_shift_state(new_shift_state);
+ ui->set_shift_state(new_shift_state);
}
LOGD("Shift state changed from (%d) to (%d)\n", (int)old_shift_state, (int)new_shift_state);
}
}
static void set_caps_mode(sclboolean mode) {
+ CSCLUI *ui = get_ui();
LOGD("mode : %d\n", mode);
- if (g_ui) {
- if (g_ui->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
- g_ui->set_shift_state(mode ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF);
- g_ui->set_autocapital_shift_state(!mode);
+ if (ui) {
+ if (ui->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
+ ui->set_shift_state(mode ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF);
+ ui->set_autocapital_shift_state(!mode);
+
+ 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);
}
}
}
static void _reset_multitap_state(bool skip_commit = false)
{
- LOGD("g_keyboard_state.prev_modifier : %d", g_keyboard_state.prev_modifier);
- if (g_keyboard_state.prev_modifier == KEY_MODIFIER_MULTITAP_START ||
- g_keyboard_state.prev_modifier == KEY_MODIFIER_MULTITAP_REPEAT) {
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+
+ LOGD("keyboard_state.prev_modifier : %d", keyboard_state->prev_modifier);
+ if (keyboard_state->prev_modifier == KEY_MODIFIER_MULTITAP_START ||
+ keyboard_state->prev_modifier == KEY_MODIFIER_MULTITAP_REPEAT) {
if (!skip_commit) {
- ise_send_string(g_keyboard_state.multitap_value.c_str());
+ ise_send_string(keyboard_state->multitap_value.c_str());
}
ise_update_preedit_string("");
}
- g_keyboard_state.multitap_value = "";
- g_keyboard_state.prev_modifier = KEY_MODIFIER_NONE;
+ keyboard_state->multitap_value = "";
+ keyboard_state->prev_modifier = KEY_MODIFIER_NONE;
if (g_caps_mode_pending) {
g_caps_mode_pending = false;
- set_caps_mode(g_keyboard_state.caps_mode);
+ set_caps_mode(keyboard_state->caps_mode);
}
}
static void ise_set_cm_private_key(scluint cm_key_id)
{
- if (cm_key_id >= CM_KEY_LIST_SIZE || g_ui == NULL) {
+ CSCLUI *ui = get_ui();
+ if (cm_key_id >= CM_KEY_LIST_SIZE || ui == NULL) {
LOGE("cm_key_id=%d\n", cm_key_id);
return;
}
const_cast<sclchar*>("icon/54x54/icon_emotion_nor.png"),
const_cast<sclchar*>("icon/54x54/icon_emotion_press.png"),
const_cast<sclchar*>("icon/54x54/icon_emotion_dim.png")};
- g_ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_EMOTICON), TRUE);
+ ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_EMOTICON), TRUE);
} else if (strcmp(_cm_key_list[cm_key_id], USER_KEYSTRING_OPTION) == 0) {
sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
const_cast<sclchar*>("icon/54x54/icon_setting_nor.png"),
const_cast<sclchar*>("icon/54x54/icon_setting_press.png"),
const_cast<sclchar*>("icon/54x54/icon_setting_dim.png")};
- g_ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_OPTION), TRUE);
- } else if (strcmp(_cm_key_list[cm_key_id], USER_KEYSTRING_CLIPBOARD) == 0) {
- sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
- const_cast<sclchar*>("icon/54x54/icon_clipboard_nor.png"),
- const_cast<sclchar*>("icon/54x54/icon_clipboard_press.png"),
- const_cast<sclchar*>("icon/54x54/icon_clipboard_dim.png")};
- g_ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_CLIPBOARD), TRUE);
+ ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_OPTION), TRUE);
} else if (strcmp(_cm_key_list[cm_key_id], USER_KEYSTRING_VOICE) == 0) {
sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
const_cast<sclchar*>("icon/54x54/icon_mic_nor.png"),
const_cast<sclchar*>("icon/54x54/icon_mic_press.png"),
const_cast<sclchar*>("icon/54x54/icon_mic_dim.png")};
- g_ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_VOICE), TRUE);
+ ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_VOICE), TRUE);
} else if (strcmp(_cm_key_list[cm_key_id], USER_KEYSTRING_FLOATING) == 0) {
sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
const_cast<sclchar*>("icon/54x54/icon_floating_keypad_nor.png"),
const_cast<sclchar*>("icon/54x54/icon_floating_keypad_press.png"),
const_cast<sclchar*>("icon/54x54/icon_floating_keypad_dim.png")};
- g_ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_FLOATING), TRUE);
+ ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_FLOATING), TRUE);
+ } else if (strcmp(_cm_key_list[cm_key_id], USER_KEYSTRING_TRANSLATION) == 0) {
+ sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
+ const_cast<sclchar*>("icon/54x54/icon_translation_nor.png"),
+ const_cast<sclchar*>("icon/54x54/icon_translation_press.png"),
+ const_cast<sclchar*>("icon/54x54/icon_translation_dim.png")};
+ ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_TRANSLATION), TRUE);
+ } else if (strcmp(_cm_key_list[cm_key_id], USER_KEYSTRING_STICKER) == 0) {
+ sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
+ const_cast<sclchar*>("icon/54x54/icon_sticker_nor.png"),
+ const_cast<sclchar*>("icon/54x54/icon_sticker_press.png"),
+ const_cast<sclchar*>("icon/54x54/icon_sticker_dim.png")};
+ ui->set_private_key("CM_KEY", const_cast<sclchar*>(" "), imagelabel, NULL, 0, const_cast<sclchar*>(USER_KEYSTRING_STICKER), TRUE);
}
}
static void ise_update_space_key(void)
{
- if (g_ui == NULL) {
- LOGE("g_ui = NULL\n");
+ CSCLUI *ui = get_ui();
+ if (ui == NULL) {
+ LOGE("ui = NULL\n");
return;
}
const_cast<sclchar*>("w_sip_3x4_btn_ic_space_no_arrow.png"),
const_cast<sclchar*>("w_sip_3x4_btn_ic_space_no_arrow.png"),
const_cast<sclchar*>("w_sip_3x4_btn_ic_space_no_arrow.png")};
- g_ui->set_private_key("SPACE_KEY", const_cast<sclchar*>(info->display_name.c_str()), imagelabel, NULL, 0, const_cast<sclchar*>("Space"), TRUE);
+ ui->set_private_key("SPACE_KEY", const_cast<sclchar*>(info->display_name.c_str()), imagelabel, NULL, 0, const_cast<sclchar*>("Space"), TRUE);
#else
- g_ui->enable_button("SPACE_ARROW_LEFT", false);
- g_ui->enable_button("SPACE_ARROW_RIGHT", false);
+ ui->enable_button("SPACE_ARROW_LEFT", false);
+ ui->enable_button("SPACE_ARROW_RIGHT", false);
#endif
}
} else {
#ifdef _WEARABLE
- g_ui->unset_private_key("SPACE_KEY");
+ ui->unset_private_key("SPACE_KEY");
#else
- g_ui->enable_button("SPACE_ARROW_LEFT", true);
- g_ui->enable_button("SPACE_ARROW_RIGHT", true);
+ ui->enable_button("SPACE_ARROW_LEFT", true);
+ ui->enable_button("SPACE_ARROW_RIGHT", true);
#endif
}
}
static bool ise_is_emoticons_disabled(void)
{
bool ret = true;
- sclu32 current_layout = g_keyboard_state.layout;
+
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return ret;
+
+ sclu32 current_layout = keyboard_state->layout;
LOGD("layout=%d\n", current_layout);
if ((current_layout == ISE_LAYOUT_STYLE_NORMAL) ||
LOGD("Enter\n");
set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_HIDE);
- if (g_candidate) {
- g_candidate->hide();
- g_softcandidate_show = false;
+ Candidate *candidate = get_candidate();
+ if (candidate) {
+ candidate->hide();
}
return ECORE_CALLBACK_CANCEL;
}
ise_send_string(const sclchar *key_value)
{
int ic = -1;
- if (!check_ic_temporary(g_keyboard_state.ic)) {
- ic = g_keyboard_state.ic;
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (keyboard_state && !check_ic_temporary(keyboard_state->ic)) {
+ ic = keyboard_state->ic;
}
ime_commit_string(key_value);
LOGD("ic : %x, %s\n", ic, key_value);
Eina_List *attr_list = NULL;
ime_preedit_attribute *preedit_attr;
- if (!check_ic_temporary(g_keyboard_state.ic)) {
- ic = g_keyboard_state.ic;
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (keyboard_state && !check_ic_temporary(keyboard_state->ic)) {
+ ic = keyboard_state->ic;
}
if (underline) {
/* Count UTF-8 string length */
ise_send_event(sclulong key_event, sclulong key_mask)
{
int ic = -1;
- if (!check_ic_temporary(g_keyboard_state.ic)) {
- ic = g_keyboard_state.ic;
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (keyboard_state && !check_ic_temporary(keyboard_state->ic)) {
+ ic = keyboard_state->ic;
}
ime_send_key_event((ime_key_code_e)key_event, IME_KEY_MASK_PRESSED, false);
ime_send_key_event((ime_key_code_e)key_event, IME_KEY_MASK_RELEASED, false);
- LOGD("ic : %x, %x\n", ic, key_event);
+ LOGD("ic : %x, %lx\n", (unsigned int)ic, key_event);
}
/**
ise_forward_key_event(sclulong key_event)
{
int ic = -1;
- if (!check_ic_temporary(g_keyboard_state.ic)) {
- ic = g_keyboard_state.ic;
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!check_ic_temporary(keyboard_state->ic)) {
+ ic = keyboard_state->ic;
}
ime_send_key_event((ime_key_code_e)key_event, IME_KEY_MASK_PRESSED, true);
ime_send_key_event((ime_key_code_e)key_event, IME_KEY_MASK_RELEASED, true);
- LOGD("ic : %x, %x\n", ic, key_event);
+ LOGD("ic : %x, %lx\n", (unsigned int)ic, key_event);
}
/**
{
sclboolean ret = FALSE;
- if (g_ui) {
+ CSCLUI *ui = get_ui();
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (ui && keyboard_state) {
if (key_value) {
SECURE_LOGD("key_value : %s\n", key_value);
if (strcmp(key_value, "CUR_LANG") == 0) {
- g_keyboard_state.disable_force_latin = TRUE;
+ keyboard_state->disable_force_latin = TRUE;
ret = _language_manager.select_current_language();
}
if (strcmp(key_value, "NEXT_LANG") == 0) {
- g_keyboard_state.disable_force_latin = TRUE;
+ keyboard_state->disable_force_latin = TRUE;
ret = _language_manager.select_next_language();
}
}
LANGUAGE_INFO *info = _language_manager.get_language_info(cur_lang);
if (info) {
if (info->accepts_caps_mode) {
- ise_send_event(MVK_Shift_Enable, KEY_MASK_NULL);
- set_caps_mode(g_keyboard_state.caps_mode);
+ if (info->load_in_ime)
+ ime_send_imengine_event(MVK_Shift_Enable, 0);
+ else
+ engine_loader_send_imengine_event(MVK_Shift_Enable, 0);
+
+ set_caps_mode(keyboard_state->caps_mode);
} else {
- ise_send_event(MVK_Shift_Disable, KEY_MASK_NULL);
- g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
+ if (info->load_in_ime)
+ ime_send_imengine_event(MVK_Shift_Disable, 0);
+ else
+ engine_loader_send_imengine_event(MVK_Shift_Disable, 0);
+
+ ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
}
}
- if (is_emoticon_show()) {
- ise_destroy_emoticon_layout();
+
+ if (ise_sticker_is_show())
+ ise_sticker_destroy_layout();
+
+ if (ise_emoticon_is_show()) {
+ ise_emoticon_destroy_layout();
}
+
+ if (ise_nmt_is_show()) {
+ ise_nmt_destroy_layout();
+ }
+
if (key_value) {
if (!strcmp(key_value, USER_KEYSTRING_EMOTICON)) {
- ise_init_emoticon_list();
+ ise_emoticon_init_list();
#ifdef _WEARABLE
- current_emoticon_group = EMOTICON_GROUP_1;
+ ise_emoticon_set_current_group(EMOTICON_GROUP_1);
#else
- if (emoticon_list_recent.size() == 0)
- current_emoticon_group = EMOTICON_GROUP_1;
+ if (ise_emoticon_get_recent_list_size() == 0)
+ ise_emoticon_set_current_group(EMOTICON_GROUP_1);
else
- current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
+ ise_emoticon_set_current_group(EMOTICON_GROUP_RECENTLY_USED);
#endif
- SCLRotation rotation = g_ui->get_rotation();
- ise_show_emoticon_layout(current_emoticon_group, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
+ SCLRotation rotation = ui->get_rotation();
+ ise_emoticon_show_layout(ise_emoticon_get_current_group(), ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
+ }
+ else if (!strcmp(key_value, USER_KEYSTRING_TRANSLATION)) {
+ LOGD("");
+ SCLRotation rotation = ui->get_rotation();
+ ise_nmt_show_layout(ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
}
}
}
return ret;
}
-static void show_cbhm()
-{
-#ifdef HAVE_CBHM
- int ret;
-
- if (g_set_mime_type)
- ret = cbhm_selection_type_set(cbhm_handle, static_cast<cbhm_sel_type_e>(cbhm_sel_type));
- else
- ret = cbhm_selection_type_set(cbhm_handle, CBHM_SEL_TYPE_TEXT);
-
- if (ret != CBHM_ERROR_NONE)
- LOGW("Failed to set selection type in cbhm. error : %d\n", ret);
-
- ret = cbhm_show(cbhm_handle);
- if (ret != CBHM_ERROR_NONE)
- LOGW("cbhm show error : %d\n", ret);
- else
- LOGD("Show cbhm\n");
-#endif
-}
-
SCLEventReturnType CUIEventCallback::on_event_notification(SCLUINotiType noti_type, SclNotiDesc *etc_info)
{
+ CSCLUI *ui = get_ui();
SCLEventReturnType ret = SCL_EVENT_PASS_ON;
LOGD("noti type: %d, g_need_send_shift_event: %d\n", noti_type, g_need_send_shift_event);
if (info->accepts_caps_mode) {
LOGD("shift state: %d\n", desc->shift_state);
if (desc->shift_state == SCL_SHIFT_STATE_OFF) {
- ise_send_event(MVK_Shift_Off, KEY_MASK_NULL);
+ if (info->load_in_ime)
+ ime_send_imengine_event(MVK_Shift_Off, 0);
+ else
+ engine_loader_send_imengine_event(MVK_Shift_Off, 0);
} else if (desc->shift_state == SCL_SHIFT_STATE_ON) {
- ise_send_event(MVK_Shift_On, KEY_MASK_NULL);
+ if (info->load_in_ime)
+ ime_send_imengine_event(MVK_Shift_On, 0);
+ else
+ engine_loader_send_imengine_event(MVK_Shift_On, 0);
} else if (desc->shift_state == SCL_SHIFT_STATE_LOCK) {
- ise_send_event(MVK_Shift_Lock, KEY_MASK_NULL);
+ if (info->load_in_ime)
+ ime_send_imengine_event(MVK_Shift_Lock, 0);
+ else
+ engine_loader_send_imengine_event(MVK_Shift_Lock, 0);
}
ret = SCL_EVENT_PASS_ON;
}
int punc_pos = 0;
for (; iter != g_recent_used_punctuation.rend(); ++iter)
{
- if (g_ui)
- g_ui->set_string_substitution(g_current_punctuation[punc_pos].c_str(), iter->c_str());
+ if (ui)
+ ui->set_string_substitution(g_current_punctuation[punc_pos].c_str(), iter->c_str());
punc_pos++;
}
SclNotiPopupOpeningDesc *openingDesc = (SclNotiPopupOpeningDesc *)etc_info;
- if (g_ui && 0 == strcmp(openingDesc->input_mode, "CM_POPUP")) {
+ if (ui && 0 == strcmp(openingDesc->input_mode, "CM_POPUP")) {
+ if (!ise_sticker_check_sticker_exists())
+ ui->enable_button("STICKER_KEY", EINA_FALSE);
+
+ if (nmt_is_disabled())
+ ui->enable_button("TRANSLATION_KEY", false);
+ else
+ ui->enable_button("TRANSLATION_KEY", true);
+
if (ise_is_emoticons_disabled())
- g_ui->enable_button("EMOTICON_KEY", false);
+ ui->enable_button("EMOTICON_KEY", false);
else
- g_ui->enable_button("EMOTICON_KEY", true);
+ ui->enable_button("EMOTICON_KEY", true);
}
} else if (noti_type == SCL_UINOTITYPE_POPUP_OPENED) {
g_popup_opened = TRUE;
}
} else if (noti_type == SCL_UINOTITYPE_INPUT_MODE_CHANGE) {
SclNotiInputModeChangeDesc *desc = static_cast<SclNotiInputModeChangeDesc*>(etc_info);
- if (desc && g_ui) {
+ if (desc && 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 = 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()));
+ }
}
}
}
return ret;
}
-void ise_destory_popup_setting()
+bool get_landscape_device(int degree)
{
- if (_guide_popup_setting != NULL) {
- LOGD("destroy setting popup iter\n");
- evas_object_del(_guide_popup_setting);
- _guide_popup_setting = NULL;
- g_config_values.first_guideset = TRUE;
- write_ise_config_values();
- }
-}
+ sclint width = 0;
+ sclint height = 0;
+ bool landscape_device = false;
-void ise_destory_popup_space()
-{
- if (_guide_popup_space != NULL) {
- LOGD("destroy space popup iter\n");
- evas_object_del(_guide_popup_space);
- _guide_popup_setting = NULL;
- g_config_values.first_guidechange = TRUE;
- write_ise_config_values();
- }
-}
+ CSCLUI *ui = get_ui();
+ if (!ui) return false;
-Evas_Object *open_message_popup(Evas_Object *parentWnd)
-{
- static Evas_Object *msg_window = NULL;
- if (msg_window) {
- evas_object_del(msg_window);
- msg_window = NULL;
- }
- msg_window = elm_win_add(parentWnd, "MCFMessagePopup", ELM_WIN_UTILITY);
- if (msg_window) {
- int w, h;
- elm_win_borderless_set(msg_window, EINA_TRUE);
- elm_win_alpha_set(msg_window, EINA_TRUE);
- elm_win_title_set(msg_window, "ISF Popup");
- elm_win_screen_size_get(msg_window, NULL, NULL, &w, &h);
- elm_win_prop_focus_skip_set(msg_window, TRUE);
- int rots[4] = {0, 90, 180, 270};
- elm_win_wm_rotation_available_rotations_set(msg_window, rots, 4);
- evas_object_resize(msg_window, w, h);
- }
+ ui->get_screen_resolution(&width, &height);
- int rots[4] = { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(msg_window, rots, 4);
- evas_object_show(msg_window);
- return msg_window;
-}
-
-void _guideline_popup_setting_cb(void *data, Evas_Object *obj, void *event_info)
-{
- evas_object_smart_callback_del(obj, "dismissed", _guideline_popup_setting_cb);
- evas_object_del(obj);
- obj = NULL;
- ise_destory_popup_setting();
- g_config_values.first_guideset = TRUE;
- write_ise_config_values();
-}
-
-void _guideline_popup_space_cb(void *data, Evas_Object *obj, void *event_info)
-{
- evas_object_smart_callback_del(obj, "dismissed", _guideline_popup_space_cb);
- evas_object_del(obj);
- obj = NULL;
- ise_destory_popup_space();
- g_config_values.first_guidechange = TRUE;
- write_ise_config_values();
-}
-
-void ise_show_help_popup(sclulong keyEvent)
-{
- char buf[2048] = {0, };
- int font_size = 40;
- sclint scr_w = 0;
- sclint scr_h = 0;
- SclRectangle rectangle = {0};
- Evas_Object *ctxpopup = NULL;
- Elm_Theme *theme = NULL;
-
- if (g_ui) {
- g_ui->get_screen_resolution(&scr_w, &scr_h);
-
- if (keyEvent == MVK_space) {
- g_config_values.first_guidechange = TRUE;
- write_ise_config_values();
- g_ui->get_button_geometry("SPACE_KEY", &rectangle);
- _guide_popup_space = open_message_popup(NATIVE_WINDOW_CAST(ime_get_main_window()));
-
- theme = elm_theme_new();
- elm_theme_ref_set(theme, NULL);
- elm_theme_extension_add(theme, EDJ_FILE);
-
- ctxpopup = elm_ctxpopup_add(_guide_popup_space);
- elm_object_theme_set(ctxpopup, theme);
- evas_object_smart_callback_add(ctxpopup, "dismissed", _guideline_popup_space_cb, (void *)keyEvent);
- } else {
- g_config_values.first_guideset = TRUE;
- write_ise_config_values();
- g_ui->get_button_geometry("CM_KEY", &rectangle);
- _guide_popup_setting = open_message_popup(NATIVE_WINDOW_CAST(ime_get_main_window()));
- theme = elm_theme_new();
- elm_theme_ref_set(theme, NULL);
- elm_theme_extension_add(theme, EDJ_FILE);
- ctxpopup = elm_ctxpopup_add(_guide_popup_setting);
- elm_object_theme_set(ctxpopup, theme);
- evas_object_smart_callback_add(ctxpopup, "dismissed", _guideline_popup_setting_cb, (void *)keyEvent);
- }
+ if (degree == 0 || degree == 180) {
+ if (width > height)
+ landscape_device = true;
}
-
- int rotation = elm_win_rotation_get(NATIVE_WINDOW_CAST(ime_get_main_window()));
- if (rotation == 0 || rotation == 180) {
- elm_object_style_set(ctxpopup, "customised_guideline_popup");
- } else {
- elm_object_style_set(ctxpopup, "customised_guideline_popup_landscape");
- }
-
- elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP,
- ELM_CTXPOPUP_DIRECTION_UNKNOWN,
- ELM_CTXPOPUP_DIRECTION_UNKNOWN,
- ELM_CTXPOPUP_DIRECTION_UNKNOWN);
-
- Evas_Object* text = elm_label_add(ctxpopup);
-
- if (keyEvent == MVK_space) {
- snprintf(buf, sizeof(buf), "<font_style=Regular font_size=%d align=left wrap=mixed color=#000000>%s</>", font_size,
- dgettext(PACKAGE, "IDS_IME_BODY_SWIPE_THE_SPACE_BAR_LEFT_OR_RIGHT_TO_CHANGE_BETWEEN_LANGUAGES"));
- } else {
- snprintf(buf, sizeof(buf), "<font_style=Regular font_size=%d align=left wrap=mixed color=#000000>%s</>", font_size,
- dgettext(PACKAGE, "IDS_IME_BODY_TAP_AND_HOLD_THIS_KEY_TO_SEE_THE_SYMBOL_LIST_SELECT_ONE_TO_USE_IT_AS_A_SHORTCUT"));
- }
- elm_object_text_set(text, buf);
- elm_object_content_set(ctxpopup, text);
- Evas_Coord x, y, w, h;
- evas_object_geometry_get(NATIVE_WINDOW_CAST(ime_get_main_window()), &x, &y, &w, &h);
-
- if (rotation == 0 || rotation == 180) {
- elm_label_wrap_width_set(text, (scr_w * 4) / 5);
- evas_object_size_hint_min_set(ctxpopup, ELM_SCALE_SIZE(scr_w), ELM_SCALE_SIZE(50));
- evas_object_size_hint_max_set(ctxpopup, ELM_SCALE_SIZE(scr_w), ELM_SCALE_SIZE(600));
- evas_object_move(ctxpopup, rectangle.x + rectangle.width / 2,
- (scr_h - h) + rectangle.y - ELM_SCALE_SIZE(5));
- } else {
- elm_label_wrap_width_set(text, (scr_h * 4) / 5);
- evas_object_size_hint_min_set(ctxpopup, ELM_SCALE_SIZE(scr_h), ELM_SCALE_SIZE(50));
- evas_object_size_hint_max_set(ctxpopup, ELM_SCALE_SIZE(scr_h), ELM_SCALE_SIZE(600));
- evas_object_move(ctxpopup, rectangle.x + rectangle.width / 2,
- (scr_w - h)+ rectangle.y - ELM_SCALE_SIZE(5));
- }
- elm_label_line_wrap_set(text, ELM_WRAP_MIXED);
- evas_object_show(text);
-
- if (keyEvent == MVK_space) {
- evas_object_layer_set(_guide_popup_space, EVAS_LAYER_MAX);
- evas_object_show(_guide_popup_space);
- } else {
- evas_object_layer_set(_guide_popup_setting, EVAS_LAYER_MAX);
- evas_object_show(_guide_popup_setting);
+ else {
+ if (width < height)
+ landscape_device = true;
}
- evas_object_layer_set(ctxpopup, EVAS_LAYER_MAX);
- evas_object_show(ctxpopup);
+ return landscape_device;
}
SCLEventReturnType CUIEventCallback::on_event_drag_state_changed(SclUIEventDesc event_desc)
{
- LOGD("button %s is clicked\n", event_desc.key_value);
+ SECURE_LOGD("button %s is clicked\n", event_desc.key_value);
if (event_desc.event_type == EVENT_TYPE_MOVE) {
if (event_desc.key_event == MVK_space) {
SclRectangle rectangle = {0};
- g_ui->get_button_geometry("SPACE_KEY", &rectangle);
+ CSCLUI *ui = get_ui();
+ if (ui) ui->get_button_geometry("SPACE_KEY", &rectangle);
ise_show_space_flick_language_change_popup(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
}
} else if (event_desc.event_type == EVENT_TYPE_RELEASE) {
if (g_floating_mode)
ime_set_floating_drag_end();
} else if (event_desc.event_type == EVENT_TYPE_PRESS) {
-#ifdef _MOBILE
- if ((!g_config_values.first_guideset) && (strncmp(event_desc.key_value, "OPTION", strlen(event_desc.key_value)) == 0)) {
- ise_show_help_popup(event_desc.key_event);//show help popup in on_event_drag_state_changed other than on_event_key_clicked for fixing help popup show delay issue
+#if defined(_MOBILE) || defined(_COMMON)
+ CONFIG_VALUES *config_values = get_config_values();
+
+ if (config_values && (!config_values->first_guideset) && event_desc.key_value && (strncmp(event_desc.key_value, "OPTION", strlen(event_desc.key_value)) == 0)) {
+ ise_show_help_popup(event_desc.key_event, NATIVE_WINDOW_CAST(ime_get_main_window()));//show help popup in on_event_drag_state_changed other than on_event_key_clicked for fixing help popup show delay issue
LOGD("setting popup show\n");
return SCL_EVENT_PASS_ON;
} else {
- ise_destory_popup_setting();//destory popup manually in case of abormal situation
+ ise_destroy_popup_setting();//destroy popup manually in case of abnormal situation
}
#endif
if (g_floating_mode && event_desc.mouse_current_point.y <= FLOATING_TITLE_BAR_HEIGHT
goto end;
}
+ app_control_add_extra_data(app_control, "caller", "ise-default");
+ app_control_set_launch_mode(app_control, APP_CONTROL_LAUNCH_MODE_GROUP);
+
ret = app_control_send_launch_request(app_control, NULL, NULL);
if (ret != APP_CONTROL_ERROR_NONE) {
goto end;
app_control_destroy(app_control);
}
-SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_desc)
+void CUIEventCallback::on_event_string_key(CSCLUI *ui, SclUIEventDesc event_desc)
{
- SCLEventReturnType ret = SCL_EVENT_PASS_ON;
+ if (event_desc.key_modifier != KEY_MODIFIER_MULTITAP_START &&
+ event_desc.key_modifier != KEY_MODIFIER_MULTITAP_REPEAT) {
+ if (event_desc.key_event) {
+ ise_forward_key_event(event_desc.key_event);
+ } else {
+ ise_send_string(event_desc.key_value);
+ }
+ }
- if (event_desc.key_modifier == KEY_MODIFIER_MULTITAP_START) {
- if (!g_keyboard_state.multitap_value.empty()) {
- ise_send_string(g_keyboard_state.multitap_value.c_str());
+ if (!g_popup_opened) {
+ const sclchar *input_mode = ui->get_input_mode();
+ if (input_mode && ((0 == strcmp(input_mode, "SYM_QTY_1")) || (0 == strcmp(input_mode, "SYM_QTY_2")))) {
+ update_recent_used_punctuation(event_desc.key_value);
}
- ise_update_preedit_string(event_desc.key_value);
- g_keyboard_state.multitap_value = event_desc.key_value;
- } else if (event_desc.key_modifier == KEY_MODIFIER_MULTITAP_REPEAT) {
- ise_update_preedit_string(event_desc.key_value);
- g_keyboard_state.multitap_value = event_desc.key_value;
- } else {
- _reset_multitap_state();
+ } else if (g_punctuation_popup_opened) {
+ update_recent_used_punctuation(event_desc.key_value);
}
- g_keyboard_state.prev_modifier = event_desc.key_modifier;
+}
- if (g_ui) {
- switch (event_desc.key_type) {
- case KEY_TYPE_STRING: {
- if (event_desc.key_modifier != KEY_MODIFIER_MULTITAP_START &&
- event_desc.key_modifier != KEY_MODIFIER_MULTITAP_REPEAT) {
- if (event_desc.key_event) {
- ise_forward_key_event(event_desc.key_event);
- } else {
- ise_send_string(event_desc.key_value);
- }
- }
- if (!g_popup_opened) {
- const sclchar *input_mode = g_ui->get_input_mode();
- if (input_mode && ((0 == strcmp(input_mode, "SYM_QTY_1")) || (0 == strcmp(input_mode, "SYM_QTY_2")))) {
- update_recent_used_punctuation(event_desc.key_value);
- }
- } else if (g_punctuation_popup_opened) {
- update_recent_used_punctuation(event_desc.key_value);
- }
- break;
+void CUIEventCallback::on_event_control_key(CSCLUI *ui, SclUIEventDesc event_desc, KEYBOARD_STATE *keyboard_state)
+{
+ commit_timeout(NULL);
+
+ const char *long_shift = "LongShift";
+ const char *caps_lock = "CapsLock";
+ const char *delete_all = "DeleteAll";
+ const char *hide_panel = "Hide";
+
+ if (strncmp(event_desc.key_value, long_shift, strlen(long_shift)) == 0) {
+ LOGD("shift key is longpress\n");
+ ui->set_shift_state(SCL_SHIFT_STATE_ON);
+ 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 (ui->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
+ ui->set_shift_state(SCL_SHIFT_STATE_LOCK);
+ if (load_in_ime)
+ ime_send_imengine_event(MVK_Shift_Lock, 0);
+ else
+ engine_loader_send_imengine_event(MVK_Shift_Lock, 0);
+ } else {
+ ui->set_shift_state(SCL_SHIFT_STATE_OFF);
+ 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) {
+ ime_delete_surrounding_text((INT_MAX / 2) * -1, INT_MAX);
+ } else if (strncmp(event_desc.key_value, hide_panel, strlen(hide_panel)) == 0) {
+ ise_hide();
+ ime_request_hide();
+ } else if (event_desc.key_event) {
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_VOICE) {
+ ise_stt_stop();
}
- case KEY_TYPE_CHAR: {
- sclboolean need_forward = FALSE;
- // FIXME : Should decide when to forward key events
- const sclchar *input_mode = g_ui->get_input_mode();
- if (input_mode) {
- if (strcmp(input_mode, "SYM_QTY_1") == 0 ||
- strcmp(input_mode, "SYM_QTY_2") == 0 ||
- strcmp(input_mode, "PHONE_3X4") == 0 ||
- strcmp(input_mode, "IPv6_3X4_123") == 0 ||
- strcmp(input_mode, "IPv6_3X4_ABC") == 0 ||
- strcmp(input_mode, "NUMONLY_3X4") == 0 ||
- strcmp(input_mode, "NUMONLY_3X4_SIG") == 0 ||
- strcmp(input_mode, "NUMONLY_3X4_DEC") == 0 ||
- strcmp(input_mode, "NUMONLY_3X4_SIGDEC") == 0 ||
- strcmp(input_mode, "DATETIME_3X4") == 0) {
- need_forward = TRUE;
- }
- }
- if (input_mode && strcmp (input_mode, "NUMONLY_3X4_SIGDEC") == 0 &&
- strcmp(event_desc.key_value, ".") == 0) {
- ime_update_preedit_string(_sig_dec[_click_count%SIG_DEC_SIZE], NULL);
- ime_show_preedit_string();
- delete_commit_timer();
- _commit_timer = ecore_timer_add(1.0, commit_timeout, NULL);
- _click_count++;
- } else if (event_desc.key_event) {
- commit_timeout(NULL);
- if (need_forward) {
- ise_forward_key_event(event_desc.key_event);
- } else {
- if (_cm_popup_opened) {
- static sclchar current_cm_symbol[2] = {'\0'};
- sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
- const_cast<sclchar*>(" "),
- const_cast<sclchar*>(" "),
- const_cast<sclchar*>(" ")};
- if (event_desc.key_value) {
- current_cm_symbol[0] = event_desc.key_value[0];
- current_cm_symbol[1] = '\0';
- }
- g_ui->set_private_key("CM_KEY",
- const_cast<sclchar*>(current_cm_symbol),
- imagelabel, NULL, 0,
- const_cast<sclchar*>(current_cm_symbol), TRUE);
-
- _cm_popup_opened = FALSE;
- _current_cm_key_id = -1;
- }
#ifdef _WEARABLE
- /*
- *
- *change the keyboard mode of GLM from QWERTY to KEYPAD
- *ensure the Number keypad won't be affected
- *
- */
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBER) {
- ime_send_key_event(IME_KEY_Print, IME_KEY_MASK_CONTROL, false);
- } else {
- ime_send_key_event(IME_KEY_Select, IME_KEY_MASK_CONTROL, false);
- }
+ if (event_desc.key_event == MVK_Done) {
+ LOGD("ENTER");
+ //commit the preedit string first
+ ise_send_event(event_desc.key_event, KEY_MASK_NULL);
+ }
#endif
- ise_send_event(event_desc.key_event, KEY_MASK_NULL);
- }
- }
- if (input_mode) {
- if ((strcmp(input_mode, "SYM_QTY_1") == 0) || (0 == strcmp(input_mode, "SYM_QTY_2"))) {
- update_recent_used_punctuation(event_desc.key_value);
- }
+ ise_send_event(event_desc.key_event, KEY_MASK_NULL);
+ if (event_desc.key_event == MVK_Shift_L) {
+ g_need_send_shift_event = TRUE;
+ }
+ }
+}
+
+void CUIEventCallback::on_event_character_key(CSCLUI *ui, SclUIEventDesc event_desc, KEYBOARD_STATE *keyboard_state)
+{
+ sclboolean need_forward = FALSE;
+ // FIXME : Should decide when to forward key events
+ const sclchar *input_mode = ui->get_input_mode();
+ if (input_mode) {
+ if (strcmp(input_mode, "SYM_QTY_1") == 0 ||
+ strcmp(input_mode, "SYM_QTY_2") == 0 ||
+ strcmp(input_mode, "PHONE_3X4") == 0 ||
+ strcmp(input_mode, "IPv6_3X4_123") == 0 ||
+ strcmp(input_mode, "IPv6_3X4_ABC") == 0 ||
+ strcmp(input_mode, "NUMONLY_3X4") == 0 ||
+ strcmp(input_mode, "NUMONLY_3X4_SIG") == 0 ||
+ strcmp(input_mode, "NUMONLY_3X4_DEC") == 0 ||
+ strcmp(input_mode, "NUMONLY_3X4_SIGDEC") == 0 ||
+ strcmp(input_mode, "DATETIME_3X4") == 0) {
+ need_forward = TRUE;
+ }
+ }
+ if (input_mode && strcmp (input_mode, "NUMONLY_3X4_SIGDEC") == 0 &&
+ event_desc.key_value && strcmp(event_desc.key_value, ".") == 0) {
+ ime_update_preedit_string(_sig_dec[_click_count%SIG_DEC_SIZE], NULL);
+ ime_show_preedit_string();
+ delete_commit_timer();
+ _commit_timer = ecore_timer_add(1.0, commit_timeout, NULL);
+ _click_count++;
+ } else if (event_desc.key_event) {
+ commit_timeout(NULL);
+ if (need_forward) {
+ ise_forward_key_event(event_desc.key_event);
+ } else {
+ if (_cm_popup_opened) {
+ static sclchar current_cm_symbol[2] = {'\0'};
+ sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
+ const_cast<sclchar*>(" "),
+ const_cast<sclchar*>(" "),
+ const_cast<sclchar*>(" ")};
+ if (event_desc.key_value) {
+ current_cm_symbol[0] = event_desc.key_value[0];
+ current_cm_symbol[1] = '\0';
}
- break;
+ ui->set_private_key("CM_KEY",
+ const_cast<sclchar*>(current_cm_symbol),
+ imagelabel, NULL, 0,
+ const_cast<sclchar*>(current_cm_symbol), TRUE);
+
+ _cm_popup_opened = FALSE;
+ _current_cm_key_id = -1;
}
- case KEY_TYPE_CONTROL: {
- commit_timeout(NULL);
-
- const char *long_shift = "LongShift";
- const char *caps_lock = "CapsLock";
- const char *delete_all = "DeleteAll";
- const char *hide_panel = "Hide";
- if (strncmp(event_desc.key_value, long_shift, strlen(long_shift)) == 0) {
- LOGD("shift key is longpress\n");
- g_ui->set_shift_state(SCL_SHIFT_STATE_ON);
- 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) {
- if (g_ui->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
- g_ui->set_shift_state(SCL_SHIFT_STATE_LOCK);
- ise_send_event(MVK_Shift_Lock, KEY_MASK_NULL);
- } else {
- g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
- ise_send_event(MVK_Shift_Off, KEY_MASK_NULL);
- }
- //g_need_send_shift_event = TRUE;
- } else if (strncmp(event_desc.key_value, delete_all, strlen(delete_all)) == 0) {
- ime_delete_surrounding_text((INT_MAX / 2) * -1, INT_MAX);
- } else if (strncmp(event_desc.key_value, hide_panel, strlen(hide_panel)) == 0) {
- ise_hide();
- ime_request_hide();
- } else if (event_desc.key_event) {
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE) {
- ise_stt_stop();
- }
- ise_send_event(event_desc.key_event, KEY_MASK_NULL);
- if (event_desc.key_event == MVK_Shift_L) {
- g_need_send_shift_event = TRUE;
- }
+#ifdef _WEARABLE
+ /*
+ * change the keyboard mode of GLM from QWERTY to KEYPAD
+ * ensure the Number keypad won't be affected
+ */
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_NUMBER) {
+ ime_send_key_event(IME_KEY_Print, IME_KEY_MASK_CONTROL, false);
+ } else {
+ Candidate *candidate = get_candidate();
+ if (word_timer == NULL && (!candidate || !candidate->get_visible())) {
+ word_timer = ecore_timer_add(MULTITAP_TIMEOUT, _multi_tap_timer_cb, NULL);
}
- break;
- }
- case KEY_TYPE_MODECHANGE:
-#ifdef _MOBILE
- if (_guide_popup_setting != NULL) {//popup is showing
- break;
+ ime_send_key_event(IME_KEY_Select, IME_KEY_MASK_CONTROL, false);
}
#endif
- if (strcmp(event_desc.key_value, USER_VOICE_LANGUAGE) == 0) {
- if (!g_setting_window_open_status) {
- ise_hide_stt_mode();
+ ise_send_event(event_desc.key_event, KEY_MASK_NULL);
+ }
+ }
+
+ if (input_mode) {
+ if ((strcmp(input_mode, "SYM_QTY_1") == 0) || (0 == strcmp(input_mode, "SYM_QTY_2"))) {
+ update_recent_used_punctuation(event_desc.key_value);
+ }
+ }
+}
+
+void CUIEventCallback::on_event_modechange_key(CSCLUI *ui, SclUIEventDesc event_desc, KEYBOARD_STATE *keyboard_state, SCLEventReturnType &ret)
+{
+#if defined(_MOBILE) || defined(_COMMON)
+ if (guide_popup_get_visible()) {//popup is showing
+ return;
+ }
+#endif
+
+ if (strcmp(event_desc.key_value, USER_VOICE_LANGUAGE) == 0) {
+ if (!get_setting_window_open_status()) {
+ ise_hide_stt_mode();
#ifdef _WEARABLE
- hide_indicator_window();
+ hide_indicator_window();
#endif
- create_setting_window();
- }
- } else if (strcmp(event_desc.key_value, USER_KEYSTRING_VOICE) == 0) {
- g_keyboard_state.layout = ISE_LAYOUT_STYLE_VOICE;
- g_ui->set_input_mode("STT_3X4");
+ create_setting_window();
+ }
+ } else if (strcmp(event_desc.key_value, USER_KEYSTRING_VOICE) == 0) {
+ keyboard_state->layout = ISE_LAYOUT_STYLE_VOICE;
+ ui->set_input_mode("STT_3X4");
- } else if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
- launch_option();
+ } else if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
+ launch_option();
- ret = SCL_EVENT_DONE;
- } else if (strcmp(event_desc.key_value, USER_KEYSTRING_CLIPBOARD) == 0) {
- show_cbhm();
+ ret = SCL_EVENT_DONE;
+ } else if (strcmp(event_desc.key_value, USER_KEYSTRING_FLOATING) == 0) {
+ CONFIG_VALUES *config_values = get_config_values();
- ret = SCL_EVENT_DONE;
- } else if (strcmp(event_desc.key_value, USER_KEYSTRING_FLOATING) == 0) {
- if (g_floating_mode)
- g_config_values.floating_mode = false;
- else
- g_config_values.floating_mode = true;
- write_ise_config_values();
+ if (g_floating_mode) {
+ if (config_values) {
+ config_values->floating_mode = false;
+ }
+ } else {
+ if (config_values) {
+ config_values->floating_mode = true;
+ }
+ }
+ write_ise_config_values();
- ret = SCL_EVENT_DONE;
- } else if (on_input_mode_changed(event_desc.key_value, event_desc.key_event, event_desc.key_type)) {
- ret = SCL_EVENT_DONE;
+ ret = SCL_EVENT_DONE;
+ } else if (strcmp(event_desc.key_value, USER_KEYSTRING_STICKER) == 0) {
+ SCLRotation rotation = ui->get_rotation();
+ ise_sticker_show_layout(STICKER_GROUP_RECENTLY_USED, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
+ } else if (strcmp(event_desc.key_value, USER_KEYSTRING_TRANSLATION) == 0) {
+ if (ise_sticker_is_show())
+ ise_sticker_destroy_layout();
+
+ SCLRotation rotation = ui->get_rotation();
+ ise_nmt_show_layout(ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
+ } else if (on_input_mode_changed(event_desc.key_value, event_desc.key_event, event_desc.key_type)) {
+ ret = SCL_EVENT_DONE;
+ }
+
+ if (_cm_popup_opened) {
+ if (strcmp(event_desc.key_value, USER_KEYSTRING_EMOTICON) == 0 ||
+ strcmp(event_desc.key_value, USER_KEYSTRING_VOICE) == 0 ||
+ strcmp(event_desc.key_value, USER_KEYSTRING_FLOATING) == 0 ||
+ strcmp(event_desc.key_value, USER_KEYSTRING_STICKER) == 0 ||
+ strcmp(event_desc.key_value, USER_KEYSTRING_TRANSLATION) == 0) {
+ scluint id = ise_get_cm_key_id(event_desc.key_value);
+ if (id != _current_cm_key_id) {
+ _current_cm_key_id = id;
+ ise_set_cm_private_key(_current_cm_key_id);
}
- if (_cm_popup_opened) {
- if (strcmp(event_desc.key_value, USER_KEYSTRING_EMOTICON) == 0 ||
- strcmp(event_desc.key_value, USER_KEYSTRING_VOICE) == 0 ||
- strcmp(event_desc.key_value, USER_KEYSTRING_FLOATING) == 0) {
- scluint id = ise_get_cm_key_id(event_desc.key_value);
- if (id != _current_cm_key_id) {
- _current_cm_key_id = id;
- ise_set_cm_private_key(_current_cm_key_id);
- }
- }
- _cm_popup_opened = FALSE;
+ }
+ _cm_popup_opened = FALSE;
+ }
+
+ if (strlen(event_desc.key_value) == 1) {
+ const char allowed_chars_in_modechange[] = {
+ ',', '?', '!', '`', '~', '@', '-'
+ };
+ const int allowed_chars_in_modechange_num =
+ sizeof(allowed_chars_in_modechange) / sizeof(char);
+ for (unsigned int loop = 0;loop < sizeof(allowed_chars_in_modechange_num);loop++) {
+ if (*(event_desc.key_value) == allowed_chars_in_modechange[loop]) {
+ ise_send_string(event_desc.key_value);
}
- if (strlen(event_desc.key_value) == 1) {
- const char allowed_chars_in_modechange[] = {
- ',', '?', '!', '`', '~'
- };
- const int allowed_chars_in_modechange_num =
- sizeof(allowed_chars_in_modechange) / sizeof(char);
- for (unsigned int loop = 0;loop < sizeof(allowed_chars_in_modechange_num);loop++) {
- if (*(event_desc.key_value) == allowed_chars_in_modechange[loop]) {
- ise_send_string(event_desc.key_value);
- }
- }
+ }
+ }
+}
+
+void CUIEventCallback::process_user_key(CSCLUI *ui, SclUIEventDesc event_desc, KEYBOARD_STATE *keyboard_state, SCLEventReturnType &ret)
+{
+ if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
+ //open_option_window(NULL, ROTATION_TO_DEGREE(ui->get_rotation()));
+ launch_option();
+
+ ret = SCL_EVENT_DONE;
+ } else if (strcmp(event_desc.key_value, "Cancel") == 0) {
+ ret = SCL_EVENT_DONE;
+ const sclchar *input_mode = ui->get_input_mode();
+ if (input_mode && strcmp(input_mode, "STT_3X4") == 0 ) {
+ keyboard_state->need_reset = TRUE;
+ voice_result_string_flush();
+ ise_set_layout(keyboard_state->layout, keyboard_state->layout_variation);
+ if (keyboard_state->visible_state)
+ ise_show(keyboard_state->ic);
+ }
+#ifdef _TV
+ ise_send_event(IME_KEY_Cancel, KEY_MASK_NULL);
+ ime_request_hide();
+#endif
+ } else if (strcmp(event_desc.key_value, "Done") == 0) {
+#ifdef _TV
+ ret = SCL_EVENT_DONE;
+ ise_send_event(IME_KEY_Return, KEY_MASK_NULL);
+ ime_request_hide();
+#endif
+ } else if (strcmp(event_desc.key_value, "Translate") == 0) {
+ ise_nmt_translate();
+ } else {
+ const sclchar *input_mode = ui->get_input_mode();
+ if ((NULL != input_mode) && (!strcmp(input_mode, "EMOTICON_LAYOUT"))) {
+ if (ise_emoticon_is_show()) {
+ ise_emoticon_destroy_layout();
}
- break;
- case KEY_TYPE_USER:
- if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
- //open_option_window(NULL, ROTATION_TO_DEGREE(g_ui->get_rotation()));
- launch_option();
-
- ret = SCL_EVENT_DONE;
- } else if (strcmp(event_desc.key_value, USER_KEYSTRING_CLIPBOARD) == 0) {
- show_cbhm();
- 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 ) {
- g_keyboard_state.need_reset = TRUE;
- voice_result_string_flush();
- ise_set_layout(g_keyboard_state.layout, g_keyboard_state.layout_variation);
- if (g_keyboard_state.visible_state)
- ise_show(g_keyboard_state.ic);
- }
- ise_send_event(IME_KEY_Cancel, KEY_MASK_NULL);
- ime_request_hide();
- } else if (strcmp(event_desc.key_value, "Done") == 0) {
- ret = SCL_EVENT_DONE;
- ise_send_event(IME_KEY_Return, KEY_MASK_NULL);
- ime_request_hide();
- } else {
- const sclchar *input_mode = g_ui->get_input_mode();
- if ((NULL != input_mode) && (!strcmp(input_mode, "EMOTICON_LAYOUT"))) {
- if (is_emoticon_show()) {
- ise_destroy_emoticon_layout();
- }
#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);
+ emoticon_group_t group_id = EMOTICON_GROUP_1;
+ if (ise_emoticon_get_current_group() < EMOTICON_GROUP_3)
+ group_id = (emoticon_group_t)(ise_emoticon_get_current_group() + 1);
- ise_set_emoticon_label(group_id);
+ ise_set_emoticon_label(group_id);
#else
- emoticon_group_t group_id = ise_get_emoticon_group_id(event_desc.key_value);
+ emoticon_group_t group_id = ise_emoticon_get_group_id(event_desc.key_value);
#endif
- if ((group_id >= 0) && (group_id < MAX_EMOTICON_GROUP)) {
- SCLRotation rotation = g_ui->get_rotation();
- ise_show_emoticon_layout(group_id, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
- }
- }
+ if ((group_id >= 0) && (group_id < MAX_EMOTICON_GROUP)) {
+ SCLRotation rotation = ui->get_rotation();
+ ise_emoticon_show_layout(group_id, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
}
- if (_cm_popup_opened) {
- if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0 ||
- strcmp(event_desc.key_value, USER_KEYSTRING_CLIPBOARD) == 0) {
- scluint id = ise_get_cm_key_id(event_desc.key_value);
- if (id != _current_cm_key_id) {
- _current_cm_key_id = id;
- ise_set_cm_private_key(_current_cm_key_id);
- }
- }
- _cm_popup_opened = FALSE;
+ }
+
+ if (input_mode && (!strcmp(input_mode, "STICKER_LAYOUT"))) {
+ if (ise_sticker_is_show())
+ ise_sticker_change_group(ise_sticker_get_group_id(event_desc.key_value));
+ }
+ }
+
+ if (_cm_popup_opened) {
+ if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0 ||
+ strcmp(event_desc.key_value, USER_KEYSTRING_STICKER) == 0 ||
+ strcmp(event_desc.key_value, USER_KEYSTRING_TRANSLATION) == 0) {
+ scluint id = ise_get_cm_key_id(event_desc.key_value);
+ if (id != _current_cm_key_id) {
+ _current_cm_key_id = id;
+ ise_set_cm_private_key(_current_cm_key_id);
}
+ }
+ _cm_popup_opened = FALSE;
+ }
+}
+
+SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_desc)
+{
+ SCLEventReturnType ret = SCL_EVENT_PASS_ON;
+ if (word_timer != NULL) {
+ ecore_timer_del(word_timer);
+ word_timer = NULL;
+ }
+
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return ret;
+
+ if (event_desc.key_modifier == KEY_MODIFIER_MULTITAP_START) {
+ if (!keyboard_state->multitap_value.empty()) {
+ ise_send_string(keyboard_state->multitap_value.c_str());
+ }
+ ise_update_preedit_string(event_desc.key_value);
+ keyboard_state->multitap_value = event_desc.key_value;
+ } else if (event_desc.key_modifier == KEY_MODIFIER_MULTITAP_REPEAT) {
+ ise_update_preedit_string(event_desc.key_value);
+ keyboard_state->multitap_value = event_desc.key_value;
+ } else {
+ _reset_multitap_state();
+ }
+ keyboard_state->prev_modifier = event_desc.key_modifier;
+
+ CSCLUI *ui = get_ui();
+ if (ui) {
+ switch (event_desc.key_type) {
+ case KEY_TYPE_STRING:
+ on_event_string_key(ui, event_desc);
+ break;
+ case KEY_TYPE_CHAR:
+ on_event_character_key(ui, event_desc, keyboard_state);
+ break;
+ case KEY_TYPE_CONTROL:
+ on_event_control_key(ui, event_desc, keyboard_state);
+ break;
+ case KEY_TYPE_MODECHANGE:
+ on_event_modechange_key(ui, event_desc, keyboard_state, ret);
+ break;
+ case KEY_TYPE_USER:
+ process_user_key(ui, event_desc, keyboard_state, ret);
break;
default:
break;
ise_set_layout(sclu32 layout, sclu32 layout_variation)
{
/* Check if the layoutIdx is in the valid range */
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
if (layout < ISE_LAYOUT_STYLE_MAX) {
- if (g_keyboard_state.layout != layout ||
- g_keyboard_state.layout_variation != layout_variation) {
- g_keyboard_state.need_reset = TRUE;
+ if (keyboard_state->layout != layout ||
+ keyboard_state->layout_variation != layout_variation) {
+ keyboard_state->need_reset = TRUE;
}
- g_keyboard_state.layout = layout;
- g_keyboard_state.layout_variation = layout_variation;
- LOGD("layout:%d, variation:%d\n", g_keyboard_state.layout, g_keyboard_state.layout_variation);
+ keyboard_state->layout = layout;
+ keyboard_state->layout_variation = layout_variation;
+ LOGD("layout:%d, variation:%d\n", keyboard_state->layout, keyboard_state->layout_variation);
}
}
{
LOGD("");
_reset_multitap_state(true);
- _language_manager.reset_language(g_config_values.selected_language.c_str());
+ CONFIG_VALUES *config_values = get_config_values();
+ if (config_values) {
+ _language_manager.reset_language(config_values->selected_language.c_str());
+ }
}
void
{
LOGD("");
_reset_multitap_state(true);
- g_keyboard_state.disable_force_latin = FALSE;
- _language_manager.reset_language(g_config_values.selected_language.c_str());
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (keyboard_state) keyboard_state->disable_force_latin = FALSE;
+ CONFIG_VALUES *config_values = get_config_values();
+ if (config_values) {
+ _language_manager.reset_language(config_values->selected_language.c_str());
+ }
}
void
ise_focus_in(int ic)
{
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+
LOGD("ic : %x , %x , g_ic : %x , %x, g_focused_ic : %x , %x\n", ic, check_ic_temporary(ic),
- g_keyboard_state.ic, check_ic_temporary(g_keyboard_state.ic),
- g_keyboard_state.focused_ic, check_ic_temporary(g_keyboard_state.focused_ic));
- if (check_ic_temporary(g_keyboard_state.ic) && !check_ic_temporary(ic)) {
- g_keyboard_state.ic = ic;
+ keyboard_state->ic, check_ic_temporary(keyboard_state->ic),
+ keyboard_state->focused_ic, check_ic_temporary(keyboard_state->focused_ic));
+ if (check_ic_temporary(keyboard_state->ic) && !check_ic_temporary(ic)) {
+ keyboard_state->ic = ic;
}
- g_keyboard_state.focused_ic = ic;
+ keyboard_state->focused_ic = ic;
}
static void save_autofill_data()
char *text = NULL;
int cursor;
- if (g_autofill_hint == 0)
+ if (ime_autofill_get_hint() == 0)
return;
ime_get_surrounding_text(-1, -1, &text, &cursor);
SECURE_LOGD("surrounding text : %s\n", text);
if (!text) return;
- autofill_save_string(g_app_id.c_str(), g_resource_id.c_str(), (Ecore_IMF_Input_Hints)g_autofill_hint, text);
+ ime_autofill_save_string(text);
free(text);
}
void
ise_focus_out(int ic)
{
- g_keyboard_state.focused_ic = 0;
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (keyboard_state) keyboard_state->focused_ic = 0;
_reset_multitap_state(true);
save_autofill_data();
void
ise_show(int ic)
{
+ CONFIG_VALUES *config_values = get_config_values();
#if EXIT_ISE_ON_HIDE
if (exit_timer) ecore_timer_del(exit_timer);
exit_timer = NULL;
sclboolean reset_inputmode = FALSE;
g_input_panel_show = true;
- if (g_ui) {
+ CSCLUI *ui = get_ui();
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (ui && keyboard_state) {
read_ise_config_values();
- _language_manager.set_enabled_languages(g_config_values.enabled_languages);
+ if (config_values) {
+ _language_manager.set_enabled_languages(config_values->enabled_languages);
+ }
const sclchar *cur_lang = _language_manager.get_current_language();
#ifdef _WEARABLE
/*
*Clear the personalized data
*/
- if (g_config_values.dataclear) {
+ if (config_values && config_values->dataclear) {
ime_send_key_event(IME_KEY_Clear, IME_KEY_MASK_CONTROL, false);
- g_config_values.dataclear = FALSE;
+ config_values->dataclear = FALSE;
}
#endif
LOGD("ic : %x , %x , g_ic : %x , %x, g_focused_ic : %x , %x\n", ic, check_ic_temporary(ic),
- g_keyboard_state.ic, check_ic_temporary(g_keyboard_state.ic),
- g_keyboard_state.focused_ic, check_ic_temporary(g_keyboard_state.focused_ic));
+ keyboard_state->ic, check_ic_temporary(keyboard_state->ic),
+ keyboard_state->focused_ic, check_ic_temporary(keyboard_state->focused_ic));
- if (check_ic_temporary(ic) && !check_ic_temporary(g_keyboard_state.focused_ic)) {
- ic = g_keyboard_state.focused_ic;
+ if (check_ic_temporary(ic) && !check_ic_temporary(keyboard_state->focused_ic)) {
+ ic = keyboard_state->focused_ic;
}
- if (!check_ic_temporary(ic) && check_ic_temporary(g_keyboard_state.focused_ic)) {
- g_keyboard_state.focused_ic = ic;
+ if (!check_ic_temporary(ic) && check_ic_temporary(keyboard_state->focused_ic)) {
+ keyboard_state->focused_ic = ic;
}
- if (ic == g_keyboard_state.focused_ic) {
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_IP ||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_MONTH ||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY) {
- ime_set_imengine(DEFAULT_KEYBOARD_ISE_UUID);
+ if (ic == keyboard_state->focused_ic) {
+ switch (keyboard_state->layout)
+ {
+ case ISE_LAYOUT_STYLE_PHONENUMBER:
+ case ISE_LAYOUT_STYLE_IP:
+ case ISE_LAYOUT_STYLE_MONTH:
+ case ISE_LAYOUT_STYLE_NUMBERONLY:
+ ime_set_imengine(DEFAULT_KEYBOARD_ISE_UUID);
+ break;
+ default:
+ break;
}
}
+ const char *input_mode = ui->get_input_mode();
+
/* Reset input mode if the input context value has changed */
- if (ic != g_keyboard_state.ic) {
+ if (ic != 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 (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;
}
}
- g_keyboard_state.ic = ic;
+ keyboard_state->ic = ic;
/* Reset input mode if the current language is not the selected language */
if (cur_lang) {
- if (g_config_values.selected_language.compare(cur_lang) != 0) {
+ if (config_values && config_values->selected_language.compare(cur_lang) != 0) {
reset_inputmode = TRUE;
}
}
/* No matter what, just reset the inputmode if it needs to */
- if (g_keyboard_state.need_reset) {
+ if (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 (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;
}
}
- g_keyboard_state.need_reset = FALSE;
+ keyboard_state->need_reset = FALSE;
/* If the current layout requires latin language and current our language is not latin, enable the primary latin */
sclboolean force_primary_latin = FALSE;
- LANGUAGE_INFO *info = _language_manager.get_language_info(g_config_values.selected_language.c_str());
+ LANGUAGE_INFO *info =
+ (config_values ? _language_manager.get_language_info(config_values->selected_language.c_str()) : NULL);
if (info) {
- if (g_ise_default_values[g_keyboard_state.layout].force_latin && !(info->is_latin_language)) {
- if (!g_keyboard_state.disable_force_latin) {
- force_primary_latin = TRUE;
+ if (!info->is_latin_language) {
+ if (!keyboard_state->disable_force_latin) {
+ if (g_ise_default_values[keyboard_state->layout].force_latin) {
+ force_primary_latin = TRUE;
+ }
+ else {
+ if (keyboard_state->prefer_latin) {
+ force_primary_latin = TRUE;
+ }
+ }
}
}
}
+
if (force_primary_latin) {
/* If there is enabled latin-based language, select it */
sclboolean selected = FALSE;
bool filename_layout = false;
/* Turn the shift state off if we need to reset our input mode, only when auto-capitalization is not set */
- if (!(g_keyboard_state.caps_mode)) {
- g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
+ if (!(keyboard_state->caps_mode)) {
+ ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
- if (g_keyboard_state.layout < ISE_LAYOUT_STYLE_MAX) {
- sclu32 layout_index = g_keyboard_state.layout;
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY &&
- g_keyboard_state.layout_variation > 0 &&
- g_keyboard_state.layout_variation < ISE_LAYOUT_NUMBERONLY_VARIATION_MAX) {
- layout_index = ISE_LAYOUT_STYLE_NUMBERONLY_SIG + g_keyboard_state.layout_variation - 1;
- } else if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PASSWORD && g_keyboard_state.layout_variation > 0) {
+ if (keyboard_state->layout < ISE_LAYOUT_STYLE_MAX) {
+ sclu32 layout_index = keyboard_state->layout;
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_NUMBERONLY &&
+ keyboard_state->layout_variation > 0 &&
+ keyboard_state->layout_variation < ISE_LAYOUT_NUMBERONLY_VARIATION_MAX) {
+ layout_index = ISE_LAYOUT_STYLE_NUMBERONLY_SIG + keyboard_state->layout_variation - 1;
+ } else if (keyboard_state->layout == ISE_LAYOUT_STYLE_PASSWORD && keyboard_state->layout_variation > 0) {
layout_index = ISE_LAYOUT_STYLE_PASSWD_3X4;
}
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_NORMAL &&
- g_keyboard_state.layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL_VARIATION_FILENAME)
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_NORMAL &&
+ keyboard_state->layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL_VARIATION_FILENAME)
filename_layout = true;
else
filename_layout = false;
- g_ui->enable_button("exclamation", !filename_layout);
- g_ui->enable_button("question", !filename_layout);
- g_ui->enable_button("divide", !filename_layout);
- g_ui->enable_button("multiply", !filename_layout);
- g_ui->enable_button("colon", !filename_layout);
- g_ui->enable_button("quotation", !filename_layout);
+ ui->enable_button("exclamation", !filename_layout);
+ ui->enable_button("question", !filename_layout);
+ ui->enable_button("divide", !filename_layout);
+ ui->enable_button("multiply", !filename_layout);
+ ui->enable_button("colon", !filename_layout);
+ ui->enable_button("quotation", !filename_layout);
- g_ui->enable_button("CM_KEY", !access("/home", X_OK));
+ ui->enable_button("CM_KEY", !access("/home", X_OK));
LOGD("new layout index : %d\n", layout_index);
/* If this layout requires specific input mode, set it */
if (strlen(g_ise_default_values[layout_index].input_mode) > 0) {
- g_ui->set_input_mode(g_ise_default_values[layout_index].input_mode);
+ ui->set_input_mode(g_ise_default_values[layout_index].input_mode);
set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_NONE);
} else {
if (force_primary_latin) {
_language_manager.select_language(PRIMARY_LATIN_LANGUAGE, TRUE);
- } else {
- if (!(_language_manager.select_language(g_config_values.selected_language.c_str()))) {
+ } else if (config_values) {
+ if (!(_language_manager.select_language(config_values->selected_language.c_str()))) {
_language_manager.select_language(PRIMARY_LATIN_LANGUAGE);
}
}
}
- g_ui->set_cur_sublayout(g_ise_default_values[layout_index].sublayout_name);
- if (is_emoticon_show()) {
- ise_destroy_emoticon_layout();
+ ui->set_cur_sublayout(g_ise_default_values[layout_index].sublayout_name);
+ if (ise_emoticon_is_show()) {
+ ise_emoticon_destroy_layout();
}
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_EMOTICON) {
- ise_init_emoticon_list();
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_EMOTICON) {
+ ise_emoticon_init_list();
#ifdef _WEARABLE
- current_emoticon_group = EMOTICON_GROUP_1;
+ ise_emoticon_set_current_group(EMOTICON_GROUP_1);
ise_set_emoticon_label(1);
#else
- if (emoticon_list_recent.size() == 0)
- current_emoticon_group = EMOTICON_GROUP_1;
+ if (ise_emoticon_get_recent_list_size() == 0)
+ ise_emoticon_set_current_group(EMOTICON_GROUP_1);
else
- current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
+ ise_emoticon_set_current_group(EMOTICON_GROUP_RECENTLY_USED);
#endif
- SCLRotation rotation = g_ui->get_rotation();
- ise_show_emoticon_layout(current_emoticon_group, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
+ SCLRotation rotation = ui->get_rotation();
+ ise_emoticon_show_layout(ise_emoticon_get_current_group(), ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
}
+
+ if (ise_sticker_is_show())
+ ise_sticker_destroy_layout();
+
+ if (ise_nmt_is_show())
+ ise_nmt_destroy_layout();
}
}
if (info) {
if (info->accepts_caps_mode) {
// FIXME this if condition means the AC is off
- if (g_keyboard_state.layout != ISE_LAYOUT_STYLE_NORMAL) {
- g_ui->set_autocapital_shift_state(TRUE);
- g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
+ if (keyboard_state->layout != ISE_LAYOUT_STYLE_NORMAL) {
+ ui->set_autocapital_shift_state(TRUE);
+ ui->set_shift_state(SCL_SHIFT_STATE_OFF);
} else {
ise_send_event(MVK_Shift_Enable, KEY_MASK_NULL);
// Auto Capital is supported only in normal layout
- if (g_keyboard_state.caps_mode) {
- g_ui->set_autocapital_shift_state(FALSE);
+ if (keyboard_state->caps_mode) {
+ ui->set_autocapital_shift_state(FALSE);
}
}
} else {
- g_ui->set_autocapital_shift_state(TRUE);
+ ui->set_autocapital_shift_state(TRUE);
ise_send_event(MVK_Shift_Disable, KEY_MASK_NULL);
- g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
+ ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
} else {
- g_ui->set_autocapital_shift_state(TRUE);
+ ui->set_autocapital_shift_state(TRUE);
}
// Update CM key button
// Update space key button
ise_update_space_key();
- g_ui->show();
- g_ui->disable_input_events(FALSE);
+ ui->show();
+ ui->disable_input_events(FALSE);
#ifdef _IVI
- g_ui->enable_button("CM_KEY", false);
+ ui->enable_button("CM_KEY", false);
#endif
-#ifdef _MOBILE
+#if defined(_MOBILE) || defined(_COMMON)
if (ise_is_guideline_popup_enable_layout()) {
- if ((!g_config_values.first_guidechange) && (_language_manager.get_enabled_languages_num() > 1)) {
- ise_show_help_popup(MVK_space);
+ if ((config_values && config_values->first_guidechange) && (_language_manager.get_enabled_languages_num() > 1)) {
+ ise_show_help_popup(MVK_space, NATIVE_WINDOW_CAST(ime_get_main_window()));
LOGD("space popup show\n");
} else {
- ise_destory_popup_space();
+ ise_destroy_popup_space();
}
}
#endif
// Update IME size
- if (g_config_values.floating_mode != g_floating_mode)
- g_floating_mode = g_config_values.floating_mode;
+ if (config_values && config_values->floating_mode != g_floating_mode)
+ g_floating_mode = config_values->floating_mode;
- if (g_candidate && g_candidate->get_visible())
+ Candidate *candidate = get_candidate();
+ if (candidate && candidate->get_visible())
set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
else
set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_NONE);
}
- g_keyboard_state.visible_state = TRUE;
+ keyboard_state->visible_state = TRUE;
#ifdef _WEARABLE
int dot_num = 5;
if (dot_num > 0) {
sclint width = 0;
sclint height = 0;
- if (g_ui)
- g_ui->get_screen_resolution(&width, &height);
+ if (ui)
+ ui->get_screen_resolution(&width, &height);
create_indicator_window(width, height);
destroy_indicator_dots();
int focus_dot = 0;
- switch (g_keyboard_state.layout) {
+ switch (keyboard_state->layout) {
case ISE_LAYOUT_STYLE_NUMBER:
focus_dot = 1;
break;
} else {
hide_indicator_window();
}
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_NORMAL && g_config_values.number_tutorial_enable) {
- ise_show_tutorial_mode_popup(g_keyboard_state.layout);
- g_config_values.number_tutorial_enable = false;
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_NORMAL && config_values && config_values->number_tutorial_enable) {
+ ise_show_tutorial_mode_popup(keyboard_state->layout);
+ config_values->number_tutorial_enable = false;
write_ise_config_values();
}
#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 (g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE) {
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_VOICE) {
ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
}
}
void
ise_set_screen_rotation(int degree)
{
- if (g_ui) {
- g_ui->set_rotation(DEGREE_TO_SCLROTATION(degree));
+ CSCLUI *ui = get_ui();
+ if (ui) {
+ ui->set_rotation(DEGREE_TO_SCLROTATION(degree));
}
- if (g_candidate) {
- g_candidate->rotate(degree);
- if (g_softcandidate_show) {
- g_candidate->update(g_softcandidate_string);
+ Candidate *candidate = get_candidate();
+ if (candidate) {
+ candidate->rotate(degree);
+ if (candidate->get_visible()) {
+ candidate->update(g_softcandidate_string);
}
}
}
void
ise_set_accessibility_state(bool state)
{
- if (g_ui) {
- g_ui->enable_tts(state);
+ CSCLUI *ui = get_ui();
+ if (ui) {
+ ui->enable_tts(state);
}
}
void
ise_hide()
{
- if (g_ui) {
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ CSCLUI *ui = get_ui();
+ if (ui) {
/* There's no need to update screen when hiding */
- g_ui->set_update_pending(TRUE);
- g_ui->disable_input_events(TRUE);
- g_ui->hide();
+ ui->set_update_pending(TRUE);
+ ui->disable_input_events(TRUE);
+ ui->hide();
+ }
+ CONFIG_VALUES *config_values = get_config_values();
+ if (config_values) {
+ _language_manager.reset_language(config_values->selected_language.c_str());
}
- _language_manager.reset_language(g_config_values.selected_language.c_str());
_click_count = 0;
delete_commit_timer();
- ise_destory_popup_space();
- ise_destory_popup_setting();
+ ise_destroy_popup_space();
+ ise_destroy_popup_setting();
- g_keyboard_state.visible_state = FALSE;
+ if (keyboard_state) keyboard_state->visible_state = FALSE;
_reset_shift_state();
_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 (ui && keyboard_state) {
+ const char *inputmode = ui->get_input_mode();
+ if (inputmode && strcmp(inputmode, "STT_3X4") == 0 ) {
+ keyboard_state->need_reset = TRUE;
+ ise_hide_stt_mode();
+ }
}
g_input_panel_show = false;
- if (g_softcandidate_show && g_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();
{
read_ise_sound_mode();
- g_ui->enable_sound(g_config_values.sound_on);
+ CONFIG_VALUES *config_values = get_config_values();
+ CSCLUI *ui = get_ui();
+ if (config_values && ui) {
+ ui->enable_sound(config_values->sound_on);
+ }
}
static void ise_vibration_mode_changed_cb(const char *key, void *user_data)
{
read_ise_vibration_mode();
- g_ui->enable_vibration(g_config_values.vibration_on);
+ CONFIG_VALUES *config_values = get_config_values();
+ CSCLUI *ui = get_ui();
+ if (config_values && ui) {
+ ui->enable_vibration(config_values->vibration_on);
+ }
}
static void ise_character_preview_mode_changed_cb(const char *key, void *user_data)
{
read_ise_character_preview_mode();
- g_ui->enable_magnifier(g_config_values.preview_on);
+ CONFIG_VALUES *config_values = get_config_values();
+ CSCLUI *ui = get_ui();
+ if (config_values && ui) {
+ ui->enable_magnifier(config_values->preview_on);
+ }
}
static void ise_setting_guide_popup_changed_cb(const char *key, void *user_data)
static void ise_floating_mode_changed_cb(const char *key, void *user_data)
{
read_ise_floating_mode();
- g_floating_mode = g_config_values.floating_mode;
+ CONFIG_VALUES *config_values = get_config_values();
+ if (config_values) {
+ g_floating_mode = config_values->floating_mode;
+ }
ime_set_floating_mode(g_floating_mode);
if (g_candidate && g_floating_mode != g_candidate->get_floating_mode()) {
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;
{
LOGD("");
+ CONFIG_VALUES *config_values = get_config_values();
+
if (!g_ui) {
g_ui = new CSCLUI;
}
sclboolean succeeded = FALSE;
const sclchar *entry_path = MAIN_ENTRY_XML_PATH;
- int nwidth = 0;
- int nheight = 0;
- CSCLUtils *utils = CSCLUtils::get_instance();
- if (utils) {
- utils->get_screen_resolution(&nwidth, &nheight);
- }
_language_manager.set_resource_file_path(entry_path);
const sclchar *resource_file_path = _language_manager.get_resource_file_path();
}
read_ise_config_values();
- _language_manager.set_enabled_languages(g_config_values.enabled_languages);
- _language_manager.select_language(g_config_values.selected_language.c_str());
- vconf_set_bool(VCONFKEY_AUTOCAPITAL_ALLOW_BOOL, g_config_values.auto_capitalise);
- vconf_set_bool(VCONFKEY_AUTOPERIOD_ALLOW_BOOL, g_config_values.auto_punctuate);
- g_ui->enable_sound(g_config_values.sound_on);
- g_ui->enable_vibration(g_config_values.vibration_on);
- g_ui->enable_magnifier(g_config_values.preview_on);
+ if (access(ISE_CONFIG_FILE_PATH, F_OK) == 0 && !config_values->init_flag)
+ read_ise_config_file();
+
+ if (config_values) {
+ _language_manager.set_enabled_languages(config_values->enabled_languages);
+ _language_manager.select_language(config_values->selected_language.c_str());
+ vconf_set_bool(VCONFKEY_AUTOCAPITAL_ALLOW_BOOL, config_values->auto_capitalise);
+ vconf_set_bool(VCONFKEY_AUTOPERIOD_ALLOW_BOOL, config_values->auto_punctuate);
+ g_ui->enable_sound(config_values->sound_on);
+ g_ui->enable_vibration(config_values->vibration_on);
+ g_ui->enable_magnifier(config_values->preview_on);
+ g_floating_mode = config_values->floating_mode;
+ }
#ifdef _TV
g_ui->enable_highlight_ui(TRUE);
#endif
- g_floating_mode = g_config_values.floating_mode;
ime_set_floating_mode(g_floating_mode);
}
{
ise_hide_stt_mode();
- if (g_ui) {
- LOGD("calling g_ui->fini()\n");
- g_ui->fini();
- LOGD("deleting g_ui\n");
- delete g_ui;
+ CSCLUI *ui = get_ui();
+ if (ui) {
+ LOGD("calling ui->fini()\n");
+ ui->fini();
+ LOGD("deleting ui\n");
+ delete ui;
+ ui = NULL;
g_ui = NULL;
}
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;
- if (g_candidate) {
- g_candidate->show();
+ Candidate *candidate = get_candidate();
+ if (candidate) {
+ candidate->show();
set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
}
}
{
LOGD("Enter\n");
- if (!g_candidate || !g_softcandidate_show) {
+ Candidate *candidate = get_candidate();
+ if (!candidate || !candidate->get_visible()) {
LOGD("No candidate\n");
return;
}
- if (g_ic_smartreply != -1 || g_autofill_exist)
+ if (g_ic_smartreply != -1 || ime_autofill_get_exist())
return;
add_softcandidate_hide_timer();
#ifdef _WEARABLE
void ise_check_wearable_candidate()
{
- if (!g_config_values.prediction_on) {
+ CONFIG_VALUES *config_values = get_config_values();
+ if (!config_values) return;
+
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+
+ if (!config_values->prediction_on) {
ise_app_candidate_hide();
- } else if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE ||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_IP ||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_MONTH ||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY ||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_PASSWD_3X4||
- g_keyboard_state.layout == ISE_LAYOUT_STYLE_PASSWORD) {
+ } else if (keyboard_state->layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
+ keyboard_state->layout == ISE_LAYOUT_STYLE_VOICE ||
+ keyboard_state->layout == ISE_LAYOUT_STYLE_IP ||
+ keyboard_state->layout == ISE_LAYOUT_STYLE_MONTH ||
+ keyboard_state->layout == ISE_LAYOUT_STYLE_NUMBERONLY ||
+ keyboard_state->layout == ISE_LAYOUT_STYLE_PASSWD_3X4||
+ keyboard_state->layout == ISE_LAYOUT_STYLE_PASSWORD) {
ise_app_candidate_hide();
} else {
- g_softcandidate_show = true;
ise_app_candidate_show();
}
}
const int BUF_LEN = 16;
char buf[BUF_LEN] = {0};
snprintf(buf, BUF_LEN, "%d/3", group_id);
- g_ui->set_private_key("EMOTICON_GROUP_ID", buf, NULL, NULL, 0, const_cast<sclchar*>("EMOTICON_GROUP_NEXT"), TRUE);
+ CSCLUI *ui = get_ui();
+ if (ui) ui->set_private_key("EMOTICON_GROUP_ID", buf, NULL, NULL, 0, const_cast<sclchar*>("EMOTICON_GROUP_NEXT"), TRUE);
}
#endif
void
ise_set_caps_mode(unsigned int mode)
{
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+
LOGD("caps_mode : %d\n", mode);
if (mode) {
- g_keyboard_state.caps_mode = TRUE;
+ keyboard_state->caps_mode = TRUE;
} else {
- g_keyboard_state.caps_mode = FALSE;
+ keyboard_state->caps_mode = FALSE;
}
g_caps_mode_pending = false;
const sclchar *cur_lang = _language_manager.get_current_language();
if (info) {
if (info->accepts_caps_mode) {
/* If we are inputting multitap character, do not manipulate shift mode */
- if (g_keyboard_state.prev_modifier != KEY_MODIFIER_MULTITAP_START &&
- g_keyboard_state.prev_modifier != KEY_MODIFIER_MULTITAP_REPEAT) {
- set_caps_mode(g_keyboard_state.caps_mode);
+ if (keyboard_state->prev_modifier != KEY_MODIFIER_MULTITAP_START &&
+ keyboard_state->prev_modifier != KEY_MODIFIER_MULTITAP_REPEAT) {
+ set_caps_mode(keyboard_state->caps_mode);
} else {
g_caps_mode_pending = true;
LOGD("Currently composing multitap string, skipping caps request");
void
ise_update_cursor_position(int position)
{
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+
LOGD("cursor position : %d\n", position);
- if (g_ui && g_keyboard_state.layout == ISE_LAYOUT_STYLE_URL) {
+ CSCLUI *ui = get_ui();
+ if (ui && keyboard_state->layout == ISE_LAYOUT_STYLE_URL) {
#ifndef _TV
if (position > 0) {
- g_ui->set_string_substitution("www.", ".com");
+ ui->set_string_substitution("www.", ".com");
} else {
- g_ui->unset_string_substitution("www.");
+ ui->unset_string_substitution("www.");
}
#endif
}
const int BUF_LEN = 256;
char buf[BUF_LEN] = {0};
- if (!g_ui) return;
+ CSCLUI *ui = get_ui();
+ if (!ui) return;
LOGD("return key type : %d\n", type);
switch (type)
}
if (type == ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT) {
- g_ui->unset_private_key("Enter");
+ ui->unset_private_key("Enter");
#ifdef _TV
- g_ui->unset_private_key("Done");
+ ui->unset_private_key("Done");
#endif
} else {
#ifdef _WEARABLE
const_cast<sclchar*>("w_sip_3x4_btn_ic_search.png"),
const_cast<sclchar*>("w_sip_3x4_btn_ic_search_p.png"),
const_cast<sclchar*>("w_sip_3x4_btn_ic_search_d.png")};
- g_ui->set_private_key("Enter", const_cast<sclchar*>(""), imagelabel, NULL, 0, const_cast<sclchar*>("Enter"), TRUE);
+ ui->set_private_key("Enter", const_cast<sclchar*>(""), imagelabel, NULL, 0, const_cast<sclchar*>("Enter"), TRUE);
return;
}
#endif
#ifdef _TV
- g_ui->set_private_key("Done", buf, NULL, NULL, 0, const_cast<sclchar*>("Done"), TRUE);
+ ui->set_private_key("Done", buf, NULL, NULL, 0, const_cast<sclchar*>("Done"), TRUE);
#else
static sclchar *imagelabel[SCL_BUTTON_STATE_MAX] = {
const_cast<sclchar*>(" "), const_cast<sclchar*>(" "), const_cast<sclchar*>(" ")
};
- g_ui->set_private_key("Enter", buf, imagelabel, NULL, 0, const_cast<sclchar*>("Enter"), TRUE);
+ ui->set_private_key("Enter", buf, imagelabel, NULL, 0, const_cast<sclchar*>("Enter"), TRUE);
#endif
- LOGD("return key lable : %s\n", buf);
+ LOGD("return key label : %s\n", buf);
}
}
void ise_set_return_key_disable(unsigned int disabled)
{
+ CSCLUI *ui = get_ui();
LOGD("enable : %d\n", !disabled);
#ifdef _TV
- if (g_ui)
- g_ui->enable_button("Done", !disabled);
+ if (ui)
+ ui->enable_button("Done", !disabled);
#else
- if (g_ui)
- g_ui->enable_button("Enter", !disabled);
+ if (ui)
+ ui->enable_button("Enter", !disabled);
#endif
}
void ise_update_table(const vector<string> &vec_str)
{
- if (!g_candidate || !g_softcandidate_show)
+ Candidate *candidate = get_candidate();
+ if (!candidate || !candidate->get_visible()) {
create_softcandidate();
+ }
- if (g_candidate) {
- g_candidate->update(vec_str);
+ candidate = get_candidate();
+ if (candidate) {
+ candidate->update(vec_str);
}
}
if (back_key_pressed || back_key_released) {
if (g_popup_opened == TRUE) {
if (back_key_released) {
- g_ui->close_all_popups();
+ CSCLUI *ui = get_ui();
+ if (ui) ui->close_all_popups();
}
ret = 1;
return;
}
ret = 0;
+ CSCLUI *ui = get_ui();
#ifdef _TV
- if (g_candidate) {
- if (!g_candidate->soft_candidate_flag()) {
- if (g_ui) {
+ Candidate *candidate = get_candidate();
+ if (candidate) {
+ if (!candidate->soft_candidate_flag()) {
+ if (ui) {
if (key.dev_name.compare("ime") != 0) {
- ret = (sclu32)g_ui->process_key_event(key.get_key_string().c_str());
+ ret = (sclu32)ui->process_key_event(key.get_key_string().c_str());
}
}
}
if (!ret) {
- ret = g_candidate->soft_candidate_handle_key_event(key.get_key_string().c_str());
+ ret = candidate->soft_candidate_handle_key_event(key.get_key_string().c_str());
}
} else {
- if (g_ui) {
+ if (ui) {
/* Process this key event if it was not generated by ime */
if (key.dev_name.compare("ime") != 0) {
- ret = (sclu32)g_ui->process_key_event(key.get_key_string().c_str());
+ ret = (sclu32)ui->process_key_event(key.get_key_string().c_str());
}
}
}
#else
- if (g_ui) {
+ if (ui) {
/* Process this key event if it was not generated by ime */
if (key.dev_name.compare("ime") != 0) {
- ret = (sclu32)g_ui->process_key_event(key.get_key_string().c_str());
+ ret = (sclu32)ui->process_key_event(key.get_key_string().c_str());
}
}
#endif
static void set_ime_size(bool floating_mode, ISE_CANDIDATE_REQUEST candidate_req)
{
- if (!g_ui)
+ CSCLUI *ui = get_ui();
+ if (!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);
+ Candidate *candidate = get_candidate();
+
+ const char *input_mode = ui->get_input_mode();
+ if (!input_mode)
+ return;
+
+ SclSize size_portrait = ui->get_input_mode_size(input_mode, DISPLAYMODE_PORTRAIT);
+ SclSize size_landscape = ui->get_input_mode_size(input_mode, DISPLAYMODE_LANDSCAPE);
if (floating_mode) {
size_portrait.width *= FLOATING_SCALE_RATE;
size_landscape.height *= FLOATING_SCALE_RATE;
switch (candidate_req) {
case ISE_CANDIDATE_REQ_NONE:
- if (g_candidate && g_candidate->get_visible()) {
- g_ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT + g_candidate->get_height());
- size_portrait.height += g_candidate->get_height();
- size_landscape.height += g_candidate->get_height();
+ if (candidate && candidate->get_visible()) {
+ ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT + candidate->get_height());
+ size_portrait.height += candidate->get_height();
+ size_landscape.height += candidate->get_height();
} else {
- g_ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT);
+ ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT);
}
break;
case ISE_CANDIDATE_REQ_SHOW:
- g_ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT + g_candidate->get_height());
- if (g_input_panel_show || g_candidate_more_view) {
- size_portrait.height += g_candidate->get_height();
- size_landscape.height += g_candidate->get_height();
- } else {
- size_portrait.height = g_candidate->get_height();
- size_landscape.height = g_candidate->get_height();
+ if (candidate) {
+ ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT + candidate->get_height());
+ if (g_input_panel_show || g_candidate_more_view) {
+ size_portrait.height += candidate->get_height();
+ size_landscape.height += candidate->get_height();
+ } else {
+ size_portrait.height = candidate->get_height();
+ size_landscape.height = candidate->get_height();
+ }
}
break;
case ISE_CANDIDATE_REQ_HIDE:
- g_ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT);
+ ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT);
break;
default: break;
}
- if (g_ui->get_custom_scale_rate_x() != FLOATING_SCALE_RATE || g_ui->get_custom_scale_rate_y() != FLOATING_SCALE_RATE)
- g_ui->set_custom_scale_rate(FLOATING_SCALE_RATE, FLOATING_SCALE_RATE);
+ if (ui->get_custom_scale_rate_x() != FLOATING_SCALE_RATE || ui->get_custom_scale_rate_y() != FLOATING_SCALE_RATE)
+ ui->set_custom_scale_rate(FLOATING_SCALE_RATE, FLOATING_SCALE_RATE);
ime_set_size(size_portrait.width, size_portrait.height + FLOATING_TITLE_BAR_HEIGHT,
size_landscape.width, size_landscape.height + FLOATING_TITLE_BAR_HEIGHT);
-#ifdef _MOBILE
+#if defined(_MOBILE) || defined(_COMMON)
ise_destroy_move_handler();
int rotation = elm_win_rotation_get(NATIVE_WINDOW_CAST(ime_get_main_window()));
int handler_width = (rotation == 0 || rotation == 180) ? size_portrait.width : size_landscape.width;
} else {
switch (candidate_req) {
case ISE_CANDIDATE_REQ_NONE:
- if (g_candidate && g_candidate->get_visible()) {
- g_ui->set_custom_starting_coordinates(0, g_candidate->get_height());
- size_portrait.height += g_candidate->get_height();
- size_landscape.height += g_candidate->get_height();
+ if (candidate && candidate->get_visible()) {
+ ui->set_custom_starting_coordinates(0, candidate->get_height());
+ size_portrait.height += candidate->get_height();
+ size_landscape.height += candidate->get_height();
} else {
- g_ui->set_custom_starting_coordinates(0, 0);
+ ui->set_custom_starting_coordinates(0, 0);
}
break;
case ISE_CANDIDATE_REQ_SHOW:
- g_ui->set_custom_starting_coordinates(0, g_candidate->get_height());
- if (g_input_panel_show || g_candidate_more_view) {
- size_portrait.height += g_candidate->get_height();
- size_landscape.height += g_candidate->get_height();
- } else {
- size_portrait.height = g_candidate->get_height();
- size_landscape.height = g_candidate->get_height();
+ if (candidate) {
+ ui->set_custom_starting_coordinates(0, candidate->get_height());
+ if (g_input_panel_show || g_candidate_more_view) {
+ size_portrait.height += candidate->get_height();
+ size_landscape.height += candidate->get_height();
+ } else {
+ size_portrait.height = candidate->get_height();
+ size_landscape.height = candidate->get_height();
+ }
}
break;
case ISE_CANDIDATE_REQ_HIDE:
- g_ui->set_custom_starting_coordinates(0, 0);
+ ui->set_custom_starting_coordinates(0, 0);
break;
default: break;
}
- if (g_ui->get_custom_scale_rate_x() != 1.0 || g_ui->get_custom_scale_rate_y() != 1.0)
- g_ui->set_custom_scale_rate(1.0, 1.0);
+ if (ui->get_custom_scale_rate_x() != 1.0 || ui->get_custom_scale_rate_y() != 1.0)
+ ui->set_custom_scale_rate(1.0, 1.0);
ime_set_size(size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
-#ifdef _MOBILE
+#if defined(_MOBILE) || defined(_COMMON)
ise_destroy_move_handler();
#endif
}
static void ime_app_create_cb(void *user_data)
{
+ if (!engine_loader_dbus_init(NULL))
+ LOGE("Failed to initialize dbus");
+
#if !(DEFER_ISE_CREATION)
ise_create();
#endif
elm_app_name_set(PACKAGE);
-#ifdef HAVE_CBHM
- cbhm_open_service(&cbhm_handle);
-#endif
+ char *elm_scale = getenv("ELM_SCALE");
+ LOGD("ELM_SCALE : %s", elm_scale);
+
+ if (elm_scale)
+ elm_app_base_scale_set(atof(elm_scale));
+
+ if (nmt_check_agent_install())
+ nmt_init();
}
static void ime_app_exit_cb(void *user_data)
ise_hide();
ise_destroy();
-#ifdef HAVE_CBHM
- cbhm_close_service(cbhm_handle);
- cbhm_handle = NULL;
-#endif
+ if (!engine_loader_dbus_shutdown())
+ LOGE("Failed to finalize dbus");
+
+ nmt_shutdown();
}
-static void show_autofill_data(Ecore_IMF_Input_Hints input_hints)
+static void show_autofill_data()
{
- g_autofill_exist = false;
- char *text = autofill_get_string(g_app_id.c_str(), g_resource_id.c_str(), input_hints);
+ ime_autofill_set_exist(false);
+ string autofill_string = ime_autofill_get_string();
- if (text) {
- g_autofill_string = string(text);
- free(text);
- } else {
- g_autofill_string = string("");
- }
- SECURE_LOGD("autofill string : %s", g_autofill_string.c_str());
+ SECURE_LOGD("autofill string : %s", autofill_string.c_str());
- if (g_autofill_string.length() > 0) {
- g_autofill_exist = true;
+ if (!autofill_string.empty()) {
+ ime_autofill_set_exist(true);
ise_app_candidate_show();
update_candidate_table();
iseContext.return_key_disabled = return_key_state;
+ engine_loader_set_input_hint((uint32_t)iseContext.input_hint);
+ engine_loader_update_bidi_direction((uint32_t)iseContext.bidi_direction);
+
g_ic = ic;
- g_autofill_hint = iseContext.input_hint & ECORE_IMF_INPUT_HINT_AUTOFILL_MASK;
+ ime_autofill_set_hint(iseContext.input_hint & ECORE_IMF_INPUT_HINT_AUTOFILL_MASK);
- LOGD("input hint : %x, autofill hint : %x\n", iseContext.input_hint, g_autofill_hint);
-
- if (g_autofill_hint == 0) {
- switch (iseContext.layout) {
- case ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL:
- g_autofill_hint = ECORE_IMF_INPUT_HINT_AUTOFILL_EMAIL_ADDRESS;
- break;
- case ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER:
- g_autofill_hint = ECORE_IMF_INPUT_HINT_AUTOFILL_PHONE;
- break;
- default:
- break;
- }
- }
+ LOGD("input hint : %x, autofill hint : %x\n", iseContext.input_hint, ime_autofill_get_hint());
// show autofill data
- show_autofill_data((Ecore_IMF_Input_Hints)g_autofill_hint);
+ show_autofill_data();
//g_ise_common->set_keyboard_ise_by_uuid(KEYBD_ISE_UUID);
/* Don't update screen until all the information is correctly set */
- if (g_ui)
- g_ui->set_update_pending(TRUE);
+ CSCLUI *ui = get_ui();
+ if (ui)
+ ui->set_update_pending(TRUE);
ise_reset_context(); // reset ISE
- /*if (context.language == ECORE_IMF_INPUT_PANEL_LANG_ALPHABET) {
- ise_explictly_set_language(PRIMARY_LATIN_LANGUAGE_INDEX);
- }*/
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+
+ if (iseContext.language == ECORE_IMF_INPUT_PANEL_LANG_ALPHABET) {
+ LOGD("prefer latin");
+ if (keyboard_state)
+ keyboard_state->prefer_latin = TRUE;
+ }
+ else {
+ LOGD("prefer automatic");
+ if (keyboard_state)
+ keyboard_state->prefer_latin = FALSE;
+ }
_context_layout = iseContext.layout;
_context_layout_variation = iseContext.layout_variation;
ise_show(ic);
/* Now we update the whole screen */
- if (g_ui)
- g_ui->set_update_pending(FALSE);
+ if (ui)
+ ui->set_update_pending(FALSE);
}
static void ime_app_hide_cb(int ic, void *user_data)
{
LOGD("Enter\n");
ise_hide();
-#ifdef HAVE_CBHM
- g_set_mime_type = FALSE;
-#endif
+
g_ic_smartreply = -1;
}
static void ime_app_return_key_type_set_cb(Ecore_IMF_Input_Panel_Return_Key_Type type, void *user_data)
{
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+
LOGD("return key type : %d\n", type);
ise_set_return_key_type(type);
- if (g_keyboard_state.visible_state)
- ise_show(g_keyboard_state.ic);
+ if (keyboard_state->visible_state)
+ ise_show(keyboard_state->ic);
}
static void ime_app_return_key_state_set_cb(bool disabled, void *user_data)
ise_set_return_key_disable(disabled);
}
+static void ime_app_language_set_cb(Ecore_IMF_Input_Panel_Lang language, void *user_data)
+{
+ LOGD("language : %d\n", language);
+
+ // if (language == ECORE_IMF_INPUT_PANEL_LANG_ALPHABET) {
+ // ise_explictly_set_language(PRIMARY_LATIN_LANGUAGE_INDEX);
+ // }
+}
+
static void ime_app_input_context_reset_cb(void *user_data)
{
ise_reset_input_context();
+ engine_loader_reset_input_context();
}
static void ime_app_cursor_position_updated_cb(int cursor_pos, void *user_data)
{
LOGD("cursor position : %d\n", cursor_pos);
ise_update_cursor_position(cursor_pos);
+ engine_loader_update_cursor_position(cursor_pos);
}
static void ime_app_language_requested_cb(void *user_data, char **lang_code)
{
LOGD("Enter\n");
ise_focus_in(context_id);
- if (!g_smartreply_reply_exist && g_softcandidate_show) {
- if (g_candidate) {
+ Candidate *candidate = get_candidate();
+ if (input_smartreply_get_reply_num() == 0) {
+ if (candidate && candidate->get_visible()) {
ise_app_candidate_hide();
- g_candidate->hide();
+ candidate->hide();
}
}
+
+ engine_loader_focus_in();
}
static void ime_app_focus_out_cb(int context_id, void *user_data)
LOGD("Enter\n");
ise_focus_out(context_id);
g_imdata_state = 0;
-#ifdef HAVE_CBHM
- g_set_mime_type = FALSE;
-#endif
- g_smartreply_reply_exist = false;
- g_smartreply_size = 0;
input_smartreply_deinit();
g_ic_smartreply = -1;
- g_autofill_exist = false;
- g_autofill_hint = 0;
-
- g_app_id = string("");
- g_resource_id = string("");
+ ime_autofill_set_exist(false);
+ ime_autofill_set_hint(0);
+ ime_autofill_set_app_id("");
+ ime_autofill_set_resource_id("");
- g_autofill_string = string("");
g_smartreply_strings.clear();
g_lookup_table_strings.clear();
g_softcandidate_string.clear();
+
+ engine_loader_focus_out();
}
static void ime_app_layout_set_cb(Ecore_IMF_Input_Panel_Layout layout, void *user_data)
{
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+
LOGD("layout=%d\n", layout);
/* Check if the layoutIdx is in the valid range */
if (static_cast<int>(layout) < static_cast<int>(ISE_LAYOUT_STYLE_MAX)) {
- if (g_keyboard_state.layout != layout) {
- g_keyboard_state.need_reset = TRUE;
+ if (keyboard_state->layout != layout) {
+ keyboard_state->need_reset = TRUE;
}
- g_keyboard_state.layout = layout;
+ keyboard_state->layout = layout;
_context_layout = layout;
_context_layout_variation = 0;
}
- if (g_keyboard_state.visible_state)
- ise_show(g_keyboard_state.ic);
+ if (keyboard_state->visible_state)
+ ise_show(keyboard_state->ic);
+
+ engine_loader_set_layout(static_cast<uint32_t>(layout));
+}
+
+static void ime_app_input_hint_set_cb(Ecore_IMF_Input_Hints input_hint, void *user_data)
+{
+ LOGD("input hint=%u\n", input_hint);
}
static void ime_app_rotation_degree_changed_cb(int degree, void *user_data)
{
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+
+ CSCLUI *ui = get_ui();
ise_set_screen_rotation(degree);
LOGD("degree=%d\n", degree);
-#ifdef _MOBILE
- if (g_floating_mode) {
+#if defined(_MOBILE) || defined(_COMMON)
+ if (ui && g_floating_mode) {
int handler_width;
ise_destroy_move_handler();
if (degree == 0 || degree == 180) {
- SclSize size_portrait = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_PORTRAIT);
+ SclSize size_portrait = ui->get_input_mode_size(ui->get_input_mode(), DISPLAYMODE_PORTRAIT);
handler_width = size_portrait.width * FLOATING_SCALE_RATE;
} else {
- SclSize size_landscape = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_LANDSCAPE);
+ SclSize size_landscape = ui->get_input_mode_size(ui->get_input_mode(), DISPLAYMODE_LANDSCAPE);
handler_width = size_landscape.width * FLOATING_SCALE_RATE;
}
ise_show_move_handler(handler_width, FLOATING_TITLE_BAR_HEIGHT);
}
#endif
- if (is_emoticon_show()) {
- ise_destroy_emoticon_layout();
+ if (ise_emoticon_is_show()) {
+ ise_emoticon_destroy_layout();
}
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE) {
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_VOICE) {
ise_hide_stt_mode();
}
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_EMOTICON) {
- ise_show_emoticon_layout(current_emoticon_group, degree, false, ime_get_main_window());
- } else if (g_ui) {
- const sclchar *input_mode = g_ui->get_input_mode();
+ if (keyboard_state->layout == ISE_LAYOUT_STYLE_EMOTICON) {
+ ise_emoticon_show_layout(ise_emoticon_get_current_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_emoticon_show_layout(ise_emoticon_get_current_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()));
}
g_imdata_state = 0;
size_t _len = data_length;
set_ise_imdata((sclchar *)data, _len);
+ engine_loader_set_imdata((const char*)data, (uint32_t)data_length);
}
static bool ime_app_process_key_event_cb(ime_key_code_e keycode, ime_key_mask_e keymask, ime_device_info_h dev_info, void *user_data)
{
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return FALSE;
+
scim::KeyEvent key(keycode, keymask);
unsigned int ret;
char *dev_name = NULL;
key.dev_subclass = dev_subclass;
}
- if (g_keyboard_state.visible_state)
+ if (keyboard_state->visible_state) {
ise_process_key_event(key, ret);
- else
- ret = FALSE;
+ } else {
+ if (key.code == IME_KEY_space && (key.mask & IME_KEY_MASK_SHIFT)) {
+ if (key.mask & IME_KEY_MASK_RELEASED) {
+ if (_language_manager.select_next_language()) {
+ LANGUAGE_INFO *info = _language_manager.get_language_info(_language_manager.get_current_language());
+ if (info) {
+ notification_status_message_post(info->display_name.c_str());
+ }
+ } else {
+ LOGE("Failed to change language");
+ }
+ }
+
+ ret = TRUE;
+ } else {
+ ret = FALSE;
+ }
+ }
if (dev_name)
free(dev_name);
return ret;
}
+static void ime_app_process_key_event_with_imengine_cb(scim::KeyEvent &key, uint32_t serial, void *user_data)
+{
+ LANGUAGE_INFO *info = _language_manager.get_language_info(_language_manager.get_current_language());
+ if (info && info->need_surrounding_text)
+ engine_loader_process_key_event(key, serial, true);
+ else
+ engine_loader_process_key_event(key, serial, false);
+}
+
static void ime_app_caps_mode_changed_cb(int mode, void *user_data)
{
ise_set_caps_mode(mode);
}
}
- if (g_smartreply_reply_exist) {
+ if (input_smartreply_get_reply_num() > 0) {
if (candidate_strings[0] == "#" && candidate_strings[1] == "$") {
char *text = NULL;
int cursor;
}
#ifdef _WEARABLE
+static sclu32 get_rotate_layout(ime_input_device_rotary_direction_e direction)
+{
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return ISE_LAYOUT_STYLE_NORMAL;
+
+ sclu32 new_layout = keyboard_state->layout;
+
+ if (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_CLOCKWISE) {
+ LOGD("CLOCKWISE\n");
+ switch (keyboard_state->layout) {
+ case ISE_LAYOUT_STYLE_NORMAL:
+ case ISE_LAYOUT_STYLE_EMAIL:
+ case ISE_LAYOUT_STYLE_URL:
+ case ISE_LAYOUT_STYLE_PASSWORD:
+ if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD &&
+ _context_layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NUMBERONLY)
+ ; // PASSWORD NUMBER ONLY, do nothing
+ else
+ new_layout = ISE_LAYOUT_STYLE_NUMBER;
+ break;
+ case ISE_LAYOUT_STYLE_NUMBER:
+ new_layout = ISE_LAYOUT_STYLE_HEX;
+ break;
+ case ISE_LAYOUT_STYLE_HEX:
+ if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
+ _context_layout == ISE_LAYOUT_STYLE_URL)
+ new_layout = ISE_LAYOUT_STYLE_VOICE;
+ else if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD)
+ new_layout = _context_layout;
+ else
+ new_layout = ISE_LAYOUT_STYLE_EMOTICON;
+ break;
+ case ISE_LAYOUT_STYLE_EMOTICON:
+ if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
+ _context_layout == ISE_LAYOUT_STYLE_URL ||
+ _context_layout == ISE_LAYOUT_STYLE_PASSWORD)
+ new_layout = _context_layout;
+ else
+ new_layout = ISE_LAYOUT_STYLE_VOICE;
+ break;
+ case ISE_LAYOUT_STYLE_VOICE:
+ new_layout = ISE_LAYOUT_STYLE_NORMAL;
+ break;
+ default:
+ ;
+ }
+ } else if (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_COUNTER_CLOCKWISE) {
+ LOGD("COUNTER_CLOCKWISE\n");
+ switch (keyboard_state->layout) {
+ case ISE_LAYOUT_STYLE_NORMAL:
+ case ISE_LAYOUT_STYLE_EMAIL:
+ case ISE_LAYOUT_STYLE_URL:
+ case ISE_LAYOUT_STYLE_PASSWORD:
+ if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD &&
+ _context_layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NUMBERONLY)
+ ; // PASSWORD NUMBER ONLY, do nothing
+ else if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD)
+ new_layout = ISE_LAYOUT_STYLE_HEX;
+ else
+ new_layout = ISE_LAYOUT_STYLE_VOICE;
+ break;
+ case ISE_LAYOUT_STYLE_NUMBER:
+ if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
+ _context_layout == ISE_LAYOUT_STYLE_URL ||
+ _context_layout == ISE_LAYOUT_STYLE_PASSWORD)
+ new_layout = _context_layout;
+ else
+ new_layout = ISE_LAYOUT_STYLE_NORMAL;
+ break;
+ case ISE_LAYOUT_STYLE_HEX:
+ new_layout = ISE_LAYOUT_STYLE_NUMBER;
+ break;
+ case ISE_LAYOUT_STYLE_EMOTICON:
+ new_layout = ISE_LAYOUT_STYLE_HEX;
+ break;
+ case ISE_LAYOUT_STYLE_VOICE:
+ if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
+ _context_layout == ISE_LAYOUT_STYLE_URL)
+ new_layout = ISE_LAYOUT_STYLE_HEX;
+ else
+ new_layout = ISE_LAYOUT_STYLE_EMOTICON;
+ break;
+ default:
+ ;
+ }
+ }
+
+ return new_layout;
+}
+
static void ime_app_process_input_device_event_cb(ime_input_device_type_e device_type, ime_input_device_event_h device_event, void *user_data)
{
- if (device_type == IME_INPUT_DEVICE_TYPE_ROTARY) {
- ime_input_device_rotary_direction_e direction;
- if (IME_ERROR_NONE == ime_input_device_rotary_get_direction(device_event, &direction)) {
- sclu32 new_layout = g_keyboard_state.layout;
- if (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_CLOCKWISE) {
- LOGD("CLOCKWISE\n");
- switch (g_keyboard_state.layout) {
- case ISE_LAYOUT_STYLE_NORMAL:
- case ISE_LAYOUT_STYLE_EMAIL:
- case ISE_LAYOUT_STYLE_URL:
- case ISE_LAYOUT_STYLE_PASSWORD:
- if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD &&
- _context_layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NUMBERONLY)
- ; // PASSWORD NUMBER ONLY, do nothing
- else
- new_layout = ISE_LAYOUT_STYLE_NUMBER;
- break;
- case ISE_LAYOUT_STYLE_NUMBER:
- new_layout = ISE_LAYOUT_STYLE_HEX;
- break;
- case ISE_LAYOUT_STYLE_HEX:
- if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
- _context_layout == ISE_LAYOUT_STYLE_URL)
- new_layout = ISE_LAYOUT_STYLE_VOICE;
- else if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD)
- new_layout = _context_layout;
- else
- new_layout = ISE_LAYOUT_STYLE_EMOTICON;
- break;
- case ISE_LAYOUT_STYLE_EMOTICON:
- if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
- _context_layout == ISE_LAYOUT_STYLE_URL ||
- _context_layout == ISE_LAYOUT_STYLE_PASSWORD)
- new_layout = _context_layout;
- else
- new_layout = ISE_LAYOUT_STYLE_VOICE;
- break;
- case ISE_LAYOUT_STYLE_VOICE:
- new_layout = ISE_LAYOUT_STYLE_NORMAL;
- break;
- default:
- ;
- }
- } else if (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_COUNTER_CLOCKWISE) {
- LOGD("COUNTER_CLOCKWISE\n");
- switch (g_keyboard_state.layout) {
- case ISE_LAYOUT_STYLE_NORMAL:
- case ISE_LAYOUT_STYLE_EMAIL:
- case ISE_LAYOUT_STYLE_URL:
- case ISE_LAYOUT_STYLE_PASSWORD:
- if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD &&
- _context_layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NUMBERONLY)
- ; // PASSWORD NUMBER ONLY, do nothing
- else if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD)
- new_layout = ISE_LAYOUT_STYLE_HEX;
- else
- new_layout = ISE_LAYOUT_STYLE_VOICE;
- break;
- case ISE_LAYOUT_STYLE_NUMBER:
- if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
- _context_layout == ISE_LAYOUT_STYLE_URL ||
- _context_layout == ISE_LAYOUT_STYLE_PASSWORD)
- new_layout = _context_layout;
- else
- new_layout = ISE_LAYOUT_STYLE_NORMAL;
- break;
- case ISE_LAYOUT_STYLE_HEX:
- new_layout = ISE_LAYOUT_STYLE_NUMBER;
- break;
- case ISE_LAYOUT_STYLE_EMOTICON:
- new_layout = ISE_LAYOUT_STYLE_HEX;
- break;
- case ISE_LAYOUT_STYLE_VOICE:
- if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
- _context_layout == ISE_LAYOUT_STYLE_URL)
- new_layout = ISE_LAYOUT_STYLE_HEX;
- else
- new_layout = ISE_LAYOUT_STYLE_EMOTICON;
- break;
- default:
- ;
- }
- }
+ KEYBOARD_STATE *keyboard_state = get_keyboard_state();
+ if (!keyboard_state) return;
+ if (device_type != IME_INPUT_DEVICE_TYPE_ROTARY) return;
- if (check_is_tutorial_show()) {
- read_ise_config_values();
- if ((direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_COUNTER_CLOCKWISE && !g_config_values.number_tutorial_enable && !g_config_values.symbol_tutorial_enable) ||
- (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_CLOCKWISE && g_config_values.symbol_tutorial_enable)) {
- new_layout = g_keyboard_state.layout;
- } else if (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_COUNTER_CLOCKWISE && g_config_values.symbol_tutorial_enable) {
- ise_destroy_tutorial_mode_popup();
- g_config_values.symbol_tutorial_enable = false;
- write_ise_config_values();
- } else if (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_CLOCKWISE && !g_config_values.number_tutorial_enable) {
- ise_destroy_tutorial_mode_popup();
- new_layout = ISE_LAYOUT_STYLE_NUMBER;
- if (!g_config_values.symbol_tutorial_enable) {
- ise_show_tutorial_mode_popup(new_layout);
- g_config_values.symbol_tutorial_enable = true;
- write_ise_config_values();
- }
- }
+ ime_input_device_rotary_direction_e direction;
+ if (IME_ERROR_NONE != ime_input_device_rotary_get_direction(device_event, &direction)) return;
+
+ sclu32 new_layout = get_rotate_layout(direction);
+
+ CONFIG_VALUES *config_values = get_config_values();
+ if (check_is_tutorial_show() && config_values) {
+ read_ise_config_values();
+ if ((direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_COUNTER_CLOCKWISE && !config_values->number_tutorial_enable && !config_values->symbol_tutorial_enable) ||
+ (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_CLOCKWISE && config_values->symbol_tutorial_enable)) {
+ new_layout = keyboard_state->layout;
+ } else if (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_COUNTER_CLOCKWISE && config_values->symbol_tutorial_enable) {
+ ise_destroy_tutorial_mode_popup();
+ config_values->symbol_tutorial_enable = false;
+ write_ise_config_values();
+ } else if (direction == IME_INPUT_DEVICE_ROTARY_DIRECTION_CLOCKWISE && !config_values->number_tutorial_enable) {
+ ise_destroy_tutorial_mode_popup();
+ new_layout = ISE_LAYOUT_STYLE_NUMBER;
+ if (!config_values->symbol_tutorial_enable) {
+ ise_show_tutorial_mode_popup(new_layout);
+ config_values->symbol_tutorial_enable = true;
+ write_ise_config_values();
}
+ }
+ }
- if (new_layout != g_keyboard_state.layout && new_layout < ISE_LAYOUT_STYLE_MAX) {
- g_keyboard_state.need_reset = TRUE;
- g_keyboard_state.layout = new_layout;
+ if (new_layout != keyboard_state->layout && new_layout < ISE_LAYOUT_STYLE_MAX) {
+ keyboard_state->need_reset = TRUE;
+ keyboard_state->layout = new_layout;
- if (g_keyboard_state.visible_state) {
- _reset_multitap_state();
- _language_manager.reset_language(g_config_values.selected_language.c_str());
- ise_show(g_keyboard_state.ic);
- }
+ if (keyboard_state->visible_state) {
+ _reset_multitap_state();
+ if (config_values) {
+ _language_manager.reset_language(config_values->selected_language.c_str());
}
+ ise_show(keyboard_state->ic);
}
}
}
input_smartreply_set_notify(_input_smartreply_notify_cb, NULL);
if (input_smartreply_is_enabled()) {
- g_smartreply_size = 0;
- g_smartreply_reply_exist = false;
-
input_smartreply_get_reply_async();
}
}
static void ime_app_mime_type_set_request_cb(const char *mime_types, void *user_data)
{
LOGD("mime type : %s\n", mime_types);
-
-#ifdef HAVE_CBHM
- g_set_mime_type = TRUE;
- cbhm_sel_type = 0;
- string str(mime_types), text_key = "text/", image_key = "image/";
-
- if (str.find(text_key) != string::npos)
- cbhm_sel_type |= CBHM_SEL_TYPE_TEXT;
-
- if (str.find(image_key) != string::npos)
- cbhm_sel_type |= CBHM_SEL_TYPE_IMAGE;
-
- LOGD("cbhm_sel_type=0x%x", cbhm_sel_type);
-#endif
}
static void ime_app_prediction_hint_data_set_cb(const char *key, const char *value, void *user_data)
SECURE_LOGD("key : %s, value : %s\n", key, value);
if (string(key) == "appid")
- g_app_id = string(value ? value : "");
+ ime_autofill_set_app_id(value);
else if (string(key) == "res_id")
- g_resource_id = string(value ? value : "");
+ ime_autofill_set_resource_id(value);
+}
+
+static void ime_app_autocapital_type_set_cb(uint32_t type, void *user_data)
+{
+ LOGD("autocapital type : %u\n", type);
+ engine_loader_set_autocapital_type(type);
+}
+
+static void ime_app_prediction_allow_set_cb(uint32_t prediction_allow, void *user_data)
+{
+ LOGD("prediction allow : %u\n", prediction_allow);
+ engine_loader_set_prediction_allow(prediction_allow);
+}
+
+static void ime_app_trigger_property_set_cb(const char *property, void *user_data)
+{
+ LOGD("trigger property : %s\n", property);
+ engine_loader_trigger_property(property);
+}
+
+static void ime_app_candidate_more_window_show_cb(void *user_data)
+{
+ LOGD("");
+ engine_loader_show_candidate_more_window();
+}
+
+static void ime_app_candidate_more_window_hide_cb(void *user_data)
+{
+ LOGD("");
+ engine_loader_hide_candidate_more_window();
+}
+
+static void ime_app_aux_select_cb(uint32_t item, void *user_data)
+{
+ LOGD("aux select : %u\n", item);
+ engine_loader_select_aux(item);
+}
+
+static void ime_app_candidate_select_cb(uint32_t item, void *user_data)
+{
+ LOGD("candidate select : %u\n", item);
+ engine_loader_select_candidate(item);
+}
+
+static void ime_app_candidate_table_page_up_cb(void *user_data)
+{
+ LOGD("");
+ engine_loader_candidate_table_page_up();
+}
+
+static void ime_app_candidate_table_page_down_cb(void *user_data)
+{
+ LOGD("");
+ engine_loader_candidate_table_page_down();
+}
+
+static void ime_app_candidate_table_page_size_chaned_cb(uint32_t size, void *user_data)
+{
+ LOGD("candidate page size : %u\n", size);
+ engine_loader_change_candidate_page_size(size);
+}
+
+static void ime_app_candidate_item_layout_set_cb(vector<uint32_t> item, void *user_data)
+{
+ LOGD("item layout size : %zu", item.size());
+ engine_loader_set_candidate_item_layout(item);
+}
+
+static void ime_app_displayed_candidate_number_chaned_cb(uint32_t page_num, void *user_data)
+{
+ LOGD("candidate number changed : %u\n", page_num);
+ engine_loader_change_candidate_number(page_num);
+}
+
+static void ime_app_candidate_item_long_pressed_cb(uint32_t index, void *user_data)
+{
+ LOGD("candidate item : %u\n", index);
+ engine_loader_long_press_candidate_item(index);
}
#ifdef __cplusplus
ime_event_set_surrounding_text_updated_cb(ime_app_surrounding_text_updated_cb, NULL);
ime_event_set_return_key_type_set_cb(ime_app_return_key_type_set_cb, NULL);
ime_event_set_return_key_state_set_cb(ime_app_return_key_state_set_cb, NULL);
+ ime_event_set_language_set_cb(ime_app_language_set_cb, NULL);
ime_event_set_imdata_set_cb(ime_app_imdata_set_cb, NULL);
ime_event_set_process_key_event_cb(ime_app_process_key_event_cb, NULL);
+ ime_event_set_process_key_event_with_imengine_cb(ime_app_process_key_event_with_imengine_cb, NULL);
+ ime_event_set_input_hint_set_cb(ime_app_input_hint_set_cb, NULL);
ime_event_set_candidate_show_cb(ime_app_candidate_show_cb, NULL);
ime_event_set_candidate_hide_cb(ime_app_candidate_hide_cb, NULL);
ime_event_set_mime_type_set_request_cb(ime_app_mime_type_set_request_cb, NULL);
ime_event_set_prediction_hint_data_set_cb(ime_app_prediction_hint_data_set_cb, NULL);
+ ime_event_set_autocapital_type_set_cb(ime_app_autocapital_type_set_cb, NULL);
+ ime_event_set_prediction_allow_set_cb(ime_app_prediction_allow_set_cb, NULL);
+ ime_event_set_trigger_property_set_cb(ime_app_trigger_property_set_cb, NULL);
+ ime_event_set_candidate_more_window_show_cb(ime_app_candidate_more_window_show_cb, NULL);
+ ime_event_set_candidate_more_window_hide_cb(ime_app_candidate_more_window_hide_cb, NULL);
+ ime_event_set_aux_select_cb(ime_app_aux_select_cb, NULL);
+ ime_event_set_candidate_select_cb(ime_app_candidate_select_cb, NULL);
+ ime_event_set_candidate_table_page_up_cb(ime_app_candidate_table_page_up_cb, NULL);
+ ime_event_set_candidate_table_page_down_cb(ime_app_candidate_table_page_down_cb, NULL);
+ ime_event_set_candidate_table_page_size_chaned_cb(ime_app_candidate_table_page_size_chaned_cb, NULL);
+ ime_event_set_candidate_item_layout_set_cb(ime_app_candidate_item_layout_set_cb, NULL);
+ ime_event_set_displayed_candidate_number_chaned_cb(ime_app_displayed_candidate_number_chaned_cb, NULL);
+ ime_event_set_candidate_item_long_pressed_cb(ime_app_candidate_item_long_pressed_cb, NULL);
+
#if DEFER_ISE_CREATION
ime_set_window_creation_defer_flag(TRUE);
#endif