From: Jihoon Kim Date: Fri, 10 Feb 2017 00:53:00 +0000 (+0900) Subject: Support rotary event in wearable profile X-Git-Tag: accepted/tizen/3.0/common/20170214.180210~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c055d8986f4ae024edd67cbad8d03918ee73a54;p=platform%2Fcore%2Fuifw%2Fise-default.git Support rotary event in wearable profile After using capi-ui-inputmethod, rotary event has not been supported. This patch will fix that problem. Change-Id: I5a8feb7febd77b492ba13f98e3609fdfb7aa9a6b Signed-off-by: Jihoon Kim --- diff --git a/src/include/ise.h b/src/include/ise.h index 2937db3..9fff443 100644 --- a/src/include/ise.h +++ b/src/include/ise.h @@ -223,8 +223,6 @@ public: void on_candidate_show(sclint ic, const sclchar *ic_uuid); void on_candidate_hide(sclint ic, const sclchar *ic_uuid); - - void on_process_input_device_event(sclu32 &type, sclchar *data, size_t &len, sclu32 *ret); }; void ise_send_string(const sclchar *key_value); diff --git a/src/ise.cpp b/src/ise.cpp index 882aa69..bbf4178 100644 --- a/src/ise.cpp +++ b/src/ise.cpp @@ -628,116 +628,6 @@ void CCoreEventCallback::on_candidate_hide(sclint ic, const sclchar *ic_uuid) } } -void CCoreEventCallback::on_process_input_device_event(sclu32 &type, sclchar *data, size_t &len, sclu32 *ret) -{ - LOGD("type:%d, len:%d\n", type, len); - if (ret == NULL) { - LOGE("ret is NULL\n"); - return; - } - *ret = 0; -#ifdef _WEARABLE - if (type == (sclu32)(ECORE_EVENT_DETENT_ROTATE)) { - void *event_data = static_cast(data); - Ecore_Event_Detent_Rotate *rotary_device_event = static_cast(event_data); - if (rotary_device_event) { - sclu32 new_layout = g_keyboard_state.layout; - if (rotary_device_event->direction == ECORE_DETENT_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 (rotary_device_event->direction == ECORE_DETENT_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: - ; - } - } - 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 (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); - } - - *ret = 1; - } - } - } -#endif -} - /** * Send the given string to input framework */ @@ -2137,6 +2027,108 @@ static void ime_app_lookup_table_changed_cb(Eina_List *list, void *user_data) ise_update_table(candidate_strings); } +#ifdef _WEARABLE +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: + ; + } + } + 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 (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); + } + } + } + } +} +#endif + #ifdef __cplusplus extern "C"{ #endif @@ -2168,6 +2160,10 @@ EXPORTED void ime_app_main(int argc, char **argv) ime_event_set_candidate_hide_cb(ime_app_candidate_hide_cb, NULL); ime_event_set_lookup_table_changed_cb(ime_app_lookup_table_changed_cb, NULL); +#ifdef _WEARABLE + ime_event_set_process_input_device_event_cb(ime_app_process_input_device_event_cb, NULL); +#endif + ime_run(&basic_callback, NULL); } #ifdef __cplusplus