evas: Set weight to "expand" by default

This is a semi experimental patch to set the default weight
of objects to (1, 1), i.e. EXPAND. This seems like a more
sensible default value than no weight. Some objects may not
need the expand weight, but this seems to be the minority,
not the majority.

Ref T5301
This commit is contained in:
Jean-Philippe Andre 2017-07-27 20:46:17 +09:00
parent fa1842370b
commit 1a1b8bc451
3 changed files with 9 additions and 0 deletions

View File

@ -207,6 +207,9 @@ _efl_canvas_object_efl_object_finalize(Eo *eo_obj, Evas_Object_Protected_Data *o
if (!EVAS_OBJECT_DATA_ALIVE(obj)) goto end;
if (obj->legacy.ctor) goto end;
if (!obj->legacy.weight_set)
efl_gfx_size_hint_weight_set(eo_obj, 1.0, 1.0);
if (obj->legacy.visible_set /* && ... */)
{
obj->legacy.finalized = EINA_TRUE;
@ -1628,6 +1631,7 @@ _efl_canvas_object_efl_gfx_size_hint_hint_weight_get(Eo *eo_obj EINA_UNUSED, Eva
EOLIAN static void
_efl_canvas_object_efl_gfx_size_hint_hint_weight_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, double x, double y)
{
obj->legacy.weight_set = 1;
if (obj->delete_me)
return;
evas_object_async_block(obj);

View File

@ -2880,6 +2880,10 @@ evas_render_pre(Evas *eo_e, Evas_Public_Data *evas)
if (!obj->legacy.visible_set)
efl_gfx_visible_set(eo_obj, EINA_TRUE);
// weight should be set during finalize()
if (EINA_UNLIKELY(!obj->legacy.weight_set))
efl_gfx_size_hint_weight_set(eo_obj, 1.0, 1.0);
}
eina_evlog("-render_pre_objects_finalize", eo_e, 0.0, NULL);

View File

@ -1261,6 +1261,7 @@ struct _Evas_Object_Protected_Data
struct {
Eina_Bool ctor : 1; // used legacy constructor
Eina_Bool visible_set : 1; // visibility manually set
Eina_Bool weight_set : 1; // weight manually set
Eina_Bool finalized : 1; // object fully constructed
} legacy;