forked from enlightenment/efl
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:
parent
c8deb71004
commit
7eef2ca491
|
@ -1061,6 +1061,8 @@ _elm_list_smart_on_focus(Eo *obj, void *_pd, va_list *list)
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
|
|
||||||
if (elm_widget_focus_get(obj))
|
if (elm_widget_focus_get(obj))
|
||||||
|
{
|
||||||
|
if (!sd->highlighted_item)
|
||||||
{
|
{
|
||||||
if (sd->last_focused_item)
|
if (sd->last_focused_item)
|
||||||
_elm_list_item_focused((Elm_List_Item *)sd->last_focused_item);
|
_elm_list_item_focused((Elm_List_Item *)sd->last_focused_item);
|
||||||
|
@ -1068,6 +1070,7 @@ _elm_list_smart_on_focus(Eo *obj, void *_pd, va_list *list)
|
||||||
_elm_list_item_focused((Elm_List_Item *)sd->last_selected_item);
|
_elm_list_item_focused((Elm_List_Item *)sd->last_selected_item);
|
||||||
else
|
else
|
||||||
_elm_list_item_focused((Elm_List_Item *)eina_list_data_get(sd->items));
|
_elm_list_item_focused((Elm_List_Item *)eina_list_data_get(sd->items));
|
||||||
|
}
|
||||||
_elm_widget_focus_highlight_start(obj);
|
_elm_widget_focus_highlight_start(obj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1144,7 +1147,7 @@ _item_highlight(Elm_List_Item *it)
|
||||||
if ((select_raise) && (!strcmp(select_raise, "on")))
|
if ((select_raise) && (!strcmp(select_raise, "on")))
|
||||||
evas_object_raise(VIEW(it));
|
evas_object_raise(VIEW(it));
|
||||||
it->highlighted = EINA_TRUE;
|
it->highlighted = EINA_TRUE;
|
||||||
|
sd->highlighted_item = it;
|
||||||
_elm_list_unwalk(obj, sd);
|
_elm_list_unwalk(obj, sd);
|
||||||
evas_object_unref(obj);
|
evas_object_unref(obj);
|
||||||
}
|
}
|
||||||
|
@ -1211,6 +1214,7 @@ _item_unhighlight(Elm_List_Item *it)
|
||||||
}
|
}
|
||||||
it->highlighted = EINA_FALSE;
|
it->highlighted = EINA_FALSE;
|
||||||
|
|
||||||
|
sd->highlighted_item = NULL;
|
||||||
_elm_list_unwalk(obj, sd);
|
_elm_list_unwalk(obj, sd);
|
||||||
evas_object_unref(obj);
|
evas_object_unref(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ struct _Elm_List_Smart_Data
|
||||||
Eina_Bool multi : 1;
|
Eina_Bool multi : 1;
|
||||||
Eina_Bool swipe : 1;
|
Eina_Bool swipe : 1;
|
||||||
Eina_Bool delete_me : 1;
|
Eina_Bool delete_me : 1;
|
||||||
|
Elm_Object_Item *highlighted_item;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _Elm_List_Item Elm_List_Item;
|
typedef struct _Elm_List_Item Elm_List_Item;
|
||||||
|
|
Loading…
Reference in New Issue