From: JunsuChoi Date: Tue, 29 Aug 2017 05:05:47 +0000 (+0900) Subject: [atspi] Fix reading twice when rotary selector is open X-Git-Tag: submit/tizen/20170906.050545^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3199d1e90bba255eb5348c4fbdbb0bfaafa858a4;p=platform%2Fcore%2Fuifw%2Fefl-ext.git [atspi] Fix reading twice when rotary selector is open Change-Id: I5d717f863e8ffe2e20861455d2cbcdb14f2544e3 --- diff --git a/inc/wearable/efl_extension_common_private.h b/inc/wearable/efl_extension_common_private.h index 2587191..f5c79e7 100644 --- a/inc/wearable/efl_extension_common_private.h +++ b/inc/wearable/efl_extension_common_private.h @@ -163,7 +163,7 @@ struct _Eext_Rotary_Selector_Data { Eext_Rotary_Selector_Accessibility_Eventarea_Hightlihgted_State event_area_highlighted_state; Evas_Object *backup_first_item_for_atspi; Evas_Object *backup_last_item_for_atspi; - Eina_Bool is_read_description; + Eina_Bool is_first_highlight; int reading_page_number; Eina_Bool from_moreoption; Eina_Bool control_by_rotary; diff --git a/src/wearable/efl_extension_rotary_selector.c b/src/wearable/efl_extension_rotary_selector.c index 42a7245..cf8a639 100644 --- a/src/wearable/efl_extension_rotary_selector.c +++ b/src/wearable/efl_extension_rotary_selector.c @@ -231,9 +231,10 @@ static void _selector_animation_finished_cb(void *data, Evas_Object *obj, const static void _editing_mode_turnoff(Eext_Rotary_Selector_Data *rsd); // ----------------------------------------- Accessibility API --------------------------------------// -static Eina_Bool _accessibility_event_area_highlighted_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info); +static Eina_Bool _accessibility_event_area_action_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info); static void _accessibility_item_btn_highlighted_cb(void *data, Evas_Object *obj, void *event_info); -static void _accessibility_set_relationship(Eext_Rotary_Selector_Data *rsd,int current_page); +static void _accessibility_relationship_set(Eext_Rotary_Selector_Data *rsd,int current_page); +static void _accessibility_event_area_reading_info_set(Eext_Rotary_Selector_Data *rsd); static char *_accessibility_item_name_set_cb(void *data, Evas_Object *obj); static char *_accessibility_name_set_cb(void *data, Evas_Object *obj); static char *_accessibility_description_set_cb(void *data, Evas_Object *obj); @@ -2822,10 +2823,12 @@ eext_rotary_selector_add(Evas_Object *parent) evas_object_smart_callback_add(rotary_selector, "more,option,opened", _rotary_selector_moreoption_opened_cb, rsd); evas_object_smart_callback_add(rotary_selector, "more,option,closed", _rotary_selector_moreoption_closed_cb, rsd); - elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT, _accessibility_event_area_highlighted_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_UNHIGHLIGHT, _accessibility_event_area_highlighted_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, _accessibility_event_area_highlighted_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, _accessibility_event_area_highlighted_cb, (Eext_Rotary_Selector_Data*)rsd); + elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT, _accessibility_event_area_action_cb, (Eext_Rotary_Selector_Data*)rsd); + elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_UNHIGHLIGHT, _accessibility_event_area_action_cb, (Eext_Rotary_Selector_Data*)rsd); + elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, _accessibility_event_area_action_cb, (Eext_Rotary_Selector_Data*)rsd); + elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, _accessibility_event_area_action_cb, (Eext_Rotary_Selector_Data*)rsd); + + rsd->is_first_highlight = EINA_TRUE; } _rotary_selector_from_moreoption_set(rotary_selector, EINA_FALSE); // @@ -3823,7 +3826,7 @@ void _accessibility_page_change(Eext_Rotary_Selector_Data *rsd, int previous_ite } static Eina_Bool -_accessibility_event_area_highlighted_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info) +_accessibility_event_area_action_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info) { if(!elm_atspi_bridge_utils_is_screen_reader_enabled()) return EINA_FALSE; @@ -3856,23 +3859,19 @@ _accessibility_event_area_highlighted_cb(void *data, Evas_Object *obj, Elm_Acces { case ELM_ACCESS_ACTION_UNHIGHLIGHT: rsd->is_event_area_highlighted = EINA_FALSE; - rsd->is_read_description = EINA_FALSE; + rsd->is_first_highlight = EINA_FALSE; break; case ELM_ACCESS_ACTION_HIGHLIGHT: - if (rsd->is_read_description) - { - elm_atspi_accessible_name_cb_set(rsd->event_area_access_object, _accessibility_name_set_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_atspi_accessible_description_cb_set(rsd->event_area_access_object, _accessibility_description_set_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_atspi_accessible_reading_info_type_set(rsd->event_area_access_object, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); - action_info->action_by = -1; - } + if (rsd->is_first_highlight) + action_info->action_by = -1; + if (action_info->action_by == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT || (changed_list == 1 && rsd->control_by_rotary)) { rsd->selected_index += 1; _accessibility_page_change(rsd, previous_item_index, EINA_TRUE); current_page = rsd->current_page + 1; rsd->event_area_highlighted_state = EEXT_ROTARY_SELECTOR_ACCESSIBILITY_EVENTAREA_HIGHTLIHGTED_STATE_RIGHT; - _accessibility_set_relationship(rsd, current_page); + _accessibility_relationship_set(rsd, current_page); } else if (action_info->action_by == ELM_ACCESS_ACTION_HIGHLIGHT_PREV || (changed_list == 2 && rsd->control_by_rotary)) { @@ -3880,44 +3879,13 @@ _accessibility_event_area_highlighted_cb(void *data, Evas_Object *obj, Elm_Acces _accessibility_page_change(rsd, previous_item_index, EINA_FALSE); current_page = rsd->current_page - 1; rsd->event_area_highlighted_state = EEXT_ROTARY_SELECTOR_ACCESSIBILITY_EVENTAREA_HIGHTLIHGTED_STATE_LEFT; - _accessibility_set_relationship(rsd, current_page); + _accessibility_relationship_set(rsd, current_page); } else { - Elm_Accessible_Reading_Info_Type type = elm_atspi_accessible_reading_info_type_get(rsd->event_area_access_object); - char buf[255] = ""; - if(type & ELM_ACCESSIBLE_READING_INFO_TYPE_NAME) - { - if(_rotary_selector_from_moreoption_get(rsd->rotary_selector)) - { - const char *buf_name; - buf_name = elm_atspi_accessible_name_get(rsd->event_area_access_object); - if(buf_name) - { - limit = sizeof(buf) - strlen(buf) - 1; - if (limit > 0) - strncat(buf, buf_name, limit); - } - } - } - if(type & ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION) - { - limit = sizeof(buf) - strlen(buf) - 1; - if (limit > 0) - strncat(buf, " ", limit); - const char *buf_desc; - buf_desc = elm_atspi_accessible_description_get(rsd->event_area_access_object); - if(buf_desc) - { - limit = sizeof(buf) - strlen(buf) - 1; - if (limit > 0) - strncat(buf, buf_desc, limit); - } - } - if(strcmp(buf,"")) - elm_atspi_bridge_utils_say(buf, EINA_TRUE, NULL, NULL); - _accessibility_set_relationship(rsd, rsd->current_page); + _accessibility_relationship_set(rsd, rsd->current_page); } + _accessibility_event_area_reading_info_set(rsd); rsd->is_event_area_highlighted = EINA_TRUE; ret = EINA_FALSE; break; @@ -3930,7 +3898,8 @@ _accessibility_event_area_highlighted_cb(void *data, Evas_Object *obj, Elm_Acces current_page = rsd->current_page + 1; rsd->event_area_highlighted_state = EEXT_ROTARY_SELECTOR_ACCESSIBILITY_EVENTAREA_HIGHTLIHGTED_STATE_RIGHT; - _accessibility_set_relationship(rsd, current_page); + _accessibility_relationship_set(rsd, current_page); + _accessibility_event_area_reading_info_set(rsd); ret = EINA_TRUE; const char *buf_desc; buf_desc = elm_atspi_accessible_description_get(rsd->event_area_access_object); @@ -3957,7 +3926,8 @@ _accessibility_event_area_highlighted_cb(void *data, Evas_Object *obj, Elm_Acces current_page = rsd->current_page - 1; rsd->event_area_highlighted_state = EEXT_ROTARY_SELECTOR_ACCESSIBILITY_EVENTAREA_HIGHTLIHGTED_STATE_LEFT; - _accessibility_set_relationship(rsd, current_page); + _accessibility_relationship_set(rsd, current_page); + _accessibility_event_area_reading_info_set(rsd); ret = EINA_TRUE; const char *buf_desc; buf_desc = elm_atspi_accessible_description_get(rsd->event_area_access_object); @@ -3969,7 +3939,21 @@ _accessibility_event_area_highlighted_cb(void *data, Evas_Object *obj, Elm_Acces return ret; } -static void _accessibility_set_relationship(Eext_Rotary_Selector_Data *rsd,int current_page) +static void _accessibility_event_area_reading_info_set(Eext_Rotary_Selector_Data *rsd) +{ + elm_atspi_accessible_description_cb_set(rsd->event_area_access_object, _accessibility_description_set_cb, (Eext_Rotary_Selector_Data*)rsd); + if (rsd->is_first_highlight) + { + elm_atspi_accessible_name_cb_set(rsd->event_area_access_object, _accessibility_name_set_cb, (Eext_Rotary_Selector_Data*)rsd); + elm_atspi_accessible_reading_info_type_set(rsd->event_area_access_object, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); + } + else + { + elm_atspi_accessible_reading_info_type_set(rsd->event_area_access_object, ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); + } +} + +static void _accessibility_relationship_set(Eext_Rotary_Selector_Data *rsd, int current_page) { Eext_Rotary_Selector_Item *item = NULL; Eext_Rotary_Selector_Item *before_item = NULL; @@ -3983,8 +3967,6 @@ static void _accessibility_set_relationship(Eext_Rotary_Selector_Data *rsd,int c int last_index = 0; rsd->reading_page_number = current_page; - elm_atspi_accessible_description_cb_set(rsd->event_area_access_object, _accessibility_description_set_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_atspi_accessible_reading_info_type_set(rsd->event_area_access_object, ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); first_index = current_page*_ROTARY_SELECTOR_PAGE_ITEM_MAX; @@ -4091,11 +4073,8 @@ _rotary_selector_moreoption_opened_cb(void *data, Evas_Object *obj, void *event_ Evas_Object *button = item->base.obj; elm_atspi_accessible_can_highlight_set(button, EINA_TRUE); } - rsd->is_read_description = EINA_TRUE; - elm_atspi_accessible_name_cb_set(rsd->event_area_access_object, _accessibility_name_set_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_atspi_accessible_description_cb_set(rsd->event_area_access_object, _accessibility_description_set_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_atspi_accessible_reading_info_type_set(rsd->event_area_access_object, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); - + rsd->is_first_highlight = EINA_TRUE; + _accessibility_event_area_reading_info_set(rsd); elm_atspi_component_highlight_grab(rsd->event_area_access_object); } @@ -4188,7 +4167,7 @@ _accessibility_description_set_cb(void *data, Evas_Object *obj) bindtextdomain (PACKAGE, LOCALE_DIR); - if (rsd->is_read_description) + if (rsd->is_first_highlight) { snprintf(buf, sizeof(buf), _("WDS_TTS_TBBODY_ROTATE_BEZEL_TO_NAVIGATE_ITEMS")); limit = sizeof(buf) - strlen(buf) - 1; @@ -4240,9 +4219,9 @@ _rotary_selector_screen_reader_changed(void *data, Evas_Object *obj, void *event evas_object_smart_callback_add(rsd->rotary_selector, "more,option,opened", _rotary_selector_moreoption_opened_cb, rsd); evas_object_smart_callback_add(rsd->rotary_selector, "more,option,closed", _rotary_selector_moreoption_closed_cb, rsd); - elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT, _accessibility_event_area_highlighted_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, _accessibility_event_area_highlighted_cb, (Eext_Rotary_Selector_Data*)rsd); - elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, _accessibility_event_area_highlighted_cb, (Eext_Rotary_Selector_Data*)rsd); + elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT, _accessibility_event_area_action_cb, (Eext_Rotary_Selector_Data*)rsd); + elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, _accessibility_event_area_action_cb, (Eext_Rotary_Selector_Data*)rsd); + elm_access_action_cb_set(rsd->event_area_access_object, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, _accessibility_event_area_action_cb, (Eext_Rotary_Selector_Data*)rsd); EINA_LIST_FOREACH(rsd->item_list, l, item) { @@ -4251,10 +4230,9 @@ _rotary_selector_screen_reader_changed(void *data, Evas_Object *obj, void *event evas_object_smart_callback_add(item->base.obj, "atspi,highlighted", _accessibility_item_btn_highlighted_cb, (Eext_Rotary_Selector_Data*)rsd); } - _accessibility_set_relationship(rsd, rsd->current_page); - rsd->is_read_description = EINA_TRUE; - //evpas_object_show(rsd->rotary_selector); - + _accessibility_relationship_set(rsd, rsd->current_page); + rsd->is_first_highlight = EINA_TRUE; + _accessibility_event_area_reading_info_set(rsd); } } else