From 62f712950bd98c22186cd24c111a9e189e2be6c3 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 30 Jul 2019 13:11:30 -0400 Subject: [PATCH] efl_ui/layout: implement group_calc, add finger size for inherited layouts Summary: this adds a group_calc implementation for the layout object (not layout_base) to allow differentiation between inherited layout calcs and layout object calcs by using this, we can automatically apply finger size to inherited layout calcs if the implementation ever reaches this point Depends on D9435 Reviewers: bu5hm4n Reviewed By: bu5hm4n Subscribers: bu5hm4n, cedric, #reviewers, #committers Tags: #efl_widgets Maniphest Tasks: T8059 Differential Revision: https://phab.enlightenment.org/D9436 --- src/lib/elementary/efl_ui_layout.c | 22 ++++++++++++++++------ src/lib/elementary/efl_ui_layout.eo | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 883234b..be5a57f 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -172,7 +172,7 @@ _part_cursor_free(Efl_Ui_Layout_Sub_Object_Cursor *pc) } static void -_sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd) +_sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Eina_Bool finger) { int minh = 0, minw = 0; int rest_w = 0, rest_h = 0; @@ -181,6 +181,8 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd) if (!efl_alive_get(obj)) return; + if (finger) + elm_coords_finger_size_adjust(1, &rest_w, 1, &rest_h); if (elm_widget_is_legacy(obj)) sz = efl_gfx_hint_size_combined_min_get(obj); else @@ -1012,16 +1014,24 @@ _efl_ui_layout_base_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Data *sd) efl_canvas_group_del(efl_super(obj, MY_CLASS)); } +EOLIAN static void +_efl_ui_layout_efl_canvas_group_group_calculate(Eo *obj, void *_pd EINA_UNUSED) +{ + efl_canvas_group_need_recalculate_set(obj, EINA_FALSE); + _sizing_eval(obj, efl_data_scope_get(obj, MY_CLASS), NULL); +} + /* rewrite or extend this one on your derived class as to suit your * needs */ EOLIAN static void _efl_ui_layout_base_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Layout_Data *sd) { - if (sd->needs_size_calc) - { - _sizing_eval(obj, sd); - sd->needs_size_calc = EINA_FALSE; - } + Eina_Bool legacy = elm_widget_is_legacy(obj); + efl_canvas_group_need_recalculate_set(obj, EINA_FALSE); + if ((!legacy) || sd->needs_size_calc) + /* don't add finger size if this is an actual elm_layout object */ + _sizing_eval(obj, sd, !legacy); + sd->needs_size_calc = EINA_FALSE; } static Efl_Ui_Layout_Sub_Object_Cursor * diff --git a/src/lib/elementary/efl_ui_layout.eo b/src/lib/elementary/efl_ui_layout.eo index bdc81db..1f04fc0 100644 --- a/src/lib/elementary/efl_ui_layout.eo +++ b/src/lib/elementary/efl_ui_layout.eo @@ -16,5 +16,6 @@ class Efl.Ui.Layout extends Efl.Ui.Layout_Base implements Efl.File Efl.File.key { get; set; } Efl.File.mmap { get; set; } Efl.File.load; + Efl.Canvas.Group.group_calculate; } } -- 2.7.4