aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-04-30 12:36:29 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2018-04-30 15:22:52 +0200
commit33b957701313d3b7deaca6f13be4619e007132fc (patch)
tree4119ad7e92ef00333833b609af407da72b159cd7 /src
parentelm_widget_item_static_focus: a other element could also hide behind the (diff)
downloadefl-33b957701313d3b7deaca6f13be4619e007132fc.tar.gz
elm_widget_item_static_focus: do not call prepare on all realized items
we should spare out the group and disabled items
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/elm_widget_item_static_focus.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/src/lib/elementary/elm_widget_item_static_focus.c b/src/lib/elementary/elm_widget_item_static_focus.c
index fffb397fa8..4a90d5f822 100644
--- a/src/lib/elementary/elm_widget_item_static_focus.c
+++ b/src/lib/elementary/elm_widget_item_static_focus.c
@@ -18,14 +18,41 @@ typedef struct {
} Elm_Widget_Item_Static_Focus_Data;
static void
-_realized_cb(void *data, const Efl_Event *ev)
+_realized_set(Elm_Widget_Item_Static_Focus *f)
{
- Elm_Widget_Item_Static_Focus_Data *pd = efl_data_scope_get(data, MY_CLASS);
+ Elm_Widget_Item_Static_Focus_Data *pd = efl_data_scope_get(f, MY_CLASS);
+ pd->realized = EINA_TRUE;
+}
+
+static void
+_list_realized_cb(void *data, const Efl_Event *ev)
+{
if (ev->info != data) return;
- pd->realized = EINA_TRUE;
- efl_ui_focus_object_prepare_logical(data);
+ _realized_set(data);
+
+ if (!elm_object_item_disabled_get(data) &&
+ elm_genlist_item_type_get(data) != ELM_GENLIST_ITEM_GROUP)
+ efl_ui_focus_object_prepare_logical(data);
+}
+
+static void
+_grid_realized_cb(void *data, const Efl_Event *ev)
+{
+ const Elm_Gen_Item_Class *itc;
+ Eina_Bool is_group = EINA_FALSE;
+
+ if (ev->info != data) return;
+
+ _realized_set(data);
+
+ itc = elm_gengrid_item_item_class_get(data);
+
+ is_group = (itc && itc->item_style && !strcmp(itc->item_style, "group_index"));
+
+ if (!elm_object_item_disabled_get(data) && !is_group)
+ efl_ui_focus_object_prepare_logical(data);
}
static void
@@ -106,12 +133,12 @@ _elm_widget_item_static_focus_efl_object_constructor(Eo *obj, Elm_Widget_Item_St
if (efl_isa(wpd->widget, ELM_GENLIST_CLASS))
{
- efl_event_callback_add(wpd->widget, ELM_GENLIST_EVENT_REALIZED, _realized_cb, obj);
+ efl_event_callback_add(wpd->widget, ELM_GENLIST_EVENT_REALIZED, _list_realized_cb, obj);
efl_event_callback_add(wpd->widget, ELM_GENLIST_EVENT_UNREALIZED, _unrealized_cb, obj);
}
else
{
- efl_event_callback_add(wpd->widget, ELM_GENGRID_EVENT_REALIZED, _realized_cb, obj);
+ efl_event_callback_add(wpd->widget, ELM_GENGRID_EVENT_REALIZED, _grid_realized_cb, obj);
efl_event_callback_add(wpd->widget, ELM_GENGRID_EVENT_UNREALIZED, _unrealized_cb, obj);
}
return ret;
@@ -123,12 +150,12 @@ _elm_widget_item_static_focus_efl_object_destructor(Eo *obj, Elm_Widget_Item_Sta
Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
if (efl_isa(wpd->widget, ELM_GENLIST_CLASS))
{
- efl_event_callback_del(wpd->widget, ELM_GENLIST_EVENT_REALIZED, _realized_cb, obj);
+ efl_event_callback_del(wpd->widget, ELM_GENLIST_EVENT_REALIZED, _list_realized_cb, obj);
efl_event_callback_del(wpd->widget, ELM_GENLIST_EVENT_UNREALIZED, _unrealized_cb, obj);
}
else
{
- efl_event_callback_del(wpd->widget, ELM_GENGRID_EVENT_REALIZED, _realized_cb, obj);
+ efl_event_callback_del(wpd->widget, ELM_GENGRID_EVENT_REALIZED, _grid_realized_cb, obj);
efl_event_callback_del(wpd->widget, ELM_GENGRID_EVENT_UNREALIZED, _unrealized_cb, obj);
}