summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-10-14 09:30:23 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-14 09:30:23 -0400
commit95b5731461c53df2691ef43db61f321de5b366d3 (patch)
treeecc91cc191778c0f81b34a2623cc69db3a25b583 /src/lib/elementary
parentdc5c17a104c9be1939881852ee76668d7bf693ac (diff)
elm/layout: add some workarounds to try handling legacy min sizes
Summary: if a legacy widget calls evas_object_size_hint_min_set, this actually sets efl_gfx_hint_size_restricted_min now, which is supposed to be the hint that is used internally by widgets. as a result, there is a conflict between the size which the user expects and the size which the widget tries to calculate. the user size should always be respected, however, so this adds some tracking to determine whether the layout's min size was set by the layout during its own calc or by something externally @fix Reviewers: eagleeye, CHAN, woohyun, Jaehyun_Cho, cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10373
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_layout.c18
-rw-r--r--src/lib/elementary/efl_ui_layout_legacy_eo.c1
-rw-r--r--src/lib/elementary/elm_widget_layout.h2
3 files changed, 19 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index 25a09a1..28e99a1 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -175,6 +175,7 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld)
175 ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd); 175 ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
176 176
177 if (!efl_alive_get(obj)) return; 177 if (!efl_alive_get(obj)) return;
178 if (ld) ld->in_calc = EINA_TRUE;
178 179
179 if (sd->calc_subobjs && !evas_smart_objects_calculating_get(evas_object_evas_get(obj))) 180 if (sd->calc_subobjs && !evas_smart_objects_calculating_get(evas_object_evas_get(obj)))
180 { 181 {
@@ -186,7 +187,7 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld)
186 } 187 }
187 elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, &rest_w, 188 elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, &rest_w,
188 sd->finger_size_multiplier_y, &rest_h); 189 sd->finger_size_multiplier_y, &rest_h);
189 if (ld) 190 if (ld && ld->user_min_sz)
190 sz = efl_gfx_hint_size_combined_min_get(obj); 191 sz = efl_gfx_hint_size_combined_min_get(obj);
191 else 192 else
192 sz = efl_gfx_hint_size_min_get(obj); 193 sz = efl_gfx_hint_size_min_get(obj);
@@ -218,7 +219,7 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld)
218 efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); 219 efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
219 220
220 if (ld) 221 if (ld)
221 ld->restricted_calc_w = ld->restricted_calc_h = EINA_FALSE; 222 ld->in_calc = ld->restricted_calc_w = ld->restricted_calc_h = EINA_FALSE;
222} 223}
223 224
224void 225void
@@ -1918,6 +1919,19 @@ _elm_layout_efl_canvas_group_change(Eo *obj, Elm_Layout_Data *ld)
1918 efl_canvas_group_change(efl_super(obj, ELM_LAYOUT_MIXIN)); 1919 efl_canvas_group_change(efl_super(obj, ELM_LAYOUT_MIXIN));
1919} 1920}
1920 1921
1922EOLIAN static void
1923_elm_layout_efl_gfx_hint_size_restricted_min_set(Eo *obj, Elm_Layout_Data *ld, Eina_Size2D sz)
1924{
1925 /* correctly handle legacy case where the user has set a min size hint on the object:
1926 * in legacy code, only restricted_min existed, which resulted in conflicts between
1927 * internal sizing and user-expected sizing. we attempt to simulate this now in a more controlled
1928 * manner by only checking this hint during sizing calcs if the user has set it
1929 */
1930 if (!ld->in_calc)
1931 ld->user_min_sz = (sz.w > 0) || (sz.h > 0);
1932 efl_gfx_hint_size_restricted_min_set(efl_super(obj, ELM_LAYOUT_MIXIN), sz);
1933}
1934
1921/* layout's sizing evaluation is deferred. evaluation requests are 1935/* layout's sizing evaluation is deferred. evaluation requests are
1922 * queued up and only flag the object as 'changed'. when it comes to 1936 * queued up and only flag the object as 'changed'. when it comes to
1923 * Evas's rendering phase, it will be addressed, finally (see 1937 * Evas's rendering phase, it will be addressed, finally (see
diff --git a/src/lib/elementary/efl_ui_layout_legacy_eo.c b/src/lib/elementary/efl_ui_layout_legacy_eo.c
index 33056b5..e08568e 100644
--- a/src/lib/elementary/efl_ui_layout_legacy_eo.c
+++ b/src/lib/elementary/efl_ui_layout_legacy_eo.c
@@ -50,6 +50,7 @@ _elm_layout_class_initializer(Efl_Class *klass)
50 EFL_OPS_DEFINE(ops, 50 EFL_OPS_DEFINE(ops,
51 EFL_OBJECT_OP_FUNC(elm_layout_sizing_eval, _elm_layout_sizing_eval), 51 EFL_OBJECT_OP_FUNC(elm_layout_sizing_eval, _elm_layout_sizing_eval),
52 EFL_OBJECT_OP_FUNC(efl_canvas_group_change, _elm_layout_efl_canvas_group_change), 52 EFL_OBJECT_OP_FUNC(efl_canvas_group_change, _elm_layout_efl_canvas_group_change),
53 EFL_OBJECT_OP_FUNC(efl_gfx_hint_size_restricted_min_set, _elm_layout_efl_gfx_hint_size_restricted_min_set),
53 ELM_LAYOUT_EXTRA_OPS 54 ELM_LAYOUT_EXTRA_OPS
54 ); 55 );
55 opsp = &ops; 56 opsp = &ops;
diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h
index 19e3b44..839bb06 100644
--- a/src/lib/elementary/elm_widget_layout.h
+++ b/src/lib/elementary/elm_widget_layout.h
@@ -82,6 +82,8 @@ typedef struct _Elm_Layout_Data
82 Eina_Bool needs_size_calc : 1; /**< This flag is set true when the layout sizing eval is already requested. This defers sizing evaluation until smart calculation to avoid unnecessary calculation. */ 82 Eina_Bool needs_size_calc : 1; /**< This flag is set true when the layout sizing eval is already requested. This defers sizing evaluation until smart calculation to avoid unnecessary calculation. */
83 Eina_Bool restricted_calc_w : 1; /**< This is a flag to support edje restricted_calc in w axis. */ 83 Eina_Bool restricted_calc_w : 1; /**< This is a flag to support edje restricted_calc in w axis. */
84 Eina_Bool restricted_calc_h : 1; /**< This is a flag to support edje restricted_calc in y axis. */ 84 Eina_Bool restricted_calc_h : 1; /**< This is a flag to support edje restricted_calc in y axis. */
85 Eina_Bool in_calc : 1; /**< object is currently in group_calc */
86 Eina_Bool user_min_sz : 1; /**< min size was set by user (legacy only has restricted min) */
85} Elm_Layout_Data; 87} Elm_Layout_Data;
86 88
87/** 89/**