From ecad539b66fb0d6b32673c3fe4e46f288064083a Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 30 Jul 2019 13:12:00 -0400 Subject: [PATCH] elm_layout: move elm_layout_sizing_restricted_eval to layout mixin Summary: this function should never need to be called on new widgets Depends on D9440 Reviewers: bu5hm4n Reviewed By: bu5hm4n Subscribers: bu5hm4n, cedric, #reviewers, #committers Tags: #efl_widgets Maniphest Tasks: T8059 Differential Revision: https://phab.enlightenment.org/D9441 --- src/lib/elementary/efl_ui_layout.c | 21 ++++++++++++--------- src/lib/elementary/elm_widget_layout.h | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 7c3d6b0..b9dccc8 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -203,10 +203,13 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld) if (minh > rest_h) rest_h = minh; - if (sd->restricted_calc_w) - rest_w = wd->w; - if (sd->restricted_calc_h) - rest_h = wd->h; + if (ld) + { + if (ld->restricted_calc_w) + rest_w = MIN(wd->w, rest_w); + if (ld->restricted_calc_h) + rest_h = MIN(wd->h, rest_w); + } edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, rest_w, rest_h); @@ -222,9 +225,9 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld) if (ld) { + ld->restricted_calc_w = ld->restricted_calc_h = EINA_FALSE; efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(minw, minh)); } - sd->restricted_calc_w = sd->restricted_calc_h = EINA_FALSE; } void @@ -1994,11 +1997,11 @@ _elm_layout_sizing_eval(Eo *obj, Elm_Layout_Data *ld) EAPI void elm_layout_sizing_restricted_eval(Eo *obj, Eina_Bool w, Eina_Bool h) { - Efl_Ui_Layout_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); + Elm_Layout_Data *ld = efl_data_scope_safe_get(obj, ELM_LAYOUT_MIXIN); - if (!sd) return; - sd->restricted_calc_w = !!w; - sd->restricted_calc_h = !!h; + EINA_SAFETY_ON_NULL_RETURN(ld); + ld->restricted_calc_w = !!w; + ld->restricted_calc_h = !!h; efl_canvas_group_change(obj); } diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h index 462f660..2e74d99 100644 --- a/src/lib/elementary/elm_widget_layout.h +++ b/src/lib/elementary/elm_widget_layout.h @@ -67,8 +67,6 @@ typedef struct _Efl_Ui_Layout_Data unsigned int finger_size_multiplier_x, finger_size_multiplier_y; /**< multipliers for finger_size during group_calc */ - Eina_Bool restricted_calc_w : 1; /**< This is a flag to support edje restricted_calc in w axis. */ - Eina_Bool restricted_calc_h : 1; /**< This is a flag to support edje restricted_calc in y axis. */ Eina_Bool can_access : 1; /**< This is true when all text(including textblock) parts can be accessible by accessibility. */ Eina_Bool destructed_is : 1; /**< This flag indicates if Efl.Ui.Layout destructor was called. This is needed to avoid unnecessary calculation of subobject deletion during layout object's deletion. */ Eina_Bool file_set : 1; /**< This flag indicates if Efl.Ui.Layout source is set from a file*/ @@ -81,6 +79,8 @@ typedef struct _Efl_Ui_Layout_Data typedef struct _Elm_Layout_Data { 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. */ + Eina_Bool restricted_calc_w : 1; /**< This is a flag to support edje restricted_calc in w axis. */ + Eina_Bool restricted_calc_h : 1; /**< This is a flag to support edje restricted_calc in y axis. */ } Elm_Layout_Data; /** -- 2.7.4