forked from enlightenment/efl
efl_ui_focus_composition: introduce dirty and prepare
this can be used in a container that has his own item management api, Each item management call results in a dirty call, once we are called to prepare for logical movement we can simply flush the order. So we reduce the spam of order calls, which also safes runtime.
This commit is contained in:
parent
0a814a0c71
commit
132eaba8d3
|
@ -2,6 +2,8 @@
|
|||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
|
||||
|
||||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
#include "efl_ui_focus_composition_adapter.eo.h"
|
||||
|
@ -13,6 +15,7 @@ typedef struct {
|
|||
Eina_List *register_target, *registered_targets;
|
||||
Eina_List *adapters;
|
||||
Efl_Ui_Focus_Manager *registered;
|
||||
Eina_Bool dirty;
|
||||
} Efl_Ui_Focus_Composition_Data;
|
||||
|
||||
static void
|
||||
|
@ -134,6 +137,24 @@ _efl_ui_focus_composition_elm_widget_focus_state_apply(Eo *obj, Efl_Ui_Focus_Com
|
|||
return registered;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_focus_composition_dirty(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Composition_Data *pd)
|
||||
{
|
||||
pd->dirty = EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_focus_composition_efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Focus_Composition_Data *pd)
|
||||
{
|
||||
efl_ui_focus_object_prepare_logical(efl_super(obj, MY_CLASS));
|
||||
|
||||
if (!pd->dirty) return;
|
||||
|
||||
efl_ui_focus_composition_prepare(obj);
|
||||
|
||||
pd->dirty = EINA_FALSE;
|
||||
}
|
||||
|
||||
#include "efl_ui_focus_composition.eo.c"
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -19,8 +19,20 @@ mixin Efl.Ui.Focus.Composition (Efl.Interface, Elm.Widget ) {
|
|||
logical_order : list<Efl.Gfx> @owned; [[The order to use]]
|
||||
}
|
||||
}
|
||||
dirty @protected {
|
||||
[[ Mark this widget as dirty, the children can be considered to be changed after that call
|
||||
]]
|
||||
}
|
||||
prepare @protected {
|
||||
[[A call to prepare the children of this element, called if marked as dirty
|
||||
|
||||
You can use this function to call composition_elements.
|
||||
]]
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Elm.Widget.focus_state_apply;
|
||||
Efl.Ui.Focus.Object.prepare_logical;
|
||||
@empty .prepare;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue