{ NULL, NULL, ELM_INPUT_PANEL_LAYOUT_NORMAL, 0 }
};
-#ifndef WAYLAND
-static Ecore_Event_Handler *prop_handler = NULL;
-
-static void _back_key_cb (void *data, Evas_Object *obj, void *event_info)
-{
- ecore_x_test_fake_key_press ("XF86Back");
-}
-#endif
-
static void _rotate_cb (void *data, Evas_Object *obj, void *event_info)
{
struct appdata *ad = (struct appdata *)data;
LOGD ("[evas key up] capslock : %d, num lock : %d", evas_key_lock_is_set(ev->locks, "Caps_Lock"), evas_key_lock_is_set(ev->locks, "Num_Lock"));
}
-#ifndef WAYLAND
-static void
-_print_keyboard_geometry (Ecore_X_Window xwin)
-{
- int sx, sy, sw, sh;
- Ecore_X_Window zone;
-
- zone = ecore_x_e_illume_zone_get (xwin);
-
- if (!ecore_x_e_illume_keyboard_geometry_get (zone, &sx, &sy, &sw, &sh))
- sx = sy = sw = sh = 0;
-
- LOGD ("Keyboard geometry x : %d, y : %d, w : %d, h : %d", sx, sy, sw, sh);
-}
-
-static Eina_Bool
-_prop_change_cb (void *data, int type, void *event)
-{
- Ecore_X_Event_Window_Property *ev;
- ev = (Ecore_X_Event_Window_Property *)event;
- if (!ev) return ECORE_CALLBACK_PASS_ON;
-
- if (ev->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE) {
- LOGD ("[ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE] ");
- _print_keyboard_geometry (ev->win);
- } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY) {
- LOGD ("[ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY] ");
- _print_keyboard_geometry (ev->win);
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-#endif
-
static void entry_changed_cb (void *data, Evas_Object *obj, void *event_info)
{
LOGD ("The text within the entry was changed.");
return ef;
}
-#ifndef WAYLAND
-static void
-_layout_del_cb (void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- if (prop_handler) {
- ecore_event_handler_del (prop_handler);
- prop_handler = NULL;
- }
-}
-#endif
-
static Evas_Object * create_inner_layout (void *data)
{
struct appdata *ad = (struct appdata *)data;
++idx;
}
-#ifndef WAYLAND
- /* create back key event generation button */
- Evas_Object *back_key_btn = create_button (parent, "Generate BACK key");
- evas_object_smart_callback_add (back_key_btn, "clicked", _back_key_cb, (void *)ad);
- elm_box_pack_end (bx, back_key_btn);
- elm_object_focus_allow_set (back_key_btn, EINA_FALSE);
-#endif
-
/* Click to rotate button */
Evas_Object *rotate_btn = create_button (parent, "rotate");
elm_object_focus_allow_set (rotate_btn, EINA_FALSE);
evas_object_smart_callback_add (rotate_btn, "clicked", _rotate_cb, (void *)ad);
elm_box_pack_end (bx, rotate_btn);
-#ifndef WAYLAND
- prop_handler = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change_cb, NULL);
- evas_object_event_callback_add (bx, EVAS_CALLBACK_DEL, _layout_del_cb, NULL);
-#endif
-
return bx;
}
#ifdef HAVE_ECOREWL
#include <Ecore_Wayland.h>
#endif /* HAVE_ECOREWL */
-#ifdef HAVE_ECOREX
-#include <Ecore_X.h>
-#endif /* HAVE_ECOREX */
-#ifdef HAVE_X
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#endif /* HAVE_X */
-#ifdef HAVE_TTS
-#include <tts.h>
-#endif /* HAVE_TTS */
#ifdef HAVE_FEEDBACK
#include <feedback.h>
#endif /* HAVE_FEEDBACK */
const int MORE_BUTTON_INDEX = -1;
const int CLOSE_BUTTON_INDEX = -2;
-const int INVALID_TTS_FOCUS_INDEX = -100;
-static int _candidate_tts_focus_index = INVALID_TTS_FOCUS_INDEX;
static uint32 _candidate_display_number = 0;
static std::vector<uint32> _candidate_row_items;
static Evas_Object *_tts_focus_rect = 0;
static Ecore_Timer *_longpress_timer = NULL;
static Ecore_Timer *_destroy_timer = NULL;
#endif /* CANDIDATE */
-#ifdef HAVE_ECOREX
-static Ecore_Timer *_off_prepare_done_timer = NULL;
-#endif
#if ISF_BUILD_CANDIDATE_UI
static Ecore_Timer *_candidate_hide_timer = NULL;
#endif /* CANDIDATE */
#endif
#if ISF_BUILD_CANDIDATE_UI
-#ifdef HAVE_TTS
-static tts_h _tts = NULL;
-#endif
#ifdef HAVE_FEEDBACK
static bool feedback_initialized = false;
ui_candidate_window_adjust ();
if (_candidate_area_1_visible) {
update_table (ISF_CANDIDATE_TABLE, g_isf_candidate_table);
- _candidate_tts_focus_index = INVALID_TTS_FOCUS_INDEX;
ui_tts_focus_rect_hide ();
}
flush_memory ();
}
}
-#ifdef HAVE_TTS
-/**
- * @brief Open TTS device.
- *
- * @return false if open is failed, otherwise return true.
- */
-static bool ui_open_tts (void)
-{
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-
- int r = tts_create (&_tts);
- if (TTS_ERROR_NONE != r) {
- LOGW ("tts_create FAILED : result (%d)", r);
- _tts = NULL;
- return false;
- }
-
- r = tts_set_mode (_tts, TTS_MODE_SCREEN_READER);
- if (TTS_ERROR_NONE != r) {
- LOGW ("tts_set_mode FAILED : result (%d)", r);
- }
-
- tts_state_e current_state;
- r = tts_get_state (_tts, ¤t_state);
- if (TTS_ERROR_NONE != r) {
- LOGW ("tts_get_state FAILED : result (%d)", r);
- }
-
- if (TTS_STATE_CREATED == current_state) {
- r = tts_prepare (_tts);
- if (TTS_ERROR_NONE != r) {
- LOGW ("tts_prepare FAILED : ret (%d)", r);
- }
- }
- return true;
-}
-
-/**
- * @brief Close TTS device.
- */
-static void ui_close_tts (void)
-{
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-
- if (_tts) {
- int r = tts_unprepare (_tts);
- if (TTS_ERROR_NONE != r) {
- LOGW ("tts_unprepare FAILED : result (%d)", r);
- }
-
- r = tts_destroy (_tts);
- if (TTS_ERROR_NONE != r) {
- LOGW ("tts_destroy FAILED : result (%d)", r);
- }
- }
-}
-
-/**
- * @brief Play string by TTS.
- *
- * @param str The string for playing.
- */
-static void ui_play_tts (const char* str)
-{
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << " str=" << str << "\n";
-
- if (!str) return;
-
- if (_tts == NULL) {
- if (!ui_open_tts ())
- return;
- }
-
- int r;
- int utt_id = 0;
- tts_state_e current_state;
-
- r = tts_get_state (_tts, ¤t_state);
- if (TTS_ERROR_NONE != r) {
- LOGW ("Fail to get state from TTS : ret (%d)", r);
- }
-
- if (TTS_STATE_PLAYING == current_state) {
- r = tts_stop (_tts);
- if (TTS_ERROR_NONE != r) {
- LOGW ("Fail to stop TTS : ret (%d)", r);
- }
- }
-
- /* Get ISE language */
- String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
- String language = String ("en_US");
- if (default_uuid.length () > 0) {
- language = _ime_info[get_ise_index (default_uuid)].languages;
- if (language.length () > 0) {
- std::vector<String> ise_langs;
- scim_split_string_list (ise_langs, language);
- language = ise_langs[0];
- }
- }
- LOGD ("TTS language:%s, str:%s", language.c_str (), str);
-
- r = tts_add_text (_tts, str, language.c_str (), TTS_VOICE_TYPE_AUTO, TTS_SPEED_AUTO, &utt_id);
- if (TTS_ERROR_NONE == r) {
- r = tts_play (_tts);
- if (TTS_ERROR_NONE != r) {
- LOGW ("Fail to play TTS : ret (%d)", r);
- }
- }
-}
-#endif /* HAVE_TTS */
-
/**
* @brief Show rect for candidate focus object when screen reader is enabled.
*
_wait_stop_event = false;
}
-#ifdef HAVE_ECOREX
-/**
- * @brief Mouse over (find focus object and play text by TTS) when screen reader is enabled.
- *
- * @param mouse_x Mouse X position.
- * @param mouse_y Mouse Y position.
- */
-static void ui_mouse_over (int mouse_x, int mouse_y)
-{
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- if (_candidate_window == NULL || _candidate_state != WINDOW_STATE_SHOW)
- return;
-
- int x, y, width, height;
- for (int i = 0; i < SCIM_LOOKUP_TABLE_MAX_PAGESIZE; ++i) {
- if (_candidate_0 [i]) {
- evas_object_geometry_get (_candidate_0 [i], &x, &y, &width, &height);
- if (mouse_x >= x && mouse_x <= x + width && mouse_y >= y && mouse_y <= y + height) {
- /* FIXME: Should consider emoji case */
- String mbs = utf8_wcstombs (g_isf_candidate_table.get_candidate_in_current_page (i));
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << " play candidate string: " << mbs << "\n";
-#ifdef HAVE_TTS
- ui_play_tts (mbs.c_str ());
-#endif
- _candidate_tts_focus_index = i;
- ui_tts_focus_rect_show (x, y, width, height);
- return;
- }
- }
- }
-
- String strTts = String ("");
- if (_candidate_area_2_visible) {
- evas_object_geometry_get (_close_btn, &x, &y, &width, &height);
- if (mouse_x >= x && mouse_x <= x + width && mouse_y >= y && mouse_y <= y + height) {
- strTts = String (_("close button"));
- _candidate_tts_focus_index = CLOSE_BUTTON_INDEX;
- ui_tts_focus_rect_show (x, y, width, height);
- }
- } else {
- evas_object_geometry_get (_more_btn, &x, &y, &width, &height);
- if (mouse_x >= x && mouse_x <= x + width && mouse_y >= y && mouse_y <= y + height) {
- strTts = String (_("more button"));
- _candidate_tts_focus_index = MORE_BUTTON_INDEX;
- ui_tts_focus_rect_show (x, y, width, height);
- }
- }
-#ifdef HAVE_TTS
- if (strTts.length () > 0)
- ui_play_tts (strTts.c_str ());
-#endif
-}
-
-/**
- * @brief Mouse click (find focus object and do click event) when screen reader is enabled.
- *
- * @param focus_index focused candidate index.
- */
-static void ui_mouse_click (int focus_index)
-{
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- if (_candidate_window == NULL || _candidate_state != WINDOW_STATE_SHOW || focus_index == INVALID_TTS_FOCUS_INDEX)
- return;
-
- if (focus_index >= 0 && focus_index < g_isf_candidate_table.get_current_page_size ()) {
- if (_candidate_0 [focus_index]) {
- int x, y, width, height;
- evas_object_geometry_get (_candidate_0 [focus_index], &x, &y, &width, &height);
- Evas_Event_Mouse_Down event_info;
- event_info.canvas.x = x + width / 2;
- event_info.canvas.y = y + height / 2;
- ui_mouse_button_pressed_cb (GINT_TO_POINTER ((focus_index << 8) + ISF_EFL_CANDIDATE_0), NULL, NULL, &event_info);
- ui_mouse_button_released_cb (GINT_TO_POINTER (focus_index), NULL, NULL, &event_info);
- }
- _candidate_tts_focus_index = INVALID_TTS_FOCUS_INDEX;
- ui_tts_focus_rect_hide ();
- return;
- }
-
- if (_candidate_area_2_visible) {
- if (focus_index == CLOSE_BUTTON_INDEX) {
- ui_candidate_window_close_button_cb (NULL, NULL, NULL, NULL);
- _candidate_tts_focus_index = MORE_BUTTON_INDEX;
- }
- } else {
- if (focus_index == MORE_BUTTON_INDEX) {
- ui_candidate_window_more_button_cb (NULL, NULL, NULL, NULL);
- _candidate_tts_focus_index = CLOSE_BUTTON_INDEX;
- }
- }
-}
-#endif /* HAVE_ECOREX */
-
/**
* @brief Create preedit window.
*/
}
update_table (ISF_CANDIDATE_TABLE, table);
- _candidate_tts_focus_index = INVALID_TTS_FOCUS_INDEX;
ui_tts_focus_rect_hide ();
#endif /* CANDIDATE */
}
strTts = String (_("close button"));
evas_object_geometry_get (_close_btn, &x, &y, &w, &h);
} else {
- LOGW ("TTS focus index = %d", _candidate_tts_focus_index);
ui_tts_focus_rect_hide ();
}
-#ifdef HAVE_TTS
- if (strTts.length () > 0)
- ui_play_tts (strTts.c_str ());
-#endif
if (w > 0 && h > 0) {
if (!_wait_stop_event)
ui_tts_focus_rect_show (x, y, w, h);
#endif
delete_ise_check_pid_alive_timer();
-#if ISF_BUILD_CANDIDATE_UI
-#ifdef HAVE_TTS
- ui_close_tts ();
-#endif
-#endif
-
if (_info_manager) {
try {
_info_manager->stop ();