seoz pushed a commit to branch master.

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

commit 6965e6b163adbf579dbebb5784669381f8403829
Author: Daniel Juyung Seo <[email protected]>
Date:   Sat Mar 22 18:01:22 2014 +0900

    list: Fixed item focus logic correctly by checking mouse down instead
    of highlighted_item.
    
    highlighted_item will be NULL after the first click and it is not
    useful. To avoid first item focus -> first item unfocus -> clicked
    item focus on the first focus to list widget, this patch is needed.
    
    Thanks for the report Ceolin.
---
 src/lib/elm_list.c        | 7 ++++---
 src/lib/elm_widget_list.h | 3 +--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index dbc5c04..407a9df 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -1074,7 +1074,7 @@ _elm_list_smart_on_focus(Eo *obj, void *_pd, va_list 
*list)
            _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 if (!sd->highlighted_item)
+        else if (!sd->mouse_down)
            _elm_list_item_focused((Elm_List_Item 
*)eina_list_data_get(sd->items));
         _elm_widget_focus_highlight_start(obj);
      }
@@ -1152,7 +1152,6 @@ _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 = (Elm_Object_Item *)it;
    _elm_list_unwalk(obj, sd);
    evas_object_unref(obj);
 }
@@ -1219,7 +1218,6 @@ _item_unhighlight(Elm_List_Item *it)
      }
    it->highlighted = EINA_FALSE;
 
-   sd->highlighted_item = NULL;
    _elm_list_unwalk(obj, sd);
    evas_object_unref(obj);
 }
@@ -1405,6 +1403,7 @@ _mouse_down_cb(void *data,
    else sd->on_hold = EINA_FALSE;
 
    if (sd->on_hold) return;
+   sd->mouse_down = EINA_TRUE;
    sd->was_selected = it->selected;
 
    evas_object_ref(obj);
@@ -1448,6 +1447,8 @@ _mouse_up_cb(void *data,
    if (ev->button != 1) return;
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE;
    else sd->on_hold = EINA_FALSE;
+
+   sd->mouse_down = EINA_FALSE;
    sd->longpressed = EINA_FALSE;
    ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
    ELM_SAFE_FREE(it->swipe_timer, ecore_timer_del);
diff --git a/src/lib/elm_widget_list.h b/src/lib/elm_widget_list.h
index 565ccb8..b6dfb9e 100644
--- a/src/lib/elm_widget_list.h
+++ b/src/lib/elm_widget_list.h
@@ -43,8 +43,6 @@ struct _Elm_List_Smart_Data
       Evas_Coord x, y;
    } history[ELM_LIST_SWIPE_MOVES];
 
-   Elm_Object_Item                      *highlighted_item;
-
    Eina_Bool                             focus_on_selection_enabled : 1;
    Eina_Bool                             was_selected : 1;
    Eina_Bool                             fix_pending : 1;
@@ -55,6 +53,7 @@ struct _Elm_List_Smart_Data
    Eina_Bool                             multi : 1;
    Eina_Bool                             swipe : 1;
    Eina_Bool                             delete_me : 1;
+   Eina_Bool                             mouse_down : 1; /**< a flag that 
mouse is down on the list at the moment. this flag is set to true on mouse and 
reset to false on mouse up */
 };
 
 typedef struct _Elm_List_Item Elm_List_Item;

-- 


Reply via email to