gengrid: Prevent duplicated selected function calls when item is unselected in the function.

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
This commit is contained in:
Youngbok Shin 2015-11-18 19:39:13 +09:00 committed by SangHyeon Lee
parent 7f8973ede6
commit ebbc66a25c
1 changed files with 5 additions and 3 deletions

View File

@ -4125,13 +4125,16 @@ _item_select(Elm_Gen_Item *it)
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--;
@ -4144,9 +4147,8 @@ _item_select(Elm_Gen_Item *it)
{
it->del_cb(it);
eo_del(eo_it);
sd->last_selected_item = NULL;
}
else
sd->last_selected_item = eo_it;
}
evas_object_unref(obj);
}