}
}
-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<void*>(data);
- Ecore_Event_Detent_Rotate *rotary_device_event = static_cast<Ecore_Event_Detent_Rotate*>(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
*/
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
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