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.
This commit is contained in:
Flavio Ceolin 2014-03-17 16:55:08 -03:00
parent c8deb71004
commit 7eef2ca491
2 changed files with 12 additions and 7 deletions

View File

@ -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);
}

View File

@ -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;