efl_ui_focus_object: introduce a new event for focus geometry changes

before the move and resize events have been used. However, this turned
out to not work well, because not all registered items are real
efl.gfx.entity objects, there is also a custom property for getting the
focus geometry, so now this property is completed with a event that is
emitted when the focus geometry changes. With this event we can
reintroduce relation caching. Since all events are marked correctly
dirty now.

Differential Revision: https://phab.enlightenment.org/D7347
This commit is contained in:
Marcel Hollerbach 2018-11-23 09:49:55 +01:00
parent fccc5fc438
commit 97ece33134
11 changed files with 28 additions and 4 deletions

View File

@ -1276,6 +1276,7 @@ _efl_ui_calendar_item_day_number_set(Eo *obj, Efl_Ui_Calendar_Item_Data *pd, int
pd->part = po;
else
pd->part = evas_object_data_get(po, "_part_access_obj");
_efl_ui_focus_event_redirector(pd->part, obj);
EINA_SAFETY_ON_NULL_RETURN(pd->part);
}

View File

@ -243,10 +243,9 @@ _canvas_object_deleted(void *data, const Efl_Event *ev EINA_UNUSED)
static void
_new_geom(void *data, const Efl_Event *event)
{
efl_event_callback_call(data, event->desc, event->info);
efl_event_callback_call(data, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED, event->info);
}
EFL_CALLBACKS_ARRAY_DEFINE(canvas_obj,
{EFL_GFX_ENTITY_EVENT_RESIZE, _new_geom},
{EFL_GFX_ENTITY_EVENT_MOVE, _new_geom},

View File

@ -402,6 +402,8 @@ dirty_flush_node(Efl_Ui_Focus_Manager *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Cal
static void
dirty_flush(Efl_Ui_Focus_Manager *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Node *node)
{
if (!pd->dirty) return;
efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FLUSH_PRE, NULL);
dirty_flush_node(obj, pd, node);
@ -465,8 +467,7 @@ _object_del_cb(void *data, const Efl_Event *event)
}
EFL_CALLBACKS_ARRAY_DEFINE(regular_node,
{EFL_GFX_ENTITY_EVENT_RESIZE, _node_new_geometry_cb},
{EFL_GFX_ENTITY_EVENT_MOVE, _node_new_geometry_cb},
{EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED, _node_new_geometry_cb},
{EFL_EVENT_INVALIDATE, _object_del_cb},
);

View File

@ -88,5 +88,6 @@ mixin Efl.Ui.Focus.Object
logical,changed: Efl.Ui.Focus.Object; [[Emitted when a new logical
parent should be used.]]
child_focus,changed: bool; [[Emitted if child_focus has changed]]
focus_geometry,changed: void; [[Emitted if focus geometry of this object has changed]]
}
}

View File

@ -5323,6 +5323,7 @@ _efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UN
Eo *parent = NULL;
sd->on_create = EINA_TRUE;
_efl_ui_focus_event_redirector(obj, obj);
efl_canvas_group_clipped_set(obj, EINA_FALSE);
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);

View File

@ -1955,6 +1955,8 @@ _elm_calendar_item_day_number_set(Eo *obj, Elm_Calendar_Item_Data *pd, int i)
else
pd->part = evas_object_data_get(po, "_part_access_obj");
_efl_ui_focus_event_redirector(pd->part, obj);
EINA_SAFETY_ON_NULL_RETURN(pd->part);
}

View File

@ -1781,6 +1781,8 @@ _elm_color_item_efl_object_constructor(Eo *eo_item, Elm_Color_Item_Data *item)
evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_event_callback_add
(VIEW(item), EVAS_CALLBACK_RESIZE, _item_resize, NULL);
_efl_ui_focus_event_redirector(VIEW(item), obj);
item->color_obj = edje_object_add(evas_object_evas_get(obj));
elm_widget_theme_object_set

View File

@ -41,6 +41,19 @@ Eina_Bool _use_build_config;
static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
EAPI Elm_Version *elm_version = &_version;
static void
_focus_ev_redirect_cb(void *data, const Efl_Event *ev)
{
efl_event_callback_call(data, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED, NULL);
}
void
_efl_ui_focus_event_redirector(Efl_Ui_Focus_Object *obj, Efl_Ui_Focus_Object *goal)
{
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_MOVE, _focus_ev_redirect_cb, goal);
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_RESIZE, _focus_ev_redirect_cb, goal);
}
void
_efl_ui_focus_manager_redirect_events_del(Efl_Ui_Focus_Manager *manager, Eo *obj)
{

View File

@ -909,4 +909,6 @@ void legacy_child_focus_handle(Efl_Ui_Focus_Object *object);
*/
void legacy_object_focus_handle(Efl_Ui_Focus_Object *object);
void _efl_ui_focus_event_redirector(Efl_Ui_Focus_Object *obj, Efl_Ui_Focus_Object *goal);
#endif

View File

@ -596,6 +596,7 @@ _elm_segment_control_item_efl_object_constructor(Eo *obj, Elm_Segment_Control_It
parent = efl_parent_get(obj);
VIEW_SET(it, edje_object_add(evas_object_evas_get(parent)));
_efl_ui_focus_event_redirector(VIEW(it), obj);
edje_object_scale_set(VIEW(it),efl_gfx_entity_scale_get(WIDGET(it)) *
elm_config_scale_get());
evas_object_smart_member_add(VIEW(it), parent);

View File

@ -2413,6 +2413,7 @@ _item_new(Evas_Object *obj,
WIDGET_ITEM_DATA_SET(EO_OBJ(it), data);
VIEW_SET(it, elm_layout_add(obj));
_efl_ui_focus_event_redirector(VIEW(it), eo_it);
elm_widget_tree_unfocusable_set(VIEW(it), EINA_TRUE);
evas_object_data_set(VIEW(it), "item", it);
efl_access_object_access_type_set(VIEW(it), EFL_ACCESS_TYPE_DISABLED);