summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-08-23 12:48:16 -0700
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-03 15:02:39 +0200
commit503fe47d71afcafb356e7c1f7ad497b0fe3ec267 (patch)
treebd994eb35325cfa1f9bb94f3576ddd634585c990
parent10bb658a0ad619aafd6b06894c59efee66d1b8a1 (diff)
downloadefl-503fe47d71afcafb356e7c1f7ad497b0fe3ec267.tar.gz
elementary: leverage sizing information from model if available to avoid unecessary calc.
With the new Efl unified infrastructure, we do delay a lot of the computation to finalize, by filling the object information before finalize we reduce unecessary computation.
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c
index 0579dc4a51..a0e0a44c38 100644
--- a/src/lib/elementary/efl_ui_widget_factory.c
+++ b/src/lib/elementary/efl_ui_widget_factory.c
@@ -72,12 +72,29 @@ static void
_efl_ui_widget_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, Efl_Gfx_Entity *ui_view)
{
const Efl_Model *model;
- Eina_Value *property;
+ Eina_Value *property, *width, *height;
char *style;
if (!pd->style) return ;
model = efl_ui_view_model_get(ui_view);
+
+ // Fetch min size from model if available to avoid recalculcating it
+ width = efl_model_property_get(model, "self.width");
+ height = efl_model_property_get(model, "self.height");
+ if (eina_value_type_get(width) != EINA_VALUE_TYPE_ERROR &&
+ eina_value_type_get(height) != EINA_VALUE_TYPE_ERROR)
+ {
+ Eina_Size2D s;
+
+ if (!eina_value_int_convert(width, &s.w)) s.w = 0;
+ if (!eina_value_int_convert(height, &s.h)) s.h = 0;
+
+ efl_gfx_hint_size_min_set(ui_view, s);
+ }
+ eina_value_free(width);
+ eina_value_free(height);
+
// As we have already waited for the property to be ready, we should get the right style now
property = efl_model_property_get(model, pd->style);
if (!property) return ;