ceolin pushed a commit to branch master.

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

commit fb13ad2a8e88427799fb98da3cf66a85915ae5b3
Author: Flavio Ceolin <[email protected]>
Date:   Mon Mar 17 16:55:08 2014 -0300

    elm:list: Avoiding two items be focused at same action
    
    On a list that have not received focus yet a mouse down gives the focus
    for the list (that gives the focus for the first item) and the mouse
    up the item is selected and receive the focus.
    
    The problem:  if the list is scrolled the focus given for the
    first item makes the list scroll to the top and not for the item
    selected by the user.
---
 src/lib/elm_list.c        | 18 +++++++++++-------
 src/lib/elm_widget_list.h |  1 +
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index 9d703d4..478125a 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -1062,12 +1062,15 @@ _elm_list_smart_on_focus(Eo *obj, void *_pd, va_list 
*list)
 
    if (elm_widget_focus_get(obj))
      {
-        if (sd->last_focused_item)
-          _elm_list_item_focused((Elm_List_Item *)sd->last_focused_item);
-        else if (sd->last_selected_item)
-          _elm_list_item_focused((Elm_List_Item *)sd->last_selected_item);
-        else
-          _elm_list_item_focused((Elm_List_Item 
*)eina_list_data_get(sd->items));
+        if (!sd->highlighted_item)
+          {
+             if (sd->last_focused_item)
+                _elm_list_item_focused((Elm_List_Item *)sd->last_focused_item);
+             else if (sd->last_selected_item)
+                _elm_list_item_focused((Elm_List_Item 
*)sd->last_selected_item);
+             else
+                _elm_list_item_focused((Elm_List_Item 
*)eina_list_data_get(sd->items));
+          }
         _elm_widget_focus_highlight_start(obj);
      }
    else
@@ -1144,7 +1147,7 @@ _item_highlight(Elm_List_Item *it)
    if ((select_raise) && (!strcmp(select_raise, "on")))
      evas_object_raise(VIEW(it));
    it->highlighted = EINA_TRUE;
-
+   sd->highlighted_item = it;
    _elm_list_unwalk(obj, sd);
    evas_object_unref(obj);
 }
@@ -1211,6 +1214,7 @@ _item_unhighlight(Elm_List_Item *it)
      }
    it->highlighted = EINA_FALSE;
 
+   sd->highlighted_item = NULL;
    _elm_list_unwalk(obj, sd);
    evas_object_unref(obj);
 }
diff --git a/src/lib/elm_widget_list.h b/src/lib/elm_widget_list.h
index 06562da..fcca175 100644
--- a/src/lib/elm_widget_list.h
+++ b/src/lib/elm_widget_list.h
@@ -53,6 +53,7 @@ struct _Elm_List_Smart_Data
    Eina_Bool                             multi : 1;
    Eina_Bool                             swipe : 1;
    Eina_Bool                             delete_me : 1;
+   Elm_Object_Item                      *highlighted_item;
 };
 
 typedef struct _Elm_List_Item Elm_List_Item;

-- 


Reply via email to