summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-18 14:49:08 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-18 14:57:52 +0900
commit7d2b4b69166c0f2abaf0f0bdec3b0d04eb721517 (patch)
treec82ef99a638b25a02df5ba201522efe22d76ce92 /src/lib
parent3bff7363b54b541aa78d8ed0f743631582086a95 (diff)
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.
Diffstat (limited to '')
-rw-r--r--src/lib/edje/edje_calc.c22
-rw-r--r--src/lib/efl/interfaces/efl_gfx_size_hint.eo13
-rw-r--r--src/lib/elementary/efl_ui_box_stack.c8
-rw-r--r--src/lib/elementary/efl_ui_panes.c12
-rw-r--r--src/lib/elementary/efl_ui_win.c8
-rw-r--r--src/lib/evas/canvas/evas_object_main.c39
-rw-r--r--src/lib/evas/include/evas_private.h4
7 files changed, 54 insertions, 52 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 16d30218b5..1500ab0e8e 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -933,12 +933,12 @@ _edje_recalc_do(Edje *ed)
933 933
934 if (ed->update_hints && ed->recalc_hints && !ed->calc_only) 934 if (ed->update_hints && ed->recalc_hints && !ed->calc_only)
935 { 935 {
936 Evas_Coord w, h; 936 Eina_Size2D min;
937 937
938 ed->recalc_hints = EINA_FALSE; 938 ed->recalc_hints = EINA_FALSE;
939 939
940 edje_object_size_min_calc(ed->obj, &w, &h); 940 edje_object_size_min_calc(ed->obj, &min.w, &min.h);
941 efl_gfx_size_hint_restricted_min_set(ed->obj, w, h); 941 efl_gfx_size_hint_restricted_min_set(ed->obj, min);
942 } 942 }
943 943
944 if (!ed->collection) return; 944 if (!ed->collection) return;
@@ -3415,36 +3415,36 @@ _edje_part_recalc_single(Edje *ed,
3415 (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) || 3415 (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) ||
3416 (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)))) 3416 (((Edje_Part_Description_Table *)chosen_desc)->table.min.v))))
3417 { 3417 {
3418 Evas_Coord lminw = 0, lminh = 0; 3418 Eina_Size2D lmin;
3419 3419
3420 efl_canvas_group_need_recalculate_set(ep->object, 1); 3420 efl_canvas_group_need_recalculate_set(ep->object, 1);
3421 efl_canvas_group_calculate(ep->object); 3421 efl_canvas_group_calculate(ep->object);
3422 efl_gfx_size_hint_restricted_min_get(ep->object, &lminw, &lminh); 3422 lmin = efl_gfx_size_hint_restricted_min_get(ep->object);
3423 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h) 3423 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h)
3424 { 3424 {
3425 if (lminw > minw) minw = lminw; 3425 if (lmin.w > minw) minw = lmin.w;
3426 } 3426 }
3427 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v) 3427 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)
3428 { 3428 {
3429 if (lminh > minh) minh = lminh; 3429 if (lmin.h > minh) minh = lmin.h;
3430 } 3430 }
3431 } 3431 }
3432 else if ((ep->part->type == EDJE_PART_TYPE_BOX) && 3432 else if ((ep->part->type == EDJE_PART_TYPE_BOX) &&
3433 ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) || 3433 ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) ||
3434 (((Edje_Part_Description_Box *)chosen_desc)->box.min.v))) 3434 (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)))
3435 { 3435 {
3436 Evas_Coord lminw = 0, lminh = 0; 3436 Eina_Size2D lmin;
3437 3437
3438 efl_canvas_group_need_recalculate_set(ep->object, 1); 3438 efl_canvas_group_need_recalculate_set(ep->object, 1);
3439 efl_canvas_group_calculate(ep->object); 3439 efl_canvas_group_calculate(ep->object);
3440 efl_gfx_size_hint_restricted_min_get(ep->object, &lminw, &lminh); 3440 lmin = efl_gfx_size_hint_restricted_min_get(ep->object);
3441 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h) 3441 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h)
3442 { 3442 {
3443 if (lminw > minw) minw = lminw; 3443 if (lmin.w > minw) minw = lmin.w;
3444 } 3444 }
3445 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v) 3445 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)
3446 { 3446 {
3447 if (lminh > minh) minh = lminh; 3447 if (lmin.h > minh) minh = lmin.h;
3448 } 3448 }
3449 } 3449 }
3450 else if (ep->part->type == EDJE_PART_TYPE_IMAGE) 3450 else if (ep->part->type == EDJE_PART_TYPE_IMAGE)
diff --git a/src/lib/efl/interfaces/efl_gfx_size_hint.eo b/src/lib/efl/interfaces/efl_gfx_size_hint.eo
index 123912c39b..85905ffe25 100644
--- a/src/lib/efl/interfaces/efl_gfx_size_hint.eo
+++ b/src/lib/efl/interfaces/efl_gfx_size_hint.eo
@@ -124,11 +124,16 @@ interface Efl.Gfx.Size.Hint
124 this size internally, so any change to it from an application 124 this size internally, so any change to it from an application
125 might be ignored. Use @.hint_min instead. 125 might be ignored. Use @.hint_min instead.
126 ]] 126 ]]
127 set @protected {} 127 set @protected {
128 get {} 128 [[This function is protected as it is meant for widgets to indicate
129 their "intrinsic" minimum size.
130 ]]
131 }
132 get {
133 [[Get the "intrinsic" minimum size of this object.]]
134 }
129 values { 135 values {
130 w: int; [[Integer to use as the minimum width hint.]] 136 sz: Eina.Size2D; [[Minimum size (hint) in pixels.]]
131 h: int; [[Integer to use as the minimum height hint.]]
132 } 137 }
133 } 138 }
134 @property hint_combined_min { 139 @property hint_combined_min {
diff --git a/src/lib/elementary/efl_ui_box_stack.c b/src/lib/elementary/efl_ui_box_stack.c
index c50ea05960..3b8f2faed2 100644
--- a/src/lib/elementary/efl_ui_box_stack.c
+++ b/src/lib/elementary/efl_ui_box_stack.c
@@ -9,7 +9,7 @@ _efl_ui_box_stack_efl_pack_layout_layout_update(Eo *obj, void *_pd EINA_UNUSED)
9{ 9{
10 Evas_Object_Box_Option *opt; 10 Evas_Object_Box_Option *opt;
11 Evas_Object_Box_Data *bd; 11 Evas_Object_Box_Data *bd;
12 int minw = 0, minh = 0; 12 Eina_Size2D min = { 0, 0 };
13 Eina_List *l; 13 Eina_List *l;
14 14
15 EINA_SAFETY_ON_FALSE_RETURN(efl_isa(obj, EFL_UI_BOX_CLASS)); 15 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)
27 int mw = 0, mh = 0; 27 int mw = 0, mh = 0;
28 28
29 efl_gfx_size_hint_combined_min_get(child, &mw, &mh); 29 efl_gfx_size_hint_combined_min_get(child, &mw, &mh);
30 if (mw > minw) minw = mw; 30 if (mw > min.w) min.w = mw;
31 if (mh > minh) minh = mh; 31 if (mh > min.h) min.h = mh;
32 } 32 }
33 efl_gfx_size_hint_restricted_min_set(obj, minw, minh); 33 efl_gfx_size_hint_restricted_min_set(obj, min);
34} 34}
35 35
36#include "efl_ui_box_stack.eo.c" 36#include "efl_ui_box_stack.eo.c"
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index 2353ba57cf..6fc48e37eb 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -185,7 +185,7 @@ _efl_ui_panes_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Panes_Data *sd)
185 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 185 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
186 186
187 Eo *first_content, *second_content; 187 Eo *first_content, *second_content;
188 int minw, minh; 188 Eina_Size2D min;
189 189
190 first_content = efl_content_get(efl_part(obj, "first")); 190 first_content = efl_content_get(efl_part(obj, "first"));
191 second_content = efl_content_get(efl_part(obj, "second")); 191 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)
208 208
209 if (sd->dir == EFL_UI_DIR_HORIZONTAL) 209 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
210 { 210 {
211 minw = MAX(sd->first_min.w, sd->second_min.w); 211 min.w = MAX(sd->first_min.w, sd->second_min.w);
212 minh = sd->first_min.h + sd->second_min.h; 212 min.h = sd->first_min.h + sd->second_min.h;
213 } 213 }
214 else 214 else
215 { 215 {
216 minw = sd->first_min.w + sd->second_min.w; 216 min.w = sd->first_min.w + sd->second_min.w;
217 minh = MAX(sd->first_min.h, sd->second_min.h); 217 min.h = MAX(sd->first_min.h, sd->second_min.h);
218 } 218 }
219 219
220 efl_gfx_size_hint_restricted_min_set(obj, minw, minh); 220 efl_gfx_size_hint_restricted_min_set(obj, min);
221 _set_min_size_new(obj); 221 _set_min_size_new(obj);
222} 222}
223 223
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index c32754e97c..8e1b357058 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -1614,7 +1614,7 @@ _elm_win_state_change(Ecore_Evas *ee)
1614 } 1614 }
1615 if (ch_wm_rotation) 1615 if (ch_wm_rotation)
1616 { 1616 {
1617 efl_gfx_size_hint_restricted_min_set(obj, -1, -1); 1617 efl_gfx_size_hint_restricted_min_set(obj, EINA_SIZE2D(-1, -1));
1618 efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(-1, -1)); 1618 efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(-1, -1));
1619#ifdef HAVE_ELEMENTARY_X 1619#ifdef HAVE_ELEMENTARY_X
1620 ELM_WIN_DATA_ALIVE_CHECK(obj, sd); 1620 ELM_WIN_DATA_ALIVE_CHECK(obj, sd);
@@ -3495,7 +3495,7 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize)
3495 } 3495 }
3496 3496
3497 sd->tmp_updating_hints = 1; 3497 sd->tmp_updating_hints = 1;
3498 efl_gfx_size_hint_restricted_min_set(obj, minw, minh); 3498 efl_gfx_size_hint_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
3499 efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(maxw, maxh)); 3499 efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(maxw, maxh));
3500 sd->tmp_updating_hints = 0; 3500 sd->tmp_updating_hints = 0;
3501 _elm_win_size_hints_update(obj, sd); 3501 _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
6079 sd->rot = rotation; 6079 sd->rot = rotation;
6080 if (resize) TRAP(sd, rotation_with_resize_set, rotation); 6080 if (resize) TRAP(sd, rotation_with_resize_set, rotation);
6081 else TRAP(sd, rotation_set, rotation); 6081 else TRAP(sd, rotation_set, rotation);
6082 efl_gfx_size_hint_restricted_min_set(obj, -1, -1); 6082 efl_gfx_size_hint_restricted_min_set(obj, EINA_SIZE2D(-1, -1));
6083 efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(-1, -1)); 6083 efl_gfx_size_hint_max_set(obj, EINA_SIZE2D(-1, -1));
6084 _elm_win_resize_objects_eval(obj, EINA_FALSE); 6084 _elm_win_resize_objects_eval(obj, EINA_FALSE);
6085#ifdef HAVE_ELEMENTARY_X 6085#ifdef HAVE_ELEMENTARY_X
@@ -8080,7 +8080,7 @@ _window_layout_stack(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
8080 } 8080 }
8081 8081
8082 if (minw < menuw) minw = menuw; 8082 if (minw < menuw) minw = menuw;
8083 efl_gfx_size_hint_restricted_min_set(o, minw, minh); 8083 efl_gfx_size_hint_restricted_min_set(o, EINA_SIZE2D(minw, minh));
8084 evas_object_geometry_get(o, &x, &y, &w, &h); 8084 evas_object_geometry_get(o, &x, &y, &w, &h);
8085 if (w < minw) w = minw; 8085 if (w < minw) w = minw;
8086 if (h < minh) h = minh; 8086 if (h < minh) h = minh;
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index 86301401f6..be06e10893 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -1397,33 +1397,28 @@ evas_object_size_hint_display_mode_set(Eo *eo_obj, Evas_Display_Mode dispmode)
1397 evas_object_inform_call_changed_size_hints(eo_obj); 1397 evas_object_inform_call_changed_size_hints(eo_obj);
1398} 1398}
1399 1399
1400EOLIAN static void 1400EOLIAN static Eina_Size2D
1401_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) 1401_efl_canvas_object_efl_gfx_size_hint_hint_restricted_min_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
1402{ 1402{
1403 if ((!obj->size_hints) || obj->delete_me) 1403 if ((!obj->size_hints) || obj->delete_me)
1404 { 1404 return EINA_SIZE2D(0, 0);
1405 if (w) *w = 0; 1405
1406 if (h) *h = 0; 1406 return obj->size_hints->min;
1407 return;
1408 }
1409 if (w) *w = obj->size_hints->min.w;
1410 if (h) *h = obj->size_hints->min.h;
1411} 1407}
1412 1408
1413EOLIAN static void 1409EOLIAN static void
1414_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) 1410_efl_canvas_object_efl_gfx_size_hint_hint_restricted_min_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Size2D sz)
1415{ 1411{
1416 if (obj->delete_me) 1412 if (obj->delete_me)
1417 return; 1413 return;
1418 evas_object_async_block(obj); 1414 evas_object_async_block(obj);
1419 if (EINA_UNLIKELY(!obj->size_hints)) 1415 if (EINA_UNLIKELY(!obj->size_hints))
1420 { 1416 {
1421 if (!w && !h) return; 1417 if (!sz.w && !sz.h) return;
1422 _evas_object_size_hint_alloc(eo_obj, obj); 1418 _evas_object_size_hint_alloc(eo_obj, obj);
1423 } 1419 }
1424 if ((obj->size_hints->min.w == w) && (obj->size_hints->min.h == h)) return; 1420 if ((obj->size_hints->min.w == sz.w) && (obj->size_hints->min.h == sz.h)) return;
1425 obj->size_hints->min.w = w; 1421 obj->size_hints->min = sz;
1426 obj->size_hints->min.h = h;
1427 1422
1428 evas_object_inform_call_changed_size_hints(eo_obj); 1423 evas_object_inform_call_changed_size_hints(eo_obj);
1429} 1424}
@@ -2043,9 +2038,8 @@ _efl_canvas_object_efl_object_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Dat
2043 unsigned int m; 2038 unsigned int m;
2044 int r, g, b, a; 2039 int r, g, b, a;
2045 //int requestw, requesth; 2040 //int requestw, requesth;
2046 int minw, minh;
2047 Eina_Rect geom; 2041 Eina_Rect geom;
2048 Eina_Size2D max; 2042 Eina_Size2D max, min;
2049 short layer; 2043 short layer;
2050 Eina_Bool focus; 2044 Eina_Bool focus;
2051 Eina_Bool visible; 2045 Eina_Bool visible;
@@ -2059,7 +2053,7 @@ _efl_canvas_object_efl_object_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Dat
2059 name = efl_name_get(eo_obj); // evas_object_name_get(eo_obj); 2053 name = efl_name_get(eo_obj); // evas_object_name_get(eo_obj);
2060 geom = efl_gfx_geometry_get(eo_obj); 2054 geom = efl_gfx_geometry_get(eo_obj);
2061 scale = efl_canvas_object_scale_get(eo_obj); 2055 scale = efl_canvas_object_scale_get(eo_obj);
2062 efl_gfx_size_hint_restricted_min_get(eo_obj, &minw, &minh); 2056 min = efl_gfx_size_hint_restricted_min_get(eo_obj);
2063 max = efl_gfx_size_hint_max_get(eo_obj); 2057 max = efl_gfx_size_hint_max_get(eo_obj);
2064 //efl_gfx_size_hint_request_get(eo_obj, &requestw, &requesth); 2058 //efl_gfx_size_hint_request_get(eo_obj, &requestw, &requesth);
2065 efl_gfx_size_hint_align_get(eo_obj, &dblx, &dbly); 2059 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
2090 EFL_DBG_INFO_APPEND(group, "Scale", EINA_VALUE_TYPE_DOUBLE, scale); 2084 EFL_DBG_INFO_APPEND(group, "Scale", EINA_VALUE_TYPE_DOUBLE, scale);
2091 2085
2092 node = EFL_DBG_INFO_LIST_APPEND(group, "Min size"); 2086 node = EFL_DBG_INFO_LIST_APPEND(group, "Min size");
2093 EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, minw); 2087 EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, min.w);
2094 EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, minh); 2088 EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, min.h);
2095 2089
2096 node = EFL_DBG_INFO_LIST_APPEND(group, "Max size"); 2090 node = EFL_DBG_INFO_LIST_APPEND(group, "Max size");
2097 EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, max.w); 2091 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
2577EAPI void 2571EAPI void
2578evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) 2572evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
2579{ 2573{
2580 efl_gfx_size_hint_restricted_min_set(obj, w, h); 2574 efl_gfx_size_hint_restricted_min_set(obj, EINA_SIZE2D(w, h));
2581} 2575}
2582 2576
2583EAPI void 2577EAPI void
2584evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) 2578evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
2585{ 2579{
2586 efl_gfx_size_hint_restricted_min_get(obj, w, h); 2580 Eina_Size2D sz;
2581 sz = efl_gfx_size_hint_restricted_min_get(obj);
2582 if (w) *w = sz.w;
2583 if (h) *h = sz.h;
2587} 2584}
2588 2585
2589EAPI void 2586EAPI void
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index e998e1c5e7..f071e24bb3 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1019,8 +1019,8 @@ struct _Evas_Double_Pair
1019 1019
1020struct _Evas_Size_Hints 1020struct _Evas_Size_Hints
1021{ 1021{
1022 Evas_Size min, request; 1022 Evas_Size request;
1023 Eina_Size2D user_min, max; 1023 Eina_Size2D min, user_min, max;
1024 Evas_Aspect aspect; 1024 Evas_Aspect aspect;
1025 Evas_Double_Pair align, weight; 1025 Evas_Double_Pair align, weight;
1026 Evas_Border padding; 1026 Evas_Border padding;