Summary:
If item is unselected in a selected function,
selected function will be called once more from _elm_gengrid_elm_widget_on_focus.
It is happened when elm_gengrid object has no focus and one of item is selected by mouse up event.
To fix this issue, we need to set focus to item and keep the address of selected item before calling selected function.
@fix
Test Plan:
1. Install & Run efbb (Escape From Booty Bay: https://git.enlightenment.org/games/efbb.git/)
2. Select a level in the main menu. (It is using elm_gengrid).
3. See duplicated target images.
Reviewers: cedric, SanghyeonLee
Reviewed By: SanghyeonLee
Differential Revision: https://phab.enlightenment.org/D3323
evas_object_ref(obj);
it->walking++;
sd->walking++;
+
+ elm_object_item_focus_set(eo_it, EINA_TRUE);
+ sd->last_selected_item = eo_it;
+
if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), eo_it);
if (it->generation == sd->generation)
{
eo_do(WIDGET(it), eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, eo_it));
if (_elm_config->atspi_mode)
elm_interface_atspi_accessible_state_changed_signal_emit(eo_it, ELM_ATSPI_STATE_SELECTED, EINA_TRUE);
- elm_object_item_focus_set(eo_it, EINA_TRUE);
}
it->walking--;
{
it->del_cb(it);
eo_del(eo_it);
+ sd->last_selected_item = NULL;
}
- else
- sd->last_selected_item = eo_it;
}
evas_object_unref(obj);
}