efl_ui_focus_object: do not emit focus_geometry_changed when not needed
Summary: this is emitted a lot of times, which costs time. Most of the time they are however not needed. With this commit, these events are not emitted anymore. ref T8321 Reviewers: zmike, cedric Reviewed By: zmike, cedric Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10348
This commit is contained in:
parent
9d9aa8b6ae
commit
b7432f690f
|
@ -7,10 +7,13 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
#define MY_CLASS EFL_UI_FOCUS_OBJECT_MIXIN
|
||||
|
||||
typedef struct {
|
||||
Eina_Bool old_focus;
|
||||
Eina_Bool ongoing_prepare_call;
|
||||
Eina_Bool child_focus;
|
||||
Eina_Bool focus_geom_changed;
|
||||
} Efl_Ui_Focus_Object_Data;
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -65,5 +68,51 @@ _efl_ui_focus_object_child_focus_get(const Eo *obj EINA_UNUSED, Efl_Ui_Focus_Obj
|
|||
}
|
||||
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_focus_object_efl_object_event_callback_priority_add(Eo *obj, Efl_Ui_Focus_Object_Data *pd,
|
||||
const Efl_Event_Description *desc,
|
||||
Efl_Callback_Priority priority,
|
||||
Efl_Event_Cb func,
|
||||
const void *user_data)
|
||||
{
|
||||
if (desc == EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED)
|
||||
{
|
||||
pd->focus_geom_changed = EINA_TRUE;
|
||||
}
|
||||
|
||||
return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_focus_object_efl_object_event_callback_array_priority_add(Eo *obj, Efl_Ui_Focus_Object_Data *pd,
|
||||
const Efl_Callback_Array_Item *array,
|
||||
Efl_Callback_Priority priority,
|
||||
const void *user_data)
|
||||
{
|
||||
for (int i = 0; array[i].desc; ++i)
|
||||
{
|
||||
if (array[i].desc == EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED)
|
||||
{
|
||||
pd->focus_geom_changed = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
|
||||
}
|
||||
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_focus_object_efl_object_event_callback_call(Eo *obj, Efl_Ui_Focus_Object_Data *pd,
|
||||
const Efl_Event_Description *desc,
|
||||
void *event_info)
|
||||
{
|
||||
if (desc == EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED && !pd->focus_geom_changed)
|
||||
return EINA_TRUE;
|
||||
return efl_event_callback_call(efl_super(obj, MY_CLASS), desc, event_info);
|
||||
}
|
||||
|
||||
#define EFL_UI_FOCUS_OBJECT_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_ui_focus_object_efl_object_event_callback_priority_add), \
|
||||
EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_ui_focus_object_efl_object_event_callback_array_priority_add), \
|
||||
EFL_OBJECT_OP_FUNC(efl_event_callback_call, _efl_ui_focus_object_efl_object_event_callback_call) \
|
||||
|
||||
#include "efl_ui_focus_object.eo.c"
|
||||
|
|
Loading…
Reference in New Issue