[Access] Fix the bug for access scroll and simplify the code.
authorJaehwan Kim <jae.hwan.kim@samsung.com>
Wed, 26 Jun 2013 02:36:57 +0000 (11:36 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Thu, 27 Jun 2013 05:52:52 +0000 (14:52 +0900)
Change-Id: I334153a12ab8db18b8db1d52010951cf5085cbcd

src/lib/elc_naviframe.c
src/lib/elm_access.c
src/lib/elm_index.c
src/lib/elm_panel.c
src/lib/elm_widget.c
src/lib/elm_widget.h

index 2f4caf7..d23ac9a 100644 (file)
@@ -272,7 +272,7 @@ _access_focus_set(Elm_Naviframe_Item *it)
    ao = ((Elm_Widget_Item *)it)->access_obj;
 
    if (ao && it->title_visible)
-     _elm_access_highlight_set(ao);
+     _elm_access_highlight_set(ao, EINA_TRUE);
    else
      {
         if (!elm_widget_highlight_get(it->content))
@@ -491,7 +491,7 @@ _item_text_set_hook(Elm_Object_Item *it,
         _access_obj_process(nit, EINA_TRUE);
 
         ao = ((Elm_Widget_Item *)nit)->access_obj;
-        if (!elm_widget_highlight_get(ao)) _elm_access_highlight_set(ao);
+        if (!elm_widget_highlight_get(ao)) _elm_access_highlight_set(ao, EINA_TRUE);
      }
 
    elm_layout_sizing_eval(WIDGET(nit));
index d507af6..cddce8e 100644 (file)
@@ -663,8 +663,8 @@ _elm_access_highlight_object_mouse(Evas_Object *obj, int type, int x, int y)
 static Eina_Bool
 _access_highlight_next_get(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool delay)
 {
-   int type;
    Evas_Object *ho, *parent, *target;
+   int type;
    Eina_Bool ret;
    Evas *evas;
    Elm_Access_Info *ac;
@@ -673,15 +673,12 @@ _access_highlight_next_get(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool
    target = NULL;
    ret = EINA_FALSE;
 
-   if (!elm_widget_is(obj)) return ret;
-
    ho = _access_highlight_object_get(obj);
-   if (!ho) ho = obj;
 
    parent = ho;
 
    /* find highlight root */
-   do
+   while (parent)
      {
         ELM_WIDGET_DATA_GET(parent, sd);
         if (sd->highlight_root)
@@ -692,52 +689,43 @@ _access_highlight_next_get(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool
           }
         parent = elm_widget_parent_get(parent);
      }
-   while (parent);
 
    _elm_access_auto_highlight_set(EINA_TRUE);
 
-   ret = elm_widget_focus_next_get(obj, dir, &target);
-   if (ret && target)
-     {
-        if (dir == ELM_FOCUS_NEXT)
-          type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
-        else
-          type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
-
-        if (!_access_action_callback_call(ho, type, NULL))
-          {
-             /* this value is used in _elm_access_object_highlight();
-                to inform the target object of how to get highlight */
-             action_by = type;
-
-             if (delay)
-               _elm_access_highlight_set(target);
-             else
-               {
-                  ac = evas_object_data_get(target, "_elm_access");
-                  if (!ac) return ret;
-
-                  if (highlight_read_timer)
-                    {
-                       ecore_timer_del(highlight_read_timer);
-                       highlight_read_timer = NULL;
-                    }
-
-                  _access_highlight_read(ac, target);
+   if (dir == ELM_FOCUS_NEXT)
+     type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
+   else
+     type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
 
-                  evas = evas_object_evas_get(target);
-                  if (!evas) return ret;
+   /* this value is used in _elm_access_object_highlight();
+      to inform the target object of how to get highlight */
+   action_by = type;
 
-                  /* move mouse position to inside of highlight object. if an object has a
-                     highlight by highlight_cycle();, the mouse still positions at previous
-                     position which would be made by MOUSE_IN event. */
-                  evas_object_geometry_get(target, &ho_point.x, &ho_point.y, 0, 0);
-                  evas_event_feed_mouse_move(evas, ho_point.x, ho_point.y, 0, NULL);
-               }
+   if (!_access_action_callback_call(ho, type, NULL))
+     {
+        if (ho)
+          {
+             Elm_Access_Info *info = _elm_access_object_get(ho);
+             if (type == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT && info->next)
+               target = info->next;
+             else if (type == ELM_ACCESS_ACTION_HIGHLIGHT_PREV && info->prev)
+               target = info->prev;
+          }
 
-             action_by = ELM_ACCESS_ACTION_FIRST;
+        if (target)
+          {
+             _elm_access_highlight_set(target, delay);
+             elm_widget_focus_region_show(target);
+             ret = EINA_TRUE;
+          }
+        else
+          {
+             ret = elm_widget_focus_next_get(obj, dir, &target);
+             if (ret && target)
+               _elm_access_highlight_set(target, delay);
           }
      }
+   action_by = ELM_ACCESS_ACTION_FIRST;
 
    _elm_access_auto_highlight_set(EINA_FALSE);
 
@@ -812,7 +800,7 @@ _elm_access_all_read_start(Evas_Object *obj)
                 to inform the target object of how to get highlight */
              action_by = type;
 
-             _elm_access_highlight_set(target);
+             _elm_access_highlight_set(target, EINA_FALSE);
 
              action_by = ELM_ACCESS_ACTION_FIRST;
           }
@@ -825,7 +813,7 @@ _elm_access_all_read_start(Evas_Object *obj)
 
 //-------------------------------------------------------------------------//
 EAPI void
-_elm_access_highlight_set(Evas_Object* obj)
+_elm_access_highlight_set(Evas_Object* obj, Eina_Bool delay)
 {
    Evas *evas;
    Elm_Access_Info *ac;
@@ -847,7 +835,10 @@ _elm_access_highlight_set(Evas_Object* obj)
      }
    /* use ecore_timer_add(); here, an object could have a highlight even though
       its text is not yet translated in case of the naviframe title */
-   highlight_read_timer = ecore_timer_add(0.1, _highlight_read_timeout_cb, obj);
+   if (delay)
+     highlight_read_timer = ecore_timer_add(0.1, _highlight_read_timeout_cb, obj);
+   else
+     _access_highlight_read(ac, obj);
 
    evas = evas_object_evas_get(obj);
    if (!evas) return;
@@ -990,7 +981,7 @@ _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir)
           }
         if (comming)
           {
-             elm_access_highlight_set(comming);
+             _elm_access_highlight_set(comming, EINA_FALSE);
              elm_widget_focus_region_show(comming);
           }
         else
@@ -1605,7 +1596,7 @@ elm_access_say(const char *text)
 EAPI void
 elm_access_highlight_set(Evas_Object* obj)
 {
-   _elm_access_highlight_set(obj);
+   _elm_access_highlight_set(obj, EINA_FALSE);
 }
 
 EAPI Eina_Bool
index d385671..297db2f 100644 (file)
@@ -406,7 +406,7 @@ _access_activate_cb(void *data,
    ELM_INDEX_DATA_GET(data, sd);
 
    it = eina_list_nth(sd->items, 0);
-   _elm_access_highlight_set(it->base.access_obj);
+   _elm_access_highlight_set(it->base.access_obj, EINA_FALSE);
    sd->index_focus = EINA_TRUE;
 }
 
index d5e1012..b498531 100644 (file)
@@ -143,7 +143,7 @@ _elm_panel_smart_focus_next(const Evas_Object *obj,
         po = (Evas_Object *)edje_object_part_object_get
                (ELM_WIDGET_DATA(sd)->resize_obj, "btn_icon");
         ao = evas_object_data_get(po, "_part_access_obj");
-        _elm_access_highlight_set(ao);
+        _elm_access_highlight_set(ao, EINA_FALSE);
      }
 
    /* Return */
index 1893a38..aab5649 100644 (file)
@@ -1822,7 +1822,7 @@ elm_widget_focus_cycle(Evas_Object *obj,
              if (!_elm_access_auto_highlight_get())
                elm_widget_focus_steal(target);
 
-             _elm_access_highlight_set(target);
+             _elm_access_highlight_set(target, EINA_TRUE);
              _elm_widget_focus_region_show(target);
           }
         else elm_widget_focus_steal(target);
index 6215e89..d518674 100644 (file)
@@ -614,7 +614,7 @@ EAPI void             _elm_access_object_hilight_disable(Evas *e);
 EAPI void             _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj);
 EAPI void             _elm_access_object_unregister(Evas_Object *obj, Evas_Object *hoverobj);
 EAPI Eina_Bool        _elm_access_2nd_click_timeout(Evas_Object *obj);
-EAPI void             _elm_access_highlight_set(Evas_Object* obj);
+EAPI void             _elm_access_highlight_set(Evas_Object *obj, Eina_Bool delay);
 EAPI Evas_Object *    _elm_access_edje_object_part_object_register(Evas_Object *obj, const Evas_Object *partobj, const char* part);
 EAPI void             _elm_access_edje_object_part_object_unregister(Evas_Object* obj, const Evas_Object *eobj, const char* part);
 EAPI void             _elm_access_widget_item_register(Elm_Widget_Item *item);