forked from enlightenment/efl
efl_ui_item: only fetch multiselection state if this is relevant
there are cases where the container does only implement single selection, when then just asume implicitly single mode here. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9722
This commit is contained in:
parent
02b63b8260
commit
c947485bd0
|
@ -12,6 +12,17 @@
|
||||||
|
|
||||||
#define MY_CLASS_NAME "Efl.Ui.Item"
|
#define MY_CLASS_NAME "Efl.Ui.Item"
|
||||||
|
|
||||||
|
static Efl_Ui_Select_Mode
|
||||||
|
_fetch_state(Eo *obj)
|
||||||
|
{
|
||||||
|
if (efl_isa(obj, EFL_UI_MULTI_SELECTABLE_INTERFACE))
|
||||||
|
return efl_ui_select_mode_get(obj);
|
||||||
|
if (efl_isa(obj, EFL_UI_SINGLE_SELECTABLE_INTERFACE))
|
||||||
|
return EFL_UI_SELECT_MODE_SINGLE;
|
||||||
|
ERR("Uncaught state");
|
||||||
|
return EFL_UI_SELECT_MODE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_item_select(Eo *obj, Efl_Ui_Item_Data *pd)
|
_item_select(Eo *obj, Efl_Ui_Item_Data *pd)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +30,7 @@ _item_select(Eo *obj, Efl_Ui_Item_Data *pd)
|
||||||
|
|
||||||
if (pd->container)
|
if (pd->container)
|
||||||
{
|
{
|
||||||
m = efl_ui_select_mode_get(pd->container);
|
m = _fetch_state(pd->container);
|
||||||
if (m == EFL_UI_SELECT_MODE_NONE || (pd->selected && m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS))
|
if (m == EFL_UI_SELECT_MODE_NONE || (pd->selected && m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +79,7 @@ _item_unpressed(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
if (!efl_ui_item_container_get(obj)) return;
|
if (!efl_ui_item_container_get(obj)) return;
|
||||||
|
|
||||||
efl_layout_signal_emit(obj, "efl,state,unpressed", "efl");
|
efl_layout_signal_emit(obj, "efl,state,unpressed", "efl");
|
||||||
m = efl_ui_select_mode_get(efl_ui_item_container_get(obj));
|
m = _fetch_state(pd->container);
|
||||||
|
|
||||||
if ((m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS) && (pd->selected))
|
if ((m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS) && (pd->selected))
|
||||||
efl_ui_selectable_selected_set(obj, EINA_FALSE);
|
efl_ui_selectable_selected_set(obj, EINA_FALSE);
|
||||||
|
|
Loading…
Reference in New Issue