jaehwan pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=34e06a05e0cba7f70c4ad3ffc1e3c19eb4fb9ba7

commit 34e06a05e0cba7f70c4ad3ffc1e3c19eb4fb9ba7
Author: Jaehwan Kim <jae.hwan....@samsung.com>
Date:   Fri Sep 25 15:24:53 2015 +0900

    focus: add the focus_direction feature about item.
    
    When the focus is moved, it uses focus_direction instead of
    focus_origin.
    It can get the focus by using the geometry of previous focused object or 
item
    
    @feature
---
 src/lib/elc_ctxpopup.c     |  4 +-
 src/lib/elc_fileselector.c |  4 +-
 src/lib/elc_naviframe.c    |  4 +-
 src/lib/elc_popup.c        |  4 +-
 src/lib/elm_box.c          |  4 +-
 src/lib/elm_bubble.c       |  4 +-
 src/lib/elm_flip.c         |  4 +-
 src/lib/elm_frame.c        |  4 +-
 src/lib/elm_general.eot    |  2 -
 src/lib/elm_gengrid.c      | 98 ++++++++++++++++++++++------------------------
 src/lib/elm_gengrid.eo     |  1 +
 src/lib/elm_grid.c         |  4 +-
 src/lib/elm_layout.c       |  4 +-
 src/lib/elm_notify.c       |  4 +-
 src/lib/elm_spinner.c      |  4 +-
 src/lib/elm_table.c        |  4 +-
 src/lib/elm_widget.c       | 26 +++++-------
 src/lib/elm_widget.eo      |  9 ++---
 src/lib/elm_widget.h       |  9 +++--
 src/lib/elm_win.c          |  4 +-
 20 files changed, 93 insertions(+), 108 deletions(-)

diff --git a/src/lib/elc_ctxpopup.c b/src/lib/elc_ctxpopup.c
index f23f588..df95f08 100644
--- a/src/lib/elc_ctxpopup.c
+++ b/src/lib/elc_ctxpopup.c
@@ -86,7 +86,7 @@ _elm_ctxpopup_elm_widget_focus_next(Eo *obj EINA_UNUSED, 
Elm_Ctxpopup_Data *sd,
 }
 
 EOLIAN static Eina_Bool
-_elm_ctxpopup_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Ctxpopup_Data *sd, const Evas_Object *base, double degree, Evas_Object 
**direction, double *weight)
+_elm_ctxpopup_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Ctxpopup_Data *sd, const Evas_Object *base, double degree, Evas_Object 
**direction, Elm_Object_Item **direction_item, double *weight)
 {
    Eina_Bool int_ret;
 
@@ -101,7 +101,7 @@ _elm_ctxpopup_elm_widget_focus_direction(Eo *obj 
EINA_UNUSED, Elm_Ctxpopup_Data
    l = eina_list_append(l, sd->box);
 
    int_ret = elm_widget_focus_list_direction_get
-            (obj, base, l, list_data_get, degree, direction, weight);
+            (obj, base, l, list_data_get, degree, direction, direction_item, 
weight);
    eina_list_free(l);
 
    return int_ret;
diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c
index 74fee66..342c235 100644
--- a/src/lib/elc_fileselector.c
+++ b/src/lib/elc_fileselector.c
@@ -2442,7 +2442,7 @@ 
_elm_fileselector_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm
 }
 
 EOLIAN static Eina_Bool
-_elm_fileselector_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Fileselector_Data *sd, const Evas_Object *base, double degree, Evas_Object 
**direction, double *weight)
+_elm_fileselector_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Fileselector_Data *sd, const Evas_Object *base, double degree, Evas_Object 
**direction, Elm_Object_Item **direction_item, double *weight)
 {
    Eina_List *items = NULL;
 
@@ -2455,7 +2455,7 @@ _elm_fileselector_elm_widget_focus_direction(Eo *obj 
EINA_UNUSED, Elm_Fileselect
    if (sd->ok_button) items = eina_list_append(items, sd->ok_button);
 
    elm_widget_focus_list_direction_get
-     (obj, base, items, eina_list_data_get, degree, direction, weight);
+     (obj, base, items, eina_list_data_get, degree, direction, direction_item, 
weight);
 
    eina_list_free(items);
 
diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c
index f1830ab..4273480 100644
--- a/src/lib/elc_naviframe.c
+++ b/src/lib/elc_naviframe.c
@@ -1351,7 +1351,7 @@ _elm_naviframe_elm_widget_focus_direction_manager_is(Eo 
*obj EINA_UNUSED, Elm_Na
 }
 
 EOLIAN static Eina_Bool
-_elm_naviframe_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Naviframe_Data *sd EINA_UNUSED, const Evas_Object *base, double degree, 
Evas_Object **direction, double *weight)
+_elm_naviframe_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Naviframe_Data *sd EINA_UNUSED, const Evas_Object *base, double degree, 
Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
 {
    Eina_Bool int_ret;
 
@@ -1368,7 +1368,7 @@ _elm_naviframe_elm_widget_focus_direction(Eo *obj 
EINA_UNUSED, Elm_Naviframe_Dat
    l = eina_list_append(l, VIEW(top_it));
 
    int_ret = elm_widget_focus_list_direction_get
-            (obj, base, l, list_data_get, degree, direction, weight);
+            (obj, base, l, list_data_get, degree, direction, direction_item, 
weight);
 
    eina_list_free(l);
 
diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c
index a1d7849..9e8d041 100644
--- a/src/lib/elc_popup.c
+++ b/src/lib/elc_popup.c
@@ -1393,7 +1393,7 @@ _elm_popup_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, Elm_Popup_
 }
 
 EOLIAN static Eina_Bool
-_elm_popup_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Popup_Data *sd, 
const Evas_Object *base, double degree, Evas_Object **direction, double *weight)
+_elm_popup_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Popup_Data *sd, 
const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
 {
    Evas_Object *ao;
    Eina_List *items = NULL;
@@ -1417,7 +1417,7 @@ _elm_popup_elm_widget_focus_direction(Eo *obj 
EINA_UNUSED, Elm_Popup_Data *sd, c
    items = eina_list_merge(items, base_items);
 
    elm_widget_focus_list_direction_get
-     (sd->main_layout, base, items, eina_list_data_get, degree, direction, 
weight);
+     (sd->main_layout, base, items, eina_list_data_get, degree, direction, 
direction_item, weight);
    eina_list_free(items);
 
    return EINA_TRUE;
diff --git a/src/lib/elm_box.c b/src/lib/elm_box.c
index 2adc121..d37fd08 100644
--- a/src/lib/elm_box.c
+++ b/src/lib/elm_box.c
@@ -88,7 +88,7 @@ _elm_box_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, Elm_Box_Data
 }
 
 EOLIAN static Eina_Bool
-_elm_box_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Box_Data *_pd 
EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, 
double *weight)
+_elm_box_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Box_Data *_pd 
EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
 {
    const Eina_List *items;
    void *(*list_data_get)(const Eina_List *list);
@@ -107,7 +107,7 @@ _elm_box_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Box_Data *_pd EINA_
         if (!items) return EINA_FALSE;
      }
    return elm_widget_focus_list_direction_get
-            (obj, base, items, list_data_get, degree, direction, weight);
+            (obj, base, items, list_data_get, degree, direction, 
direction_item, weight);
 }
 
 EOLIAN static Eina_Bool
diff --git a/src/lib/elm_bubble.c b/src/lib/elm_bubble.c
index 9fdc9f8..fb869ae 100644
--- a/src/lib/elm_bubble.c
+++ b/src/lib/elm_bubble.c
@@ -98,7 +98,7 @@ _elm_bubble_elm_widget_focus_next(Eo *obj, Elm_Bubble_Data 
*_pd EINA_UNUSED, Elm
 }
 
 EOLIAN static Eina_Bool
-_elm_bubble_elm_widget_focus_direction(Eo *obj, Elm_Bubble_Data *_pd 
EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, 
double *weight)
+_elm_bubble_elm_widget_focus_direction(Eo *obj, Elm_Bubble_Data *_pd 
EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
 {
    Evas_Object *content;
 
@@ -108,7 +108,7 @@ _elm_bubble_elm_widget_focus_direction(Eo *obj, 
Elm_Bubble_Data *_pd EINA_UNUSED
 
    /* Try Focus cycle in subitem */
    return elm_widget_focus_direction_get
-            (content, base, degree, direction, weight);
+            (content, base, degree, direction, direction_item, weight);
 }
 
 EOLIAN static Eina_Bool
diff --git a/src/lib/elm_flip.c b/src/lib/elm_flip.c
index eab8b1e..e9b54f5 100644
--- a/src/lib/elm_flip.c
+++ b/src/lib/elm_flip.c
@@ -132,7 +132,7 @@ _elm_flip_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, Elm_Flip_Da
 }
 
 EOLIAN static Eina_Bool
-_elm_flip_elm_widget_focus_direction(Eo *obj, Elm_Flip_Data *sd, const 
Evas_Object *base, double degree, Evas_Object **direction, double *weight)
+_elm_flip_elm_widget_focus_direction(Eo *obj, Elm_Flip_Data *sd, const 
Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item 
**direction_item, double *weight)
 {
    Eina_Bool ret;
 
@@ -147,7 +147,7 @@ _elm_flip_elm_widget_focus_direction(Eo *obj, Elm_Flip_Data 
*sd, const Evas_Obje
      l = eina_list_append(l, sd->back.content);
 
    ret = elm_widget_focus_list_direction_get
-            (obj, base, l, list_data_get, degree, direction, weight);
+            (obj, base, l, list_data_get, degree, direction, direction_item, 
weight);
 
    eina_list_free(l);
 
diff --git a/src/lib/elm_frame.c b/src/lib/elm_frame.c
index 674653b..7cc4112 100644
--- a/src/lib/elm_frame.c
+++ b/src/lib/elm_frame.c
@@ -80,7 +80,7 @@ _elm_frame_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, Elm_Frame_
 }
 
 EOLIAN static Eina_Bool
-_elm_frame_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Frame_Data *_pd 
EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, 
double *weight)
+_elm_frame_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Frame_Data *_pd 
EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
 {
    Evas_Object *content;
 
@@ -92,7 +92,7 @@ _elm_frame_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Frame_Data *_pd E
      {
         /* Try to cycle focus on content */
         return elm_widget_focus_direction_get
-           (content, base, degree, direction, weight);
+           (content, base, degree, direction, direction_item, weight);
      }
 }
 
diff --git a/src/lib/elm_general.eot b/src/lib/elm_general.eot
index 57c81ae..6388b30 100644
--- a/src/lib/elm_general.eot
+++ b/src/lib/elm_general.eot
@@ -117,7 +117,5 @@ enum Elm.Focus_Direction
    down,     [[ down direction ]]
    right,    [[ right direction ]]
    left,     [[ left direction ]]
-   mouse,    [[ direction is from mouse ]]
-   revert    [[ direction is from focus revert ]]
 }
 
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index d5983e4..580d07a 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -3061,7 +3061,6 @@ _key_action_move(Evas_Object *obj, const char *params)
          (NULL, NULL, &v_w, &v_h));
 
    if (sd->reorder_mode && sd->reorder.running) return EINA_TRUE;
-
    _elm_widget_focus_auto_show(obj);
    if ((!strcmp(dir, "left") && !mirrored) ||
        (!strcmp(dir, "right") && mirrored))
@@ -3610,47 +3609,11 @@ _elm_gengrid_nearest_visible_item_get(Evas_Object *obj, 
Elm_Object_Item *eo_it)
    return eo_it;
 }
 
-static Elm_Object_Item *
-_elm_gengrid_direction_item_get(Evas_Object *obj, Elm_Focus_Direction dir)
-{
-   double max_weight = 0.0, weight = 0.0;
-   Eina_List *item_list = NULL, *l = NULL;
-   Elm_Object_Item *eo_item = NULL, *best_item = NULL;
-   Evas_Object *fobj = _elm_widget_focus_highlight_object_get(obj);
-
-   double degree = 0.0;
-   if (dir == ELM_FOCUS_UP) degree = 0.0;
-   else if (dir == ELM_FOCUS_DOWN) degree = 180.0;
-   else if (dir == ELM_FOCUS_RIGHT) degree = 90.0;
-   else if (dir == ELM_FOCUS_LEFT) degree = 270.0;
-
-   item_list = elm_gengrid_realized_items_get(obj);
-   best_item = elm_gengrid_first_item_get(obj);
-
-   EINA_LIST_FOREACH(item_list, l, eo_item)
-     {
-        ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
-        weight = _elm_widget_focus_direction_weight_get(fobj, VIEW(item), 
degree);
-        if ((weight == -1.0) ||
-            ((weight != 0.0) && (max_weight != -1.0) &&
-             ((int)(max_weight * 100000000) < (int)(weight * 100000000))))
-          {
-             best_item = eo_item;
-             max_weight = weight;
-          }
-     }
-   eina_list_free(item_list);
-
-   return best_item;
-}
-
 EOLIAN static Eina_Bool
 _elm_gengrid_elm_widget_on_focus(Eo *obj, Elm_Gengrid_Data *sd, 
Elm_Object_Item *item)
 {
    Eina_Bool int_ret = EINA_FALSE;
    Elm_Object_Item *eo_it = NULL;
-   Eina_Bool is_sel = EINA_FALSE;
-   Elm_Focus_Direction focus_origin;
 
    eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_on_focus(NULL));
    if (!int_ret) return EINA_FALSE;
@@ -3667,25 +3630,20 @@ _elm_gengrid_elm_widget_on_focus(Eo *obj, 
Elm_Gengrid_Data *sd, Elm_Object_Item
         if (item) eo_it = item;
         else
           {
-             focus_origin = elm_widget_focus_origin_get(obj);
-             if (focus_origin >= ELM_FOCUS_UP && focus_origin <= 
ELM_FOCUS_LEFT)
-               eo_it = _elm_gengrid_direction_item_get(obj, focus_origin);
-             else if (sd->last_focused_item)
+             if (sd->last_focused_item)
                eo_it = sd->last_focused_item;
              else if (sd->last_selected_item)
                eo_it = sd->last_selected_item;
              else if (_elm_config->first_item_focus_on_first_focus_in)
-               {
-                  eo_it = elm_gengrid_first_item_get(obj);
-                  is_sel = EINA_TRUE;
-               }
+               eo_it = elm_gengrid_first_item_get(obj);
           }
         if (eo_it)
           {
              eo_it = _elm_gengrid_nearest_visible_item_get(obj, eo_it);
              if (eo_it)
                {
-                  if (!_elm_config->item_select_on_focus_disable && is_sel)
+                  if (!_elm_config->item_select_on_focus_disable &&
+                      eo_it != sd->last_selected_item)
                     elm_gengrid_item_selected_set(eo_it, EINA_TRUE);
                   else
                     elm_object_item_focus_set(eo_it, EINA_TRUE);
@@ -3733,12 +3691,6 @@ _elm_gengrid_elm_widget_focus_next_manager_is(Eo *obj 
EINA_UNUSED, Elm_Gengrid_D
 }
 
 EOLIAN static Eina_Bool
-_elm_gengrid_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, 
Elm_Gengrid_Data *_pd EINA_UNUSED)
-{
-   return EINA_FALSE;
-}
-
-EOLIAN static Eina_Bool
 _elm_gengrid_elm_widget_focus_next(Eo *obj, Elm_Gengrid_Data *sd, 
Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
 {
    Eina_List *items = NULL;
@@ -3754,6 +3706,48 @@ _elm_gengrid_elm_widget_focus_next(Eo *obj, 
Elm_Gengrid_Data *sd, Elm_Focus_Dire
             (obj, items, eina_list_data_get, dir, next, next_item);
 }
 
+EOLIAN static Eina_Bool
+_elm_gengrid_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, 
Elm_Gengrid_Data *_pd EINA_UNUSED)
+{
+   return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_elm_gengrid_elm_widget_focus_direction(Eo *obj, Elm_Gengrid_Data *sd 
EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
+{
+   Eina_List *items = NULL, *l = NULL;
+   Elm_Object_Item *eo_item = NULL;
+   Eina_Bool ret = EINA_FALSE;
+   double c_weight = 0.0;
+
+   items = elm_gengrid_realized_items_get(obj);
+   eo_item = elm_object_focused_item_get(base);
+   if (eo_item)
+     {
+        ELM_GENGRID_ITEM_DATA_GET(eo_item, base_item);
+        base = VIEW(base_item);
+     }
+
+   EINA_LIST_FOREACH(items, l, eo_item)
+     {
+        ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
+
+        c_weight = _elm_widget_focus_direction_weight_get(base, VIEW(item), 
degree);
+        if ((c_weight == -1.0) ||
+            ((c_weight != 0.0) && (*weight != -1.0) &&
+             ((int)(*weight * 100000000) < (int)(c_weight * 100000000))))
+          {
+             *direction = (Evas_Object *)obj;
+             *direction_item = eo_item;
+             *weight = c_weight;
+             ret = EINA_TRUE;
+          }
+     }
+   eina_list_free(items);
+
+   return ret;
+}
+
 static void
 _mirrored_set(Evas_Object *obj,
               Eina_Bool rtl)
diff --git a/src/lib/elm_gengrid.eo b/src/lib/elm_gengrid.eo
index b2110ee..d5ca4ef 100644
--- a/src/lib/elm_gengrid.eo
+++ b/src/lib/elm_gengrid.eo
@@ -547,6 +547,7 @@ class Elm.Gengrid (Elm.Layout, Elm_Interface_Scrollable,
       Elm.Widget.focus_direction_manager_is;
       Elm.Widget.access;
       Elm.Widget.focus_next;
+      Elm.Widget.focus_direction;
       Elm.Widget.on_focus;
       Elm.Widget.on_focus_region;
       Elm.Widget.event;
diff --git a/src/lib/elm_grid.c b/src/lib/elm_grid.c
index 95edb60..2999faa 100644
--- a/src/lib/elm_grid.c
+++ b/src/lib/elm_grid.c
@@ -60,7 +60,7 @@ _elm_grid_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, void *_pd E
 }
 
 EOLIAN static Eina_Bool
-_elm_grid_elm_widget_focus_direction(Eo *obj, void *_pd EINA_UNUSED, const 
Evas_Object *base, double degree, Evas_Object **direction, double *weight)
+_elm_grid_elm_widget_focus_direction(Eo *obj, void *_pd EINA_UNUSED, const 
Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item 
**direction_item, double *weight)
 {
    const Eina_List *items;
    Eina_List *(*list_free)(Eina_List *list);
@@ -87,7 +87,7 @@ _elm_grid_elm_widget_focus_direction(Eo *obj, void *_pd 
EINA_UNUSED, const Evas_
      }
 
    int_ret = elm_widget_focus_list_direction_get(obj, base, items, 
list_data_get,
-                                             degree, direction, weight);
+                                             degree, direction, 
direction_item, weight);
 
    if (list_free) list_free((Eina_List *)items);
 
diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c
index 6576964..c16b8fe 100644
--- a/src/lib/elm_layout.c
+++ b/src/lib/elm_layout.c
@@ -562,7 +562,7 @@ _elm_layout_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, Elm_Layou
 }
 
 EOLIAN static Eina_Bool
-_elm_layout_elm_widget_focus_direction(Eo *obj, Elm_Layout_Smart_Data *sd, 
const Evas_Object *base, double degree, Evas_Object **direction, double *weight)
+_elm_layout_elm_widget_focus_direction(Eo *obj, Elm_Layout_Smart_Data *sd, 
const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
 {
    const Eina_List *items;
    void *(*list_data_get)(const Eina_List *list);
@@ -581,7 +581,7 @@ _elm_layout_elm_widget_focus_direction(Eo *obj, 
Elm_Layout_Smart_Data *sd, const
      }
 
    return elm_widget_focus_list_direction_get
-            (obj, base, items, list_data_get, degree, direction, weight);
+            (obj, base, items, list_data_get, degree, direction, 
direction_item, weight);
 }
 
 static void
diff --git a/src/lib/elm_notify.c b/src/lib/elm_notify.c
index 19f06de..2b2b82e 100644
--- a/src/lib/elm_notify.c
+++ b/src/lib/elm_notify.c
@@ -371,7 +371,7 @@ _elm_notify_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, Elm_Notif
 }
 
 EOLIAN static Eina_Bool
-_elm_notify_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Notify_Data 
*sd, const Evas_Object *base, double degree, Evas_Object **direction, double 
*weight)
+_elm_notify_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Notify_Data 
*sd, const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
 {
    Evas_Object *cur;
 
@@ -379,7 +379,7 @@ _elm_notify_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Notify_Data *sd,
 
    cur = sd->content;
 
-   return elm_widget_focus_direction_get(cur, base, degree, direction, weight);
+   return elm_widget_focus_direction_get(cur, base, degree, direction, 
direction_item, weight);
 }
 
 EOLIAN static Eina_Bool
diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c
index bbd0204..9dbad3e 100644
--- a/src/lib/elm_spinner.c
+++ b/src/lib/elm_spinner.c
@@ -1221,7 +1221,7 @@ _elm_spinner_elm_widget_focus_direction_manager_is(Eo 
*obj EINA_UNUSED, Elm_Spin
 }
 
 EOLIAN static Eina_Bool
-_elm_spinner_elm_widget_focus_direction(Eo *obj, Elm_Spinner_Data *_pd, const 
Evas_Object *base, double degree, Evas_Object **direction, double *weight)
+_elm_spinner_elm_widget_focus_direction(Eo *obj, Elm_Spinner_Data *_pd, const 
Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item 
**direction_item, double *weight)
 {
    Eina_Bool ret;
    Eina_List *items = NULL;
@@ -1241,7 +1241,7 @@ _elm_spinner_elm_widget_focus_direction(Eo *obj, 
Elm_Spinner_Data *_pd, const Ev
    items = eina_list_append(items, _pd->dec_button);
 
    ret = elm_widget_focus_list_direction_get
-        (obj, base, items, list_data_get, degree, direction, weight);
+        (obj, base, items, list_data_get, degree, direction, direction_item, 
weight);
    eina_list_free(items);
 
    return ret;
diff --git a/src/lib/elm_table.c b/src/lib/elm_table.c
index 5181518..1a4d01a 100644
--- a/src/lib/elm_table.c
+++ b/src/lib/elm_table.c
@@ -62,7 +62,7 @@ _elm_table_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, void *_pd
 }
 
 EOLIAN static Eina_Bool
-_elm_table_elm_widget_focus_direction(Eo *obj, void *_pd EINA_UNUSED, const 
Evas_Object *base, double degree, Evas_Object **direction, double *weight)
+_elm_table_elm_widget_focus_direction(Eo *obj, void *_pd EINA_UNUSED, const 
Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item 
**direction_item, double *weight)
 {
    Eina_Bool int_ret;
 
@@ -90,7 +90,7 @@ _elm_table_elm_widget_focus_direction(Eo *obj, void *_pd 
EINA_UNUSED, const Evas
      }
 
    int_ret = elm_widget_focus_list_direction_get
-       (obj, base, items, list_data_get, degree, direction, weight);
+       (obj, base, items, list_data_get, degree, direction, direction_item, 
weight);
 
    if (list_free)
      list_free((Eina_List *)items);
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 3b93522..5a1f6fa 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -63,7 +63,6 @@ struct _Elm_Translate_String_Data
 
 /* local subsystem globals */
 static unsigned int focus_order = 0;
-Elm_Focus_Direction focus_origin = -1;
 
 static inline Eina_Bool
 _elm_widget_is(const Evas_Object *obj)
@@ -396,7 +395,6 @@ _if_focused_revert(Evas_Object *obj,
    if (!sd->focused) return;
    if (!sd->parent_obj) return;
 
-   focus_origin = ELM_FOCUS_REVERT;
    top = elm_widget_top_get(sd->parent_obj);
    if (top)
      {
@@ -1848,7 +1846,6 @@ _elm_widget_focus_cycle(Eo *obj, Elm_Widget_Smart_Data 
*_pd EINA_UNUSED, Elm_Foc
    Elm_Object_Item *target_item = NULL;
    if (!_elm_widget_is(obj))
      return;
-   focus_origin = dir;
    elm_widget_focus_next_get(obj, dir, &target, &target_item);
    if (target)
      {
@@ -1888,6 +1885,7 @@ EOLIAN static Eina_Bool
 _elm_widget_focus_direction_go(Eo *obj, Elm_Widget_Smart_Data *_pd 
EINA_UNUSED, double degree)
 {
    Evas_Object *target = NULL;
+   Elm_Object_Item *target_item = NULL;
    Evas_Object *current_focused = NULL;
    double weight = 0.0;
 
@@ -1897,7 +1895,7 @@ _elm_widget_focus_direction_go(Eo *obj, 
Elm_Widget_Smart_Data *_pd EINA_UNUSED,
    current_focused = elm_widget_focused_object_get(obj);
 
    if (elm_widget_focus_direction_get
-         (obj, current_focused, degree, &target, &weight))
+         (obj, current_focused, degree, &target, &target_item, &weight))
      {
         elm_widget_focus_steal(target, NULL);
         return EINA_TRUE;
@@ -2249,7 +2247,7 @@ _elm_widget_focus_direction_weight_get(const Evas_Object 
*obj1,
  */
 
 EOLIAN static Eina_Bool
-_elm_widget_focus_direction_get(const Eo *obj, Elm_Widget_Smart_Data *sd, 
const Evas_Object *base, double degree, Evas_Object **direction, double *weight)
+_elm_widget_focus_direction_get(const Eo *obj, Elm_Widget_Smart_Data *sd, 
const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
 {
    double c_weight;
 
@@ -2267,7 +2265,7 @@ _elm_widget_focus_direction_get(const Eo *obj, 
Elm_Widget_Smart_Data *sd, const
    if (_internal_elm_widget_focus_direction_manager_is(obj))
      {
         Eina_Bool int_ret = EINA_FALSE;
-        eo_do((Eo *)obj, int_ret = elm_obj_widget_focus_direction(base, 
degree, direction, weight));
+        eo_do((Eo *)obj, int_ret = elm_obj_widget_focus_direction(base, 
degree, direction, direction_item, weight));
         return int_ret;
      }
 
@@ -2322,7 +2320,7 @@ _elm_widget_focus_direction_get(const Eo *obj, 
Elm_Widget_Smart_Data *sd, const
  * @ingroup Widget
  */
 EOLIAN static Eina_Bool
-_elm_widget_focus_list_direction_get(const Eo *obj EINA_UNUSED, 
Elm_Widget_Smart_Data *_pd EINA_UNUSED, const Evas_Object *base, const 
Eina_List *items, list_data_get_func_type list_data_get, double degree, 
Evas_Object **direction, double *weight)
+_elm_widget_focus_list_direction_get(const Eo *obj EINA_UNUSED, 
Elm_Widget_Smart_Data *_pd EINA_UNUSED, const Evas_Object *base, const 
Eina_List *items, list_data_get_func_type list_data_get, double degree, 
Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
 {
    if (!direction || !weight || !base || !items)
      return EINA_FALSE;
@@ -2334,7 +2332,7 @@ _elm_widget_focus_list_direction_get(const Eo *obj 
EINA_UNUSED, Elm_Widget_Smart
      {
         Evas_Object *cur = list_data_get(l);
         if (cur && _elm_widget_is(cur))
-          elm_widget_focus_direction_get(cur, base, degree, direction, weight);
+          elm_widget_focus_direction_get(cur, base, degree, direction, 
direction_item, weight);
      }
    if (current_best != *direction) return EINA_TRUE;
 
@@ -2367,7 +2365,6 @@ _elm_widget_focus_next_get(const Eo *obj, 
Elm_Widget_Smart_Data *sd, Elm_Focus_D
      return EINA_FALSE;
    *next = NULL;
 
-   focus_origin = dir;
    /* Ignore if disabled */
    if (_elm_config->access_mode && _elm_access_auto_highlight_get())
      {
@@ -2537,6 +2534,7 @@ _elm_widget_focus_list_next_get(const Eo *obj, 
Elm_Widget_Smart_Data *_pd EINA_U
              else
                {
                   Evas_Object *n = NULL;
+                  Elm_Object_Item *n_item = NULL;
                   double degree = 0;
                   double weight = 0.0;
 
@@ -2547,8 +2545,10 @@ _elm_widget_focus_list_next_get(const Eo *obj, 
Elm_Widget_Smart_Data *_pd EINA_U
 
                   if (elm_widget_focus_list_direction_get(obj, focused_object,
                                                           items, list_data_get,
-                                                          degree, &n, &weight))
+                                                          degree, &n, &n_item,
+                                                          &weight))
                     {
+                       *next_item = n_item;
                        *next = n;
                        return EINA_TRUE;
                     }
@@ -4101,12 +4101,6 @@ _elm_widget_focused_item_get(Eo *obj EINA_UNUSED, 
Elm_Widget_Smart_Data *_pd EIN
    return NULL;
 }
 
-EOLIAN static Elm_Focus_Direction
-_elm_widget_focus_origin_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd 
EINA_UNUSED)
-{
-   return focus_origin;
-}
-
 EOLIAN static void
 _elm_widget_focus_region_show_mode_set(Eo *obj EINA_UNUSED, 
Elm_Widget_Smart_Data *_pd, Elm_Focus_Region_Show_Mode mode)
 {
diff --git a/src/lib/elm_widget.eo b/src/lib/elm_widget.eo
index 44968e5..f171e90 100644
--- a/src/lib/elm_widget.eo
+++ b/src/lib/elm_widget.eo
@@ -366,12 +366,6 @@ abstract Elm.Widget (Evas.Object_Smart, 
Elm_Interface_Atspi_Accessible, Elm_Inte
             return: Evas.Object *;
          }
       }
-      @property focus_origin {
-         get {
-            [[Get the origination of the focus. Arrow key, tab key, mouse or 
deletion of an object.]]
-            return: Elm.Focus_Direction;
-         }
-      }
       @property parent2 {
          set {
          }
@@ -549,6 +543,7 @@ abstract Elm.Widget (Evas.Object_Smart, 
Elm_Interface_Atspi_Accessible, Elm_Inte
             @in base: const(Evas.Object)*;
             @in degree: double;
             @out direction: Evas.Object *;
+            @out direction_item: Elm_Object_Item *;
             @out weight: double;
          }
          return: bool;
@@ -588,6 +583,7 @@ abstract Elm.Widget (Evas.Object_Smart, 
Elm_Interface_Atspi_Accessible, Elm_Inte
             @in list_data_get: list_data_get_func_type;
             @in degree: double;
             @out direction: Evas.Object *;
+            @out direction_item: Elm_Object_Item *;
             @out weight: double;
          }
       }
@@ -694,6 +690,7 @@ abstract Elm.Widget (Evas.Object_Smart, 
Elm_Interface_Atspi_Accessible, Elm_Inte
             @in base: const(Evas.Object)*;
             @in degree: double;
             @out direction: Evas.Object *;
+            @out direction_item: Elm_Object_Item *;
             @out weight: double;
          }
       }
diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h
index 1e1ce9b..77c7059 100644
--- a/src/lib/elm_widget.h
+++ b/src/lib/elm_widget.h
@@ -343,11 +343,13 @@ typedef struct _Elm_Widget_Smart_Class
                                        Evas_Coord *h); /**< 'Virtual' function 
returning an inner area of a widget that should be brought into the visible 
area of a broader viewport, may this context arise. On the base Elementary 
widget class, it defaults to the object's total area, so only override it if 
you have to. */
    Eina_Bool        (*focus_next)(const Evas_Object *obj,
                                   Elm_Focus_Direction dir,
-                                  Evas_Object **next); /**< 'Virtual' function 
handling passing focus to sub-objects */
+                                  Evas_Object **next,
+                                  Elm_Object_Item **next_item); /**< 'Virtual' 
function handling passing focus to sub-objects */
    Eina_Bool        (*focus_direction)(const Evas_Object *obj,
                                        const Evas_Object *base,
                                        double degree,
                                        Evas_Object **target,
+                                       Elm_Object_Item **target_item,
                                        double *weight); /**< 'Virtual' 
function handling passing focus to sub-objects <b>given a direction, in 
degrees</b> */
 
    Eina_Bool        (*sub_object_add)(Evas_Object *obj,
@@ -679,9 +681,9 @@ EAPI void             
elm_widget_focus_custom_chain_append(Evas_Object *obj, Eva
 EAPI void             elm_widget_focus_custom_chain_prepend(Evas_Object *obj, 
Evas_Object *child, Evas_Object *relative_child);
 EAPI void             elm_widget_focus_cycle(Evas_Object *obj, 
Elm_Focus_Direction dir);
 EAPI Eina_Bool        elm_widget_focus_direction_go(Evas_Object *obj, double 
degree);
-EAPI Eina_Bool        elm_widget_focus_direction_get(const Evas_Object *obj, 
const Evas_Object *base, double degree, Evas_Object **direction, double 
*weight);
+EAPI Eina_Bool        elm_widget_focus_direction_get(const Evas_Object *obj, 
const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight);
 EAPI Eina_Bool        elm_widget_focus_next_get(const Evas_Object *obj, 
Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item);
-EAPI Eina_Bool        elm_widget_focus_list_direction_get(const Evas_Object  
*obj, const Evas_Object *base, const Eina_List *items, void 
*(*list_data_get)(const Eina_List *list), double degree, Evas_Object 
**direction, double *weight);
+EAPI Eina_Bool        elm_widget_focus_list_direction_get(const Evas_Object  
*obj, const Evas_Object *base, const Eina_List *items, void 
*(*list_data_get)(const Eina_List *list), double degree, Evas_Object 
**direction, Elm_Object_Item **direction_item, double *weight);
 EAPI Eina_Bool        elm_widget_focus_list_next_get(const Evas_Object *obj, 
const Eina_List *items, void *(*list_data_get)(const Eina_List *list), 
Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item);
 EAPI Evas_Object     *elm_widget_focus_next_object_get(const Evas_Object *obj, 
Elm_Focus_Direction dir);
 EAPI void             elm_widget_focus_next_object_set(Evas_Object *obj, 
Evas_Object *next, Elm_Focus_Direction dir);
@@ -788,7 +790,6 @@ EAPI void             
elm_widget_focus_move_policy_set(Evas_Object *obj, Elm_Foc
 EAPI Elm_Focus_Move_Policy elm_widget_focus_move_policy_get(const Evas_Object 
*obj);
 EAPI void             elm_widget_focus_region_show_mode_set(Evas_Object *obj, 
Elm_Focus_Region_Show_Mode mode);
 EAPI Elm_Focus_Region_Show_Mode elm_widget_focus_region_show_mode_get(const 
Evas_Object *obj);
-EAPI Elm_Focus_Direction elm_widget_focus_origin_get(const Evas_Object *obj);
 
 /**
  * Function to operate on a given widget's scrollabe children when necessary.
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index e6de231..d0bfb9a 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -1474,7 +1474,7 @@ _elm_win_elm_widget_focus_direction_manager_is(Eo *obj 
EINA_UNUSED, Elm_Win_Data
 }
 
 EOLIAN static Eina_Bool
-_elm_win_elm_widget_focus_direction(Eo *obj, Elm_Win_Data *_pd EINA_UNUSED, 
const Evas_Object *base, double degree, Evas_Object **direction, double *weight)
+_elm_win_elm_widget_focus_direction(Eo *obj, Elm_Win_Data *_pd EINA_UNUSED, 
const Evas_Object *base, double degree, Evas_Object **direction, 
Elm_Object_Item **direction_item, double *weight)
 {
    const Eina_List *items;
    void *(*list_data_get)(const Eina_List *list);
@@ -1490,7 +1490,7 @@ _elm_win_elm_widget_focus_direction(Eo *obj, Elm_Win_Data 
*_pd EINA_UNUSED, cons
         list_data_get = eina_list_data_get;
 
         return elm_widget_focus_list_direction_get
-                 (obj, base, items, list_data_get, degree, direction, weight);
+                 (obj, base, items, list_data_get, degree, direction, 
direction_item, weight);
      }
 
    return EINA_FALSE;

-- 


Reply via email to