[atspi] Fix reading twice when rotary selector is open 84/146484/6 accepted/tizen/unified/20170907.060455 submit/tizen/20170906.050545
authorJunsuChoi <jsuya.choi@samsung.com>
Tue, 29 Aug 2017 05:05:47 +0000 (14:05 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Tue, 5 Sep 2017 05:19:54 +0000 (14:19 +0900)
Change-Id: I5d717f863e8ffe2e20861455d2cbcdb14f2544e3

inc/wearable/efl_extension_common_private.h
src/wearable/efl_extension_rotary_selector.c

index 25871913bed0c6b5915e0e9fe463de5d2820cfa0..f5c79e75c81114431bc52f5a80a1f0cf7ad56dc6 100644 (file)
@@ -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;
index 42a7245d45526a3049928dfb4ea2d48bea96ec29..cf8a639c741f77261a3cad373912c8507e751f21 100644 (file)
@@ -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