efl_ui_item: fix event emission

with this commit events are emitted correctly, even if the container is
already on the way to deletion. Additionally, the codepath that is
triggered when the item is selected via clickable is now also going
through the selected property.

ref 7905

Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9517
This commit is contained in:
Marcel Hollerbach 2019-08-06 22:31:40 +02:00
parent 54c524f7f6
commit d11551050d
1 changed files with 13 additions and 7 deletions

View File

@ -143,11 +143,17 @@ _item_select(Eo *obj, Efl_Ui_Item_Data *pd)
{
Efl_Ui_Select_Mode m;
if (!pd->parent)
return;
m = efl_ui_select_mode_get(pd->parent);
if (m == EFL_UI_SELECT_MODE_NONE || (pd->selected && m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS))
return;
if (pd->parent)
{
m = efl_ui_select_mode_get(pd->parent);
if (m == EFL_UI_SELECT_MODE_NONE || (pd->selected && m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS))
return;
}
else
{
if (pd->selected)
return;
}
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
@ -191,9 +197,9 @@ _item_unpressed(void *data, const Efl_Event *ev EINA_UNUSED)
m = efl_ui_select_mode_get(efl_ui_item_container_get(obj));
if ((m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS) && (pd->selected))
_item_unselect(obj, pd);
efl_ui_selectable_selected_set(obj, EINA_FALSE);
else if (m != EFL_UI_SELECT_MODE_NONE)
_item_select(obj, pd);
efl_ui_selectable_selected_set(obj, EINA_TRUE);
}
EFL_CALLBACKS_ARRAY_DEFINE(self_listening,