efl: Use Eina.Size2D for size hint restricted min

This is the "internal" or "intrinsic" minimum size, to be set by EFL and
not by applications.
This commit is contained in:
Jean-Philippe Andre 2017-09-18 14:49:08 +09:00
parent 3bff7363b5
commit 7d2b4b6916
7 changed files with 54 additions and 52 deletions

View File

@ -933,12 +933,12 @@ _edje_recalc_do(Edje *ed)
if (ed->update_hints && ed->recalc_hints && !ed->calc_only)
{
Evas_Coord w, h;
Eina_Size2D min;
ed->recalc_hints = EINA_FALSE;
edje_object_size_min_calc(ed->obj, &w, &h);
efl_gfx_size_hint_restricted_min_set(ed->obj, w, h);
edje_object_size_min_calc(ed->obj, &min.w, &min.h);
efl_gfx_size_hint_restricted_min_set(ed->obj, min);
}
if (!ed->collection) return;
@ -3415,36 +3415,36 @@ _edje_part_recalc_single(Edje *ed,
(((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) ||
(((Edje_Part_Description_Table *)chosen_desc)->table.min.v))))
{
Evas_Coord lminw = 0, lminh = 0;
Eina_Size2D lmin;
efl_canvas_group_need_recalculate_set(ep->object, 1);
efl_canvas_group_calculate(ep->object);
efl_gfx_size_hint_restricted_min_get(ep->object, &lminw, &lminh);
lmin = efl_gfx_size_hint_restricted_min_get(ep->object);
if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h)
{
if (lminw > minw) minw = lminw;
if (lmin.w > minw) minw = lmin.w;
}
if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)
{
if (lminh > minh) minh = lminh;
if (lmin.h > minh) minh = lmin.h;
}
}
else if ((ep->part->type == EDJE_PART_TYPE_BOX) &&
((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) ||
(((Edje_Part_Description_Box *)chosen_desc)->box.min.v)))
{
Evas_Coord lminw = 0, lminh = 0;
Eina_Size2D lmin;
efl_canvas_group_need_recalculate_set(ep->object, 1);
efl_canvas_group_calculate(ep->object);
efl_gfx_size_hint_restricted_min_get(ep->object, &lminw, &lminh);
lmin = efl_gfx_size_hint_restricted_min_get(ep->object);
if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h)
{
if (lminw > minw) minw = lminw;
if (lmin.w > minw) minw = lmin.w;
}
if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)
{
if (lminh > minh) minh = lminh;
if (lmin.h > minh) minh = lmin.h;
}
}
else if (ep->part->type == EDJE_PART_TYPE_IMAGE)

View File

@ -124,11 +124,16 @@ interface Efl.Gfx.Size.Hint
this size internally, so any change to it from an application
might be ignored. Use @.hint_min instead.
]]
set @protected {}
get {}
set @protected {
[[This function is protected as it is meant for widgets to indicate
their "intrinsic" minimum size.
]]
}
get {
[[Get the "intrinsic" minimum size of this object.]]
}
values {
w: int; [[Integer to use as the minimum width hint.]]
h: int; [[Integer to use as the minimum height hint.]]
sz: Eina.Size2D; [[Minimum size (hint) in pixels.]]
}
}
@property hint_combined_min {

View File

@ -9,7 +9,7 @@ _efl_ui_box_stack_efl_pack_layout_layout_update(Eo *obj, void *_pd EINA_UNUSED)
{
Evas_Object_Box_Option *opt;
Evas_Object_Box_Data *bd;
int minw = 0, minh = 0;
Eina_Size2D min = { 0, 0 };
Eina_List *l;
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(obj, EFL_UI_BOX_CLASS));
@ -27,10 +27,10 @@ _efl_ui_box_stack_efl_pack_layout_layout_update(Eo *obj, void *_pd EINA_UNUSED)
int mw = 0, mh = 0;
efl_gfx_size_hint_combined_min_get(child, &mw, &mh);
if (mw > minw) minw = mw;
if (mh > minh) minh = mh;
if (mw > min.w) min.w = mw;
if (mh > min.h) min.h = mh;
}
efl_gfx_size_hint_restricted_min_set(obj, minw, minh);
efl_gfx_size_hint_restricted_min_set(obj, min);
}
#include "efl_ui_box_stack.eo.c"

View File

@ -185,7 +185,7 @@ _efl_ui_panes_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Panes_Data *sd)
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
Eo *first_content, *second_content;
int minw, minh;
Eina_Size2D min;
first_content = efl_content_get(efl_part(obj, "first"));
second_content = efl_content_get(efl_part(obj, "second"));
@ -208,16 +208,16 @@ _efl_ui_panes_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Panes_Data *sd)
if (sd->dir == EFL_UI_DIR_HORIZONTAL)
{
minw = MAX(sd->first_min.w, sd->second_min.w);
minh = sd->first_min.h + sd->second_min.h;
min.w = MAX(sd->first_min.w, sd->second_min.w);
min.h = sd->first_min.h + sd->second_min.h;
}
else
{
minw = sd->first_min.w + sd->second_min.w;
minh = MAX(sd->first_min.h, sd->second_min.h);
min.w = sd->first_min.w + sd->second_min.w;
min.h = MAX(sd->first_min.h, sd->second_min.h);
}
efl_gfx_size_hint_restricted_min_set(obj, minw, minh);
efl_gfx_size_hint_restricted_min_set(obj, min);
_set_min_size_new(obj);
}

View File

@ -1614,7 +1614,7 @@ _elm_win_state_change(Ecore_Evas *ee)
}
if (ch_wm_rotation)
{
efl_gfx_size_hint_restricted_min_set(obj, -1, -1);
efl_gfx_size_hint_restricted_min_set(obj, EINA_SIZE2D(-1, -1));
efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(-1, -1));
#ifdef HAVE_ELEMENTARY_X
ELM_WIN_DATA_ALIVE_CHECK(obj, sd);
@ -3495,7 +3495,7 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize)
}
sd->tmp_updating_hints = 1;
efl_gfx_size_hint_restricted_min_set(obj, minw, minh);
efl_gfx_size_hint_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(maxw, maxh));
sd->tmp_updating_hints = 0;
_elm_win_size_hints_update(obj, sd);
@ -6079,7 +6079,7 @@ _win_rotate(Evas_Object *obj, Efl_Ui_Win_Data *sd, int rotation, Eina_Bool resiz
sd->rot = rotation;
if (resize) TRAP(sd, rotation_with_resize_set, rotation);
else TRAP(sd, rotation_set, rotation);
efl_gfx_size_hint_restricted_min_set(obj, -1, -1);
efl_gfx_size_hint_restricted_min_set(obj, EINA_SIZE2D(-1, -1));
efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(-1, -1));
_elm_win_resize_objects_eval(obj, EINA_FALSE);
#ifdef HAVE_ELEMENTARY_X
@ -8080,7 +8080,7 @@ _window_layout_stack(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
}
if (minw < menuw) minw = menuw;
efl_gfx_size_hint_restricted_min_set(o, minw, minh);
efl_gfx_size_hint_restricted_min_set(o, EINA_SIZE2D(minw, minh));
evas_object_geometry_get(o, &x, &y, &w, &h);
if (w < minw) w = minw;
if (h < minh) h = minh;

View File

@ -1397,33 +1397,28 @@ evas_object_size_hint_display_mode_set(Eo *eo_obj, Evas_Display_Mode dispmode)
evas_object_inform_call_changed_size_hints(eo_obj);
}
EOLIAN static void
_efl_canvas_object_efl_gfx_size_hint_hint_restricted_min_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord *w, Evas_Coord *h)
EOLIAN static Eina_Size2D
_efl_canvas_object_efl_gfx_size_hint_hint_restricted_min_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
{
if ((!obj->size_hints) || obj->delete_me)
{
if (w) *w = 0;
if (h) *h = 0;
return;
}
if (w) *w = obj->size_hints->min.w;
if (h) *h = obj->size_hints->min.h;
return EINA_SIZE2D(0, 0);
return obj->size_hints->min;
}
EOLIAN static void
_efl_canvas_object_efl_gfx_size_hint_hint_restricted_min_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord w, Evas_Coord h)
_efl_canvas_object_efl_gfx_size_hint_hint_restricted_min_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Size2D sz)
{
if (obj->delete_me)
return;
evas_object_async_block(obj);
if (EINA_UNLIKELY(!obj->size_hints))
{
if (!w && !h) return;
if (!sz.w && !sz.h) return;
_evas_object_size_hint_alloc(eo_obj, obj);
}
if ((obj->size_hints->min.w == w) && (obj->size_hints->min.h == h)) return;
obj->size_hints->min.w = w;
obj->size_hints->min.h = h;
if ((obj->size_hints->min.w == sz.w) && (obj->size_hints->min.h == sz.h)) return;
obj->size_hints->min = sz;
evas_object_inform_call_changed_size_hints(eo_obj);
}
@ -2043,9 +2038,8 @@ _efl_canvas_object_efl_object_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Dat
unsigned int m;
int r, g, b, a;
//int requestw, requesth;
int minw, minh;
Eina_Rect geom;
Eina_Size2D max;
Eina_Size2D max, min;
short layer;
Eina_Bool focus;
Eina_Bool visible;
@ -2059,7 +2053,7 @@ _efl_canvas_object_efl_object_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Dat
name = efl_name_get(eo_obj); // evas_object_name_get(eo_obj);
geom = efl_gfx_geometry_get(eo_obj);
scale = efl_canvas_object_scale_get(eo_obj);
efl_gfx_size_hint_restricted_min_get(eo_obj, &minw, &minh);
min = efl_gfx_size_hint_restricted_min_get(eo_obj);
max = efl_gfx_size_hint_max_get(eo_obj);
//efl_gfx_size_hint_request_get(eo_obj, &requestw, &requesth);
efl_gfx_size_hint_align_get(eo_obj, &dblx, &dbly);
@ -2090,8 +2084,8 @@ _efl_canvas_object_efl_object_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Dat
EFL_DBG_INFO_APPEND(group, "Scale", EINA_VALUE_TYPE_DOUBLE, scale);
node = EFL_DBG_INFO_LIST_APPEND(group, "Min size");
EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, minw);
EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, minh);
EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, min.w);
EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, min.h);
node = EFL_DBG_INFO_LIST_APPEND(group, "Max size");
EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, max.w);
@ -2577,13 +2571,16 @@ evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord
EAPI void
evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
efl_gfx_size_hint_restricted_min_set(obj, w, h);
efl_gfx_size_hint_restricted_min_set(obj, EINA_SIZE2D(w, h));
}
EAPI void
evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
{
efl_gfx_size_hint_restricted_min_get(obj, w, h);
Eina_Size2D sz;
sz = efl_gfx_size_hint_restricted_min_get(obj);
if (w) *w = sz.w;
if (h) *h = sz.h;
}
EAPI void

View File

@ -1019,8 +1019,8 @@ struct _Evas_Double_Pair
struct _Evas_Size_Hints
{
Evas_Size min, request;
Eina_Size2D user_min, max;
Evas_Size request;
Eina_Size2D min, user_min, max;
Evas_Aspect aspect;
Evas_Double_Pair align, weight;
Evas_Border padding;