More widget can be visible by screen reader
authorPatryk Kaczmarek <patryk.k@samsung.com>
Tue, 30 Jun 2015 12:14:36 +0000 (14:14 +0200)
committerPatryk Kaczmarek <patryk.k@samsung.com>
Tue, 30 Jun 2015 15:53:59 +0000 (17:53 +0200)
   * From now progressbars and calendars are visible for screen reader
   * Function to skip check for focusable state on object addded
   * Disabled widgets cannot be activated
   * Fixed navigation throught one application
   * missing header for app tracker added

Change-Id: I2d6eee3e147becce138ca728eb1e23289ef8b55f
Signed-off-by: Patryk Kaczmarek <patryk.k@samsung.com>
include/app_tracker.h
src/flat_navi.c
src/navigator.c

index 480df43..a950678 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef APP_TRACKER_H_
 #define APP_TRACKER_H_
 
+#include <string.h>
 #include <atspi/atspi.h>
 
 /**
index b2775ff..d685a59 100644 (file)
@@ -22,6 +22,7 @@ static const AtspiStateType required_states[] =
 
 static const AtspiRole interesting_roles[] =
 {
+   ATSPI_ROLE_CALENDAR,
    ATSPI_ROLE_CHECK_BOX,
    ATSPI_ROLE_COLOR_CHOOSER,
    ATSPI_ROLE_COMBO_BOX,
@@ -130,35 +131,71 @@ _accessible_list_split_with_filter(Eina_List *list, Eina_Each_Cb cb, void *user_
 }
 
 static Eina_Bool
+_obj_state_visible_and_showing(AtspiAccessible *obj, Eina_Bool for_parent)
+{
+   if (!obj) return EINA_FALSE;
+   Eina_Bool ret = EINA_FALSE;
+   AtspiStateSet *ss = NULL;
+   AtspiAccessible *parent = NULL;
+   if (!for_parent)
+      ss = atspi_accessible_get_state_set(obj);
+   else
+      {
+         parent = atspi_accessible_get_parent(obj, NULL);
+         if (parent)
+            ss = atspi_accessible_get_state_set(parent);
+      }
+   if (ss)
+      {
+         if (atspi_state_set_contains(ss, ATSPI_STATE_SHOWING)
+               && atspi_state_set_contains(ss, ATSPI_STATE_VISIBLE))
+            {
+               ret = EINA_TRUE;
+            }
+         g_object_unref(ss);
+      }
+   if (parent) g_object_unref(parent);
+   return ret;
+
+}
+
+static Eina_Bool
+_no_need_for_focusable_state(AtspiAccessible *obj)
+{
+   AtspiRole role = atspi_accessible_get_role(obj, NULL);
+
+   switch (role)
+      {
+      case ATSPI_ROLE_LIST_ITEM:
+         if (_obj_state_visible_and_showing(obj, EINA_TRUE))
+            return EINA_TRUE;
+         break;
+      case ATSPI_ROLE_PROGRESS_BAR:
+         if (_obj_state_visible_and_showing(obj, EINA_FALSE))
+            return EINA_TRUE;
+         break;
+      case ATSPI_ROLE_CALENDAR:
+         if (_obj_state_visible_and_showing(obj, EINA_FALSE))
+            return EINA_TRUE;
+         break;
+      default:
+         return EINA_FALSE;
+
+      }
+   return EINA_FALSE;
+}
+
+static Eina_Bool
 _filter_state_cb(const void *container, void *data, void *fdata)
 {
    AtspiStateType *state = data;
 
    Eina_Bool ret = EINA_TRUE;
    AtspiAccessible *obj = fdata;
-   AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL);
-   AtspiStateSet *ss_parent = NULL;
    AtspiStateSet *ss = NULL;
 
-   if (parent)
-      {
-         if (atspi_accessible_get_role(obj, NULL) == ATSPI_ROLE_LIST_ITEM)
-            {
-               ss_parent = atspi_accessible_get_state_set(parent);
-               if (ss_parent)
-                  {
-                     if (atspi_state_set_contains(ss_parent, ATSPI_STATE_SHOWING)
-                           && atspi_state_set_contains(ss_parent, ATSPI_STATE_VISIBLE))
-                        {
-                           g_object_unref(parent);
-                           g_object_unref(ss_parent);
-                           return EINA_TRUE;
-                        }
-                     g_object_unref(ss_parent);
-                  }
-            }
-         g_object_unref(parent);
-      }
+   if (_no_need_for_focusable_state(obj))
+      return EINA_TRUE;
 
    ss = atspi_accessible_get_state_set(obj);
    while (*state != ATSPI_STATE_LAST_DEFINED)
@@ -290,7 +327,7 @@ _contains(AtspiAccessible *obj, gint x, gint y)
    const ObjectCache *oc = object_cache_get(obj);
 
    if (oc && x >= oc->bounds->x && x <= oc->bounds->x + oc->bounds->width
-          && y >= oc->bounds->y && y <= oc->bounds->y + oc->bounds->height)
+         && y >= oc->bounds->y && y <= oc->bounds->y + oc->bounds->height)
       {
          DEBUG("INSIDE");
          return EINA_TRUE;
index b1997c3..509cb11 100644 (file)
@@ -352,9 +352,10 @@ _current_highlight_object_set(AtspiAccessible *obj)
                g_free(role);
                return;
             }
-         if (current_comp) {
-            atspi_component_clear_highlight(current_comp, &err);
-         }
+         if (current_comp)
+            {
+               atspi_component_clear_highlight(current_comp, &err);
+            }
          atspi_component_grab_highlight(comp, &err);
          current_comp = comp;
          GERROR_CHECK(err)
@@ -1011,6 +1012,19 @@ static void _value_dec_widget(void)
 }
 #endif
 
+static bool
+_check_if_widget_is_enabled(AtspiAccessible *obj)
+{
+   Eina_Bool ret = EINA_FALSE;
+   AtspiStateSet *st = atspi_accessible_get_state_set (obj);
+
+   if (atspi_state_set_contains(st, ATSPI_STATE_ENABLED))
+      ret = EINA_TRUE;
+
+   g_object_unref(st);
+   return ret;
+}
+
 static void _activate_widget(void)
 {
    //activate the widget
@@ -1035,6 +1049,12 @@ static void _activate_widget(void)
    if(!current_obj)
       return;
 
+   if (!_check_if_widget_is_enabled(current_obj))
+      {
+         DEBUG("Widget disable so cannot be activated");
+         return;
+      }
+
    current_widget = current_obj;
 
    display_info_about_object(current_widget);
@@ -1794,6 +1814,7 @@ static void
 _view_content_changed(void *user_data)
 {
    DEBUG("START");
+   _window_top_changed = EINA_TRUE;
    _window_cache_builded = EINA_FALSE;
    if (top_window)
       object_cache_build_async(top_window, 5, _on_cache_builded, NULL);