aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-03-11 17:56:07 +0100
committerMarcel Hollerbach <marcel@osg.samsung.com>2018-03-15 15:39:12 +0100
commitbe3cfcec66c77d507f722ea41afbc4d018c7ed26 (patch)
treef886810295b3370c1c8b96289f0cf31dd3cf6367
parentefl_ui_focus_manager_calc: add onedirection to dirty (diff)
downloadefl-be3cfcec66c77d507f722ea41afbc4d018c7ed26.tar.gz
elm_genlist: move focus recovering to first_touch instead of
focus_update this means that the function is called more reliable, and not only based on focus state, but also based on the redirect situation.
-rw-r--r--src/lib/elementary/elm_genlist.c80
-rw-r--r--src/lib/elementary/elm_genlist.eo1
2 files changed, 39 insertions, 42 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index a05aaa0871..16f51c7b06 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -3366,62 +3366,58 @@ _elm_genlist_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
return eo_it;
}
-EOLIAN static Eina_Bool
-_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
+EOLIAN static void
+_elm_genlist_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Genlist_Data *sd, Efl_Ui_Focus_Direction direction EINA_UNUSED, Efl_Ui_Focus_Object *entry EINA_UNUSED)
{
- Eina_Bool int_ret = EINA_FALSE;
Elm_Object_Item *eo_it = NULL;
Eina_Bool is_sel = EINA_FALSE;
- int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
- if (!int_ret) return EINA_FALSE;
-
- if (efl_ui_focus_object_focus_get(obj) && (sd->items) && (sd->selected) &&
- (!sd->last_selected_item))
+ if (sd->last_focused_item)
+ eo_it = sd->last_focused_item;
+ else if (sd->last_selected_item)
+ eo_it = sd->last_selected_item;
+ else if (_elm_config->first_item_focus_on_first_focus_in || !eo_it)
{
- sd->last_selected_item = eina_list_data_get(sd->selected);
+ eo_it = elm_genlist_first_item_get(obj);
+ is_sel = EINA_TRUE;
}
- if (efl_ui_focus_object_focus_get(obj) && !sd->mouse_down)
+ while (eo_it)
{
- if (sd->last_focused_item)
- eo_it = sd->last_focused_item;
- else if (sd->last_selected_item)
- eo_it = sd->last_selected_item;
- else if (_elm_config->first_item_focus_on_first_focus_in)
- {
- eo_it = elm_genlist_first_item_get(obj);
- is_sel = EINA_TRUE;
- }
-
- while (eo_it)
- {
- ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
- if ((!_is_no_select(it)) && (!elm_object_item_disabled_get(eo_it)))
- break;
- eo_it = EO_OBJ(ELM_GEN_ITEM_NEXT(it));
- }
+ ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
+ if ((!_is_no_select(it)) && (!elm_object_item_disabled_get(eo_it)))
+ break;
+ eo_it = EO_OBJ(ELM_GEN_ITEM_NEXT(it));
+ }
+ if (eo_it)
+ {
+ eo_it = _elm_genlist_nearest_visible_item_get(obj, eo_it);
if (eo_it)
{
- eo_it = _elm_genlist_nearest_visible_item_get(obj, eo_it);
- if (eo_it)
- {
- if (!_elm_config->item_select_on_focus_disable && is_sel)
- elm_genlist_item_selected_set(eo_it, EINA_TRUE);
- else
- elm_object_item_focus_set(eo_it, EINA_TRUE);
- _elm_widget_focus_highlight_start(obj);
- }
+ if (!_elm_config->item_select_on_focus_disable && is_sel)
+ elm_genlist_item_selected_set(eo_it, EINA_TRUE);
+ else
+ elm_object_item_focus_set(eo_it, EINA_TRUE);
+ _elm_widget_focus_highlight_start(obj);
+ //set it again in the manager, there might be the case that the manager focus history and internal item foused logic are in different states
+ efl_ui_focus_manager_focus_set(obj, eo_it);
}
}
- else
+}
+
+EOLIAN static Eina_Bool
+_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
+{
+ Eina_Bool int_ret = EINA_FALSE;
+
+ int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
+ if (!int_ret) return EINA_FALSE;
+
+ if (efl_ui_focus_object_focus_get(obj) && (sd->items) && (sd->selected) &&
+ (!sd->last_selected_item))
{
- if (sd->focused_item)
- {
- sd->last_focused_item = sd->focused_item;
- _elm_genlist_item_unfocused(sd->focused_item);
- }
+ sd->last_selected_item = eina_list_data_get(sd->selected);
}
return EINA_TRUE;
diff --git a/src/lib/elementary/elm_genlist.eo b/src/lib/elementary/elm_genlist.eo
index 8100b26077..f3141b9568 100644
--- a/src/lib/elementary/elm_genlist.eo
+++ b/src/lib/elementary/elm_genlist.eo
@@ -558,6 +558,7 @@ class Elm.Genlist (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Elm.Interface_Scroll
Efl.Access.Selection.access_selection_clear;
Efl.Ui.Focus.Composition.prepare;
Efl.Ui.Widget.focus_state_apply;
+ Efl.Ui.Focus.Manager.setup_on_first_touch;
}
events {
item,focused; [[Called when genlist item got focus]]