From 85cf0ce88369c3d0e4fffb66b5c0fdbb94688052 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Wed, 14 Aug 2019 12:39:36 +0900 Subject: [PATCH 01/24] evas_map: draw what map did not draw before. Summary: When a map property is changed, map draws it. Before drawing, evas_object_map_update updates map->spans which is data for actual drawing. But if changed_map is false, then evas_object_map_update does not update map->spans. Usually mapped object has following step. (1) change map data (evas_map_point_coord_set) (2) render_pre (3) evas_object_map_update updates map->spans if changed_map is true. (4) render (5) render_post -> evas_object_cur_prev -> "map->prev = map->cur" But if mapped object hides at step(1), then step(3),(4) does not happen. But step(4) map->prev keeps changed map data. After this point, If same map data comes, then map does not draw it. Because the new data is same with map->prev. The issue occurs with following step. (A) point_coord_set with point A. (B) (2)(3)(4)(5) works. (C) point_coord_set with point B. And hide. (D) (2)(5) wokrs. (E) point_coord_set with point A. still hide, so none of (2)(3)(4)(5) work. (F) point_coord_set with point B. And show. (G) (2)(3)(4)(5) works. BUT step(3) does not update map->spans because changed_map is false. So you can see image of point A. The changed_map is changed to false after updating map->spans at step(3). So usually changed_map is false before deciding changed_map of next render. In case of not rendering (but render_pre/post) after map data is changed, the changed_map keeps true. So this patch was suppose to make changed_map false if changed_map is already ture before _evas_map_calc_map_geometry decides changed_map which occurs step(1). true changed_map indicates that you need to draw even though new map data is same with previous map data. Test Plan: {F3739770} Reviewers: Hermet, jsuya Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9476 --- src/lib/evas/canvas/evas_map.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c index 19a85d9995..0ac75c7a07 100644 --- a/src/lib/evas/canvas/evas_map.c +++ b/src/lib/evas/canvas/evas_map.c @@ -90,7 +90,12 @@ _evas_map_calc_map_geometry(Evas_Object *eo_obj) obj->map->cur.map->normal_geometry.y = yy1; obj->map->cur.map->normal_geometry.w = (x2 - x1); obj->map->cur.map->normal_geometry.h = (yy2 - yy1); - obj->changed_map = ch; + + /* if change_map is true, it means that the prev map data + did not render before. even though both prev and cur + has same map points we need to draw it */ + obj->changed_map |= ch; + // This shouldn't really be needed, but without it we do have case // where the clip is wrong when a map doesn't change, so always forcing // it, as long as someone doesn't find a better fix. From c857955a4ece647b2039719bd750b080394b6eb5 Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Wed, 14 Aug 2019 17:48:32 +0900 Subject: [PATCH 02/24] efl_ui_layout: remove efl_gfx_hint_size_min_set in _sizing_eval Summary: `evas_object_size_hint_min_set` is replaced with `efl_gfx_hint_size_min_set` in 4d79efce6. it is able to have backward compatibility issue because `evas_object_size_hint_min_set` call `efl_gfx_hint_size_restricted_min_set` internally. ``` evas_object_main.c:2501 EAPI void evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) { efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(w, h)); } ``` This patch remove unnecessary min_set call. Test Plan: elementary_test Reviewers: zmike, Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9566 --- src/lib/elementary/efl_ui_layout.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index d1659aa19b..8dd0879dbc 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -210,10 +210,7 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld) efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); if (ld) - { - ld->restricted_calc_w = ld->restricted_calc_h = EINA_FALSE; - efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(minw, minh)); - } + ld->restricted_calc_w = ld->restricted_calc_h = EINA_FALSE; } void From 51a644d96650d08f8ffa8e633277d60e9536f08f Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Wed, 14 Aug 2019 09:56:42 -0400 Subject: [PATCH 03/24] efl_ui: remove duplicated hint_min_set code Summary: evas_object_size_hint_min_set call efl_gfx_hint_size_restricted_min_set internally. Reviewers: zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9567 --- src/lib/elementary/efl_ui_flip.c | 5 +---- src/lib/elementary/efl_ui_frame.c | 5 +---- src/lib/elementary/efl_ui_image.c | 5 +---- src/lib/elementary/efl_ui_image_zoomable.c | 10 ++-------- 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/lib/elementary/efl_ui_flip.c b/src/lib/elementary/efl_ui_flip.c index d6e9152146..e24583796d 100644 --- a/src/lib/elementary/efl_ui_flip.c +++ b/src/lib/elementary/efl_ui_flip.c @@ -93,10 +93,7 @@ _sizing_eval(Evas_Object *obj) elm_coords_finger_size_adjust(fingx, &minw, fingy, &minh); - if (elm_widget_is_legacy(obj)) - evas_object_size_hint_min_set(obj, minw, minh); - else - efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); + efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); evas_object_size_hint_max_set(obj, maxw, maxh); } diff --git a/src/lib/elementary/efl_ui_frame.c b/src/lib/elementary/efl_ui_frame.c index 1f167fb495..5680fdf901 100644 --- a/src/lib/elementary/efl_ui_frame.c +++ b/src/lib/elementary/efl_ui_frame.c @@ -38,10 +38,7 @@ _sizing_eval(Evas_Object *obj, evas_object_size_hint_min_get(obj, &cminw, &cminh); if ((minw == cminw) && (minh == cminh)) return; - if (elm_widget_is_legacy(obj)) - evas_object_size_hint_min_set(obj, minw, minh); - else - efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); + efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); evas_object_size_hint_max_set(obj, -1, -1); } diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 68403700be..c07f2b2ca4 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -802,10 +802,7 @@ _efl_ui_image_sizing_eval(Evas_Object *obj) } } - if (elm_widget_is_legacy(obj)) - evas_object_size_hint_min_set(obj, minw, minh); - else - efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); + efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); evas_object_size_hint_max_set(obj, maxw, maxh); if (sd->img) diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 4b76f6bde4..64eda7a52d 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -116,10 +116,7 @@ _sizing_eval(Evas_Object *obj) evas_object_size_hint_max_get (wd->resize_obj, &maxw, &maxh); - if (elm_widget_is_legacy(obj)) - evas_object_size_hint_min_set(obj, minw, minh); - else - efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); + efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); evas_object_size_hint_max_set(obj, maxw, maxh); } @@ -1864,10 +1861,7 @@ _efl_ui_image_zoomable_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Zoomable (priv->img, EVAS_CALLBACK_IMAGE_PRELOADED, _main_img_preloaded_cb, obj); edje_object_size_min_calc(edje, &minw, &minh); - if (elm_widget_is_legacy(obj)) - evas_object_size_hint_min_set(obj, minw, minh); - else - efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); + efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); _efl_ui_image_zoomable_edje_object_attach(obj); From e533bef2bf56ca2d61f56b473e72f75240384bdd Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 14 Aug 2019 11:03:04 -0400 Subject: [PATCH 04/24] tests/ecore_wl2: Add start of ecore_wl2_surface tests ref T8016 --- src/tests/ecore_wl2/ecore_wl2_test_surface.c | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/tests/ecore_wl2/ecore_wl2_test_surface.c diff --git a/src/tests/ecore_wl2/ecore_wl2_test_surface.c b/src/tests/ecore_wl2/ecore_wl2_test_surface.c new file mode 100644 index 0000000000..f4252e1664 --- /dev/null +++ b/src/tests/ecore_wl2/ecore_wl2_test_surface.c @@ -0,0 +1,56 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "ecore_wl2_suite.h" + +static Ecore_Wl2_Display * +_display_connect(void) +{ + Ecore_Wl2_Display *disp; + + disp = ecore_wl2_display_connect(NULL); + return disp; +} + +static Ecore_Wl2_Window * +_window_create(Ecore_Wl2_Display *disp) +{ + Ecore_Wl2_Window *win; + + win = ecore_wl2_window_new(disp, NULL, 100, 100, 500, 500); + return win; +} + +EFL_START_TEST(wl2_surface_create) +{ + Ecore_Wl2_Display *disp; + Ecore_Wl2_Window *win; + Ecore_Wl2_Surface *surf; + + disp = _display_connect(); + ck_assert(disp != NULL); + + win = _window_create(disp); + ck_assert(win != NULL); + + surf = ecore_wl2_surface_create(win, EINA_FALSE); + ck_assert(surf != NULL); +} +EFL_END_TEST + +void +ecore_wl2_test_surface(TCase *tc) +{ + if (getenv("WAYLAND_DISPLAY")) + { + /* surface tests can only run if there is an existing compositor */ + tcase_add_test(tc, wl2_surface_create); + } +} From 0ca5cd82a95566a408a2221eb63f996c47aeb043 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 14 Aug 2019 19:24:19 +0200 Subject: [PATCH 05/24] efl: mark a couple internal eo files as @beta Summary: these are not distributed apis so they should always remain beta Reviewers: q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9559 --- src/lib/edje/edje_global.eo | 2 +- src/tests/elementary/focus_test_sub_main.eo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/edje_global.eo b/src/lib/edje/edje_global.eo index bff48e2ca1..1ad43a3ef6 100644 --- a/src/lib/edje/edje_global.eo +++ b/src/lib/edje/edje_global.eo @@ -1,4 +1,4 @@ -class Edje.Global extends Efl.Object implements Efl.Gfx.Color_Class, Efl.Gfx.Text_Class, Efl.Gfx.Size_Class +class @beta Edje.Global extends Efl.Object implements Efl.Gfx.Color_Class, Efl.Gfx.Text_Class, Efl.Gfx.Size_Class { [[An internal object that manages global color, text and size classes for the whole application. Individual edje objects also support the same diff --git a/src/tests/elementary/focus_test_sub_main.eo b/src/tests/elementary/focus_test_sub_main.eo index 9ac058f32f..280162301c 100644 --- a/src/tests/elementary/focus_test_sub_main.eo +++ b/src/tests/elementary/focus_test_sub_main.eo @@ -1,4 +1,4 @@ -class Focus.Test.Sub.Main +class @beta Focus.Test.Sub.Main extends Efl.Object implements Efl.Ui.Focus.Object, Efl.Ui.Focus.Manager_Sub, Efl.Gfx.Entity { From 304f4ce9bb7a271440eec278ff40b2c547147a10 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 14 Aug 2019 19:25:09 +0200 Subject: [PATCH 06/24] efl: remove Efl.Ui.I18n from canvas object inheritance Summary: canvas objects do not need localization because they are not directly user-facing this should only be inherited by objects which need to be localized Depends on D9559 Reviewers: q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9560 --- src/lib/edje/efl_canvas_layout.eo | 2 +- src/lib/elementary/efl_ui_widget.eo | 2 +- src/lib/evas/canvas/efl_canvas_object.eo | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index 0653bb41ac..d4ce1b3ca2 100644 --- a/src/lib/edje/efl_canvas_layout.eo +++ b/src/lib/edje/efl_canvas_layout.eo @@ -1,7 +1,7 @@ // FIXME: This EO doc needs a direct link to the "edcref" doc class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl.Container, Efl.Part, - Efl.Observer, Efl.Layout.Calc, + Efl.Observer, Efl.Ui.I18n, Efl.Layout.Calc, Efl.Layout.Signal, Efl.Layout.Group, Efl.Player, Efl.Gfx.Color_Class, Efl.Gfx.Text_Class, Efl.Gfx.Size_Class diff --git a/src/lib/elementary/efl_ui_widget.eo b/src/lib/elementary/efl_ui_widget.eo index ea5435848c..0517e3ae28 100644 --- a/src/lib/elementary/efl_ui_widget.eo +++ b/src/lib/elementary/efl_ui_widget.eo @@ -17,7 +17,7 @@ struct Efl.Ui.Widget_Focus_State { abstract Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Object, Efl.Access.Component, Efl.Part, Efl.Ui.Focus.Object, - Efl.Ui.L10n, + Efl.Ui.I18n, Efl.Ui.L10n, Efl.Ui.Selection, Efl.Ui.Dnd, Efl.Ui.Property_Bind, Efl.Ui.View { diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo index 60624588ce..ff4703e25a 100644 --- a/src/lib/evas/canvas/efl_canvas_object.eo +++ b/src/lib/evas/canvas/efl_canvas_object.eo @@ -8,7 +8,7 @@ struct Efl.Event_Animator_Tick { abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity, Efl.Gfx.Color, Efl.Gfx.Stack, Efl.Input.Interface, Efl.Gfx.Hint, - Efl.Gfx.Mapping, Efl.Ui.I18n, Efl.Canvas.Pointer, Efl.Gesture.Events + Efl.Gfx.Mapping, Efl.Canvas.Pointer, Efl.Gesture.Events { [[Efl canvas object abstract class From c48903f7df2789371510536bc09e3a2f966f2249 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 14 Aug 2019 19:25:27 +0200 Subject: [PATCH 07/24] efl_ui: mark localization methods with @empty for containers Summary: these classes cannot be localized Depends on D9560 Reviewers: q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9561 --- src/lib/elementary/efl_ui_box.eo | 2 ++ src/lib/elementary/efl_ui_table.eo | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/lib/elementary/efl_ui_box.eo b/src/lib/elementary/efl_ui_box.eo index 008fb6d46c..d55f67f3cc 100644 --- a/src/lib/elementary/efl_ui_box.eo +++ b/src/lib/elementary/efl_ui_box.eo @@ -60,5 +60,7 @@ class Efl.Ui.Box extends Efl.Ui.Widget implements Efl.Pack_Linear, Efl.Pack_Layo Efl.Pack_Linear.pack_index_get; Efl.Pack_Layout.layout_update; Efl.Pack_Layout.layout_request; + @empty Efl.Ui.L10n.l10n_text { get; set; } + @empty Efl.Ui.I18n.language { get; set; } } } diff --git a/src/lib/elementary/efl_ui_table.eo b/src/lib/elementary/efl_ui_table.eo index 6d66968250..c0648dc1a9 100644 --- a/src/lib/elementary/efl_ui_table.eo +++ b/src/lib/elementary/efl_ui_table.eo @@ -53,5 +53,7 @@ class Efl.Ui.Table extends Efl.Ui.Widget implements Efl.Pack_Table, Efl.Pack_Lay Efl.Pack_Table.table_rows { get; set; } Efl.Pack_Layout.layout_update; Efl.Pack_Layout.layout_request; + @empty Efl.Ui.L10n.l10n_text { get; set; } + @empty Efl.Ui.I18n.language { get; set; } } } From 07e810c5cc9ca622eb8f0dfc43c47846e7f09e42 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 14 Aug 2019 19:25:53 +0200 Subject: [PATCH 08/24] efl_ui/layout: implement unimplemented methods Summary: add redirects to internal layout objects for these methods Depends on D9561 Reviewers: q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9562 --- src/lib/elementary/efl_ui_layout.c | 28 ++++++++++++++++++++++++ src/lib/elementary/efl_ui_layout_base.eo | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 8dd0879dbc..600ebdb41d 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -2515,6 +2515,34 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui _efl_ui_layout_view_model_content_update(pd, tracking, ss_key); } +EOLIAN void +_efl_ui_layout_base_efl_ui_i18n_language_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *locale) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + efl_ui_language_set(wd->resize_obj, locale); +} + +EOLIAN const char * +_efl_ui_layout_base_efl_ui_i18n_language_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); + return efl_ui_language_get(wd->resize_obj); +} + +EOLIAN static void +_efl_ui_layout_base_efl_ui_l10n_l10n_text_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *label, const char *domain) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + efl_ui_l10n_text_set(efl_part(obj, efl_ui_widget_default_text_part_get(obj)), label, domain); +} + +EOLIAN static const char * +_efl_ui_layout_base_efl_ui_l10n_l10n_text_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char **domain) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); + return efl_ui_l10n_text_get(efl_part(obj, efl_ui_widget_default_text_part_get(obj)), domain); +} + EOLIAN static Eo * _efl_ui_layout_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) { diff --git a/src/lib/elementary/efl_ui_layout_base.eo b/src/lib/elementary/efl_ui_layout_base.eo index b66095f87b..4f4624744a 100644 --- a/src/lib/elementary/efl_ui_layout_base.eo +++ b/src/lib/elementary/efl_ui_layout_base.eo @@ -107,6 +107,8 @@ abstract Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container, Efl.Part.part_get; Efl.Ui.Property_Bind.property_bind; Efl.Ui.Factory_Bind.factory_bind; + Efl.Ui.L10n.l10n_text { get; set; } + Efl.Ui.I18n.language { get; set; } } events { theme,changed: void; [[Called when theme changed]] From d99186c039f6f27157b1595d0b7d62438c84de34 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 14 Aug 2019 19:26:14 +0200 Subject: [PATCH 09/24] efl_ui/win: implement unimplemented methods Summary: pass through methods from inherited classes to the correct internal object Depends on D9562 Reviewers: q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9572 --- src/lib/elementary/efl_ui_win.c | 42 +++++++++++++++++++++++++++++++- src/lib/elementary/efl_ui_win.eo | 4 +++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 22ed4f1962..32f0ded966 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -2694,6 +2694,12 @@ _efl_ui_win_efl_canvas_scene_group_objects_calculate(Eo *obj EINA_UNUSED, Efl_Ui evas_smart_objects_calculate(sd->evas); } +EOLIAN static Eina_Bool +_efl_ui_win_efl_canvas_scene_group_objects_calculating_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) +{ + return efl_canvas_scene_group_objects_calculating_get(sd->evas); +} + EOLIAN static Eina_Iterator * _efl_ui_win_efl_canvas_scene_objects_at_xy_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_Position2D pos, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects) { @@ -5976,6 +5982,33 @@ _efl_ui_win_efl_text_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) return sd->title; } +EOLIAN void +_efl_ui_win_efl_ui_i18n_language_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *locale) +{ + if (sd->frame_obj) + efl_ui_language_set(sd->frame_obj, locale); +} + +EOLIAN const char * +_efl_ui_win_efl_ui_i18n_language_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) +{ + return sd->frame_obj ? efl_ui_language_get(sd->frame_obj) : NULL; +} + +EOLIAN static void +_efl_ui_win_efl_ui_l10n_l10n_text_set(Eo *obj, Efl_Ui_Win_Data *sd, const char *label, const char *domain) +{ + if (sd->frame_obj) + efl_ui_l10n_text_set(efl_part(obj, "efl.text.title"), label, domain); +} + +EOLIAN static const char * +_efl_ui_win_efl_ui_l10n_l10n_text_get(const Eo *obj, Efl_Ui_Win_Data *sd, const char **domain) +{ + return sd->frame_obj ? + efl_ui_l10n_text_get(efl_part(obj, "efl.text.title"), domain) : NULL; +} + EOLIAN static void _efl_ui_win_win_type_set(Eo *obj, Efl_Ui_Win_Data *sd, Efl_Ui_Win_Type type) { @@ -6966,10 +6999,17 @@ _efl_ui_win_efl_screen_screen_rotation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win { //TODO: query to wm about device's rotation (void)sd; - + WRN("Not yet implemented"); return 0; } +EOLIAN static float +_efl_ui_win_efl_screen_screen_scale_factor_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd EINA_UNUSED) +{ + WRN("Not yet implemented"); + return 1.0; +} + EOLIAN static void _efl_ui_win_prop_focus_skip_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_Bool skip) { diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo index f6f499cbce..0148f4e214 100644 --- a/src/lib/elementary/efl_ui_win.eo +++ b/src/lib/elementary/efl_ui_win.eo @@ -848,15 +848,19 @@ class Efl.Ui.Win extends Efl.Ui.Widget implements Efl.Canvas.Scene, Efl.Access.W Efl.Screen.screen_dpi { get; } Efl.Screen.screen_rotation { get; } Efl.Screen.screen_size_in_pixels { get; } + Efl.Screen.screen_scale_factor { get; } Efl.Gfx.Hint.hint_aspect { set; } Efl.Gfx.Hint.hint_weight { set; } Efl.Gfx.Hint.hint_size_max { set; } Efl.Text.text { get; set; } + Efl.Ui.L10n.l10n_text { get; set; } + Efl.Ui.I18n.language { get; set; } Efl.Canvas.Scene.seat_default { get; } Efl.Canvas.Scene.pointer_position { get; } Efl.Canvas.Pointer.pointer_inside { get; } Efl.Canvas.Scene.image_max_size { get; } Efl.Canvas.Scene.group_objects_calculate; + Efl.Canvas.Scene.group_objects_calculating { get; } Efl.Canvas.Scene.objects_at_xy_get; Efl.Canvas.Scene.object_top_at_xy_get; Efl.Canvas.Scene.objects_in_rectangle_get; From 0c72d430c3989fc88375ba5664f2e89a8ec4d387 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 9 Aug 2019 12:14:46 -0400 Subject: [PATCH 10/24] efl_ui/popup: remove popup_size property this was more or less just a wrapper around efl_gfx_entity_size_set and resulted in unpredictable behavior depending on when it was called instead, simply set the min size hint on the popup object ref T7902 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9549 --- src/bin/elementary/test_ui_popup.c | 44 +++++++++---------- src/lib/elementary/efl_ui_popup.c | 12 ----- src/lib/elementary/efl_ui_popup.eo | 11 ----- .../elementary/efl_ui_scroll_alert_popup.c | 19 +++----- .../elementary/efl_ui_scroll_alert_popup.eo | 1 - src/lib/elementary/efl_ui_text_alert_popup.c | 19 +++----- src/lib/elementary/efl_ui_text_alert_popup.eo | 1 - .../efl_ui_text_alert_popup_private.h | 1 - src/tests/elementary/efl_ui_test_popup.c | 18 ++++---- 9 files changed, 41 insertions(+), 85 deletions(-) diff --git a/src/bin/elementary/test_ui_popup.c b/src/bin/elementary/test_ui_popup.c index cf809106c1..8ac846cdff 100644 --- a/src/bin/elementary/test_ui_popup.c +++ b/src/bin/elementary/test_ui_popup.c @@ -59,7 +59,7 @@ _create_popup(efl_ui_popup_data *p_data) efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_EVENT_BACKWALL_CLICKED, _backwall_clicked, NULL); efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_EVENT_TIMEOUT, _timeout_cb, p_data); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, efl_ui_popup); efl_text_set(btn, "Efl.Ui.Popup"); @@ -194,9 +194,9 @@ _popup_resize_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) static Eina_Bool size_changed = EINA_FALSE; if (!size_changed) - efl_ui_popup_size_set(p_data->efl_ui_popup, EINA_SIZE2D(300, 160)); + efl_gfx_hint_size_min_set(p_data->efl_ui_popup, EINA_SIZE2D(300, 160)); else - efl_ui_popup_size_set(p_data->efl_ui_popup, EINA_SIZE2D(160, 120)); + efl_gfx_hint_size_min_set(p_data->efl_ui_popup, EINA_SIZE2D(160, 120)); size_changed = !size_changed; } @@ -403,7 +403,7 @@ _alert_scroll_case1_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); } @@ -429,7 +429,7 @@ _alert_scroll_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED) //This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined. efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(320, -1)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); } @@ -455,7 +455,7 @@ _alert_scroll_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED) //This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined. efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 320)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); } @@ -481,7 +481,7 @@ _alert_scroll_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED) //This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined. efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(320, 320)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); } @@ -507,7 +507,7 @@ _alert_scroll_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED) //This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined. efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(80, 80)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); } @@ -584,7 +584,7 @@ _alert_text_case1_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); } @@ -598,7 +598,7 @@ _alert_text_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eina_Strbuf *message_buf = eina_strbuf_new(); create_message(message_buf, "This is Text Popup ", 50); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_text_set(efl_part(efl_ui_popup, "title"), "title"); efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf)); @@ -618,7 +618,7 @@ _alert_text_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eo *win = data; Eo *efl_ui_popup= efl_add(EFL_UI_TEXT_ALERT_POPUP_CLASS, win); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, 300)); efl_text_set(efl_part(efl_ui_popup, "title"), "title"); @@ -637,7 +637,7 @@ _alert_text_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eo *win = data; Eo *efl_ui_popup= efl_add(EFL_UI_TEXT_ALERT_POPUP_CLASS, win); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_text_set(efl_part(efl_ui_popup, "title"), "title"); efl_text_set(efl_ui_popup, "This is Text Popup"); @@ -666,7 +666,7 @@ _alert_text_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); } @@ -688,7 +688,7 @@ _alert_text_case6_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, 300)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -704,7 +704,7 @@ _alert_text_case7_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eina_Strbuf *message_buf = eina_strbuf_new(); create_message(message_buf, "This is Text Popup ", 50); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_text_set(efl_part(efl_ui_popup, "title"), "title"); efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf)); @@ -738,7 +738,7 @@ _alert_text_case8_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -763,7 +763,7 @@ _alert_text_case9_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(10, 10)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -788,7 +788,7 @@ _alert_text_case10_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(150, 150)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -813,7 +813,7 @@ _alert_text_case11_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(150, -1)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -838,7 +838,7 @@ _alert_text_case12_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, -1)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -863,7 +863,7 @@ _alert_text_case13_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 150)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -888,7 +888,7 @@ _alert_text_case14_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); - efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200)); + efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c index 2331b4468b..5cc54e56ca 100644 --- a/src/lib/elementary/efl_ui_popup.c +++ b/src/lib/elementary/efl_ui_popup.c @@ -138,18 +138,6 @@ _efl_ui_popup_align_get(const Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd) return pd->align; } -EOLIAN static void -_efl_ui_popup_popup_size_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eina_Size2D size) -{ - efl_gfx_entity_size_set(obj, size); -} - -EOLIAN static Eina_Size2D -_efl_ui_popup_popup_size_get(const Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED) -{ - return efl_gfx_entity_size_get(obj); -} - static Eina_Bool _timer_cb(void *data) { diff --git a/src/lib/elementary/efl_ui_popup.eo b/src/lib/elementary/efl_ui_popup.eo index 4fc5548e6b..37a0104741 100644 --- a/src/lib/elementary/efl_ui_popup.eo +++ b/src/lib/elementary/efl_ui_popup.eo @@ -36,17 +36,6 @@ class @beta Efl.Ui.Popup extends Efl.Ui.Layout_Base implements Efl.Content, Efl. time: double; [[Timeout in seconds]] } } - @property popup_size { - set { - [[Set the popup size.]] - } - get { - [[get the current popup size.]] - } - values { - size: Eina.Size2D; - } - } } parts { backwall: Efl.Ui.Popup_Part_Backwall; [[A backwall behind the popup.]] diff --git a/src/lib/elementary/efl_ui_scroll_alert_popup.c b/src/lib/elementary/efl_ui_scroll_alert_popup.c index 1bc757422a..37311883fb 100644 --- a/src/lib/elementary/efl_ui_scroll_alert_popup.c +++ b/src/lib/elementary/efl_ui_scroll_alert_popup.c @@ -19,7 +19,7 @@ static void _scroller_sizing_eval(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd, Eina_Size2D obj_min, Eina_Size2D scr_min) { - Eina_Size2D max_size; + Eina_Size2D max_size, min_size; max_size.w = -1; max_size.h = -1; @@ -28,9 +28,11 @@ _scroller_sizing_eval(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd, if (pd->max_size.h != -1) max_size.h = (obj_min.h > pd->max_size.h) ? obj_min.h : pd->max_size.h; + min_size = efl_gfx_hint_size_min_get(obj); + Eina_Size2D size; - size.w = (obj_min.w > pd->size.w) ? obj_min.w : pd->size.w; - size.h = (obj_min.h > pd->size.h) ? obj_min.h : pd->size.h; + size.w = (obj_min.w > min_size.w) ? obj_min.w : min_size.w; + size.h = (obj_min.h > min_size.h) ? obj_min.h : min_size.h; Eina_Size2D new_min = obj_min; @@ -246,16 +248,6 @@ _efl_ui_scroll_alert_popup_expandable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Scro return pd->max_size; } -EOLIAN static void -_efl_ui_scroll_alert_popup_efl_ui_popup_popup_size_set(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd, Eina_Size2D size) -{ - pd->size = size; - - efl_gfx_entity_size_set(obj, size); - - efl_canvas_group_change(obj); -} - EOLIAN static Eo * _efl_ui_scroll_alert_popup_efl_object_constructor(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd) @@ -275,7 +267,6 @@ _efl_ui_scroll_alert_popup_efl_object_constructor(Eo *obj, efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.content"), pd->scroller); - pd->size = EINA_SIZE2D(0, 0); pd->max_size = EINA_SIZE2D(-1, -1); return obj; diff --git a/src/lib/elementary/efl_ui_scroll_alert_popup.eo b/src/lib/elementary/efl_ui_scroll_alert_popup.eo index fb9aeb2558..8f75b5a44e 100644 --- a/src/lib/elementary/efl_ui_scroll_alert_popup.eo +++ b/src/lib/elementary/efl_ui_scroll_alert_popup.eo @@ -28,6 +28,5 @@ class @beta Efl.Ui.Scroll_Alert_Popup extends Efl.Ui.Alert_Popup Efl.Object.constructor; Efl.Canvas.Group.group_calculate; Efl.Part.part_get; - Efl.Ui.Popup.popup_size { set;} } } diff --git a/src/lib/elementary/efl_ui_text_alert_popup.c b/src/lib/elementary/efl_ui_text_alert_popup.c index ad0c222d5f..6fc625d3d2 100644 --- a/src/lib/elementary/efl_ui_text_alert_popup.c +++ b/src/lib/elementary/efl_ui_text_alert_popup.c @@ -20,7 +20,7 @@ static void _scroller_sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd, Eina_Size2D obj_min, Eina_Size2D text_min) { - Eina_Size2D max_size; + Eina_Size2D max_size, min_size; max_size.w = -1; max_size.h = -1; @@ -29,9 +29,11 @@ _scroller_sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd, Eina_Size2D obj if (pd->max_size.h != -1) max_size.h = (obj_min.h > pd->max_size.h) ? obj_min.h : pd->max_size.h; + min_size = efl_gfx_hint_size_min_get(obj); + Eina_Size2D size; - size.w = (obj_min.w > pd->size.w) ? obj_min.w : pd->size.w; - size.h = (obj_min.h > pd->size.h) ? obj_min.h : pd->size.h; + size.w = (obj_min.w > min_size.w) ? obj_min.w : min_size.w; + size.h = (obj_min.h > min_size.h) ? obj_min.h : min_size.h; text_min.w = (obj_min.w > text_min.w) ? obj_min.w : text_min.w; text_min.h = (obj_min.h > text_min.h) ? obj_min.h : text_min.h; @@ -107,16 +109,6 @@ _scroller_sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd, Eina_Size2D obj efl_gfx_hint_size_restricted_min_set(obj, new_min); } -EOLIAN static void -_efl_ui_text_alert_popup_efl_ui_popup_popup_size_set(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd, Eina_Size2D size) -{ - pd->size = size; - - efl_gfx_entity_size_set(obj, size); - - efl_canvas_group_change(obj); -} - static void _sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd) { @@ -284,7 +276,6 @@ _efl_ui_text_alert_popup_efl_object_constructor(Eo *obj, efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.content"), pd->scroller); - pd->size = EINA_SIZE2D(0, 0); pd->max_size = EINA_SIZE2D(-1, -1); return obj; diff --git a/src/lib/elementary/efl_ui_text_alert_popup.eo b/src/lib/elementary/efl_ui_text_alert_popup.eo index 0f684866c7..b8e48da770 100644 --- a/src/lib/elementary/efl_ui_text_alert_popup.eo +++ b/src/lib/elementary/efl_ui_text_alert_popup.eo @@ -21,7 +21,6 @@ class @beta Efl.Ui.Text_Alert_Popup extends Efl.Ui.Alert_Popup implements Efl.Te implements { Efl.Object.constructor; Efl.Canvas.Group.group_calculate; - Efl.Ui.Popup.popup_size { set;} Efl.Text.text { get; set; } Efl.Part.part_get; } diff --git a/src/lib/elementary/efl_ui_text_alert_popup_private.h b/src/lib/elementary/efl_ui_text_alert_popup_private.h index 88dd6b2133..f07d460f1a 100644 --- a/src/lib/elementary/efl_ui_text_alert_popup_private.h +++ b/src/lib/elementary/efl_ui_text_alert_popup_private.h @@ -8,7 +8,6 @@ struct _Efl_Ui_Text_Alert_Popup_Data { Eo *scroller; Eo *message; - Eina_Size2D size; Eina_Size2D max_size; }; diff --git a/src/tests/elementary/efl_ui_test_popup.c b/src/tests/elementary/efl_ui_test_popup.c index 844520357f..0c161dc366 100644 --- a/src/tests/elementary/efl_ui_test_popup.c +++ b/src/tests/elementary/efl_ui_test_popup.c @@ -66,7 +66,7 @@ EFL_START_TEST(efl_ui_test_popup_basic_align) efl_gfx_entity_size_set(win, EINA_SIZE2D(WIN_SIZE, WIN_SIZE)); popup = efl_add(EFL_UI_POPUP_CLASS, win); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, popup); efl_text_set(btn, "Efl.Ui.Popup"); @@ -150,7 +150,7 @@ EFL_START_TEST(efl_ui_test_popup_basic_sizing) efl_gfx_entity_size_set(win, EINA_SIZE2D(WIN_SIZE, WIN_SIZE)); popup = efl_add(EFL_UI_POPUP_CLASS, win); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, popup); efl_text_set(btn, "Efl.Ui.Popup"); @@ -179,7 +179,7 @@ EFL_START_TEST(efl_ui_test_popup_events) efl_event_callback_add(popup, EFL_UI_POPUP_EVENT_BACKWALL_CLICKED, (void*)event_callback_that_is_called_exactly_one_time_and_sets_a_single_int_data_pointer_when_called, &called); efl_event_callback_add(popup, EFL_UI_POPUP_EVENT_TIMEOUT, event_callback_that_quits_the_main_loop_when_called, NULL); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, popup); efl_text_set(btn, "Efl.Ui.Popup"); @@ -294,7 +294,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert) Eina_Size2D popup_sz_min; Eina_Size2D layout_sz_min = _popup_scroll_alert_setup(&popup, &layout); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); get_me_to_those_events(popup); /* base popup size without content */ @@ -333,7 +333,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand) /* first test horizontal expand */ efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, -1)); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); @@ -359,7 +359,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand) /* now expand vertically */ efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(-1, POPUP_SIZE_EXPAND)); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); /* base popup size without content */ @@ -386,7 +386,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand) /* now both */ efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, POPUP_SIZE_EXPAND)); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); /* base popup size without content */ @@ -418,7 +418,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand) /* now use a confining expand which ignores content min size */ efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE / 2, POPUP_SIZE / 2)); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); { @@ -498,6 +498,7 @@ EFL_START_TEST(efl_ui_test_popup_text_alert) get_me_to_those_events(popup); popup_sz_min1 = efl_gfx_hint_size_combined_min_get(popup); + efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); for (i = 0; i < num_tests; i++) { @@ -511,7 +512,6 @@ EFL_START_TEST(efl_ui_test_popup_text_alert) efl_text_set(popup, eina_strbuf_string_get(buf)); efl_ui_text_alert_popup_expandable_set(popup, test_expands[i]); - efl_ui_popup_size_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); /* get internal label object: VERY illegal */ From 144d086fd700a7993fe3b7167599bcd3a9d6969b Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 9 Aug 2019 15:11:15 -0400 Subject: [PATCH 11/24] efl_ui/popup: remove 'expandable' property from popup subclasses this is more or less just the max size hint, so just set the max size hint ref T7902 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9550 --- src/bin/elementary/test_ui_popup.c | 32 ++++++------- .../elementary/efl_ui_scroll_alert_popup.c | 45 +++---------------- .../elementary/efl_ui_scroll_alert_popup.eo | 21 --------- .../efl_ui_scroll_alert_popup_private.h | 2 - src/lib/elementary/efl_ui_text_alert_popup.c | 40 +++-------------- src/lib/elementary/efl_ui_text_alert_popup.eo | 15 ------- .../efl_ui_text_alert_popup_private.h | 1 - src/tests/elementary/efl_ui_test_popup.c | 10 ++--- 8 files changed, 32 insertions(+), 134 deletions(-) diff --git a/src/bin/elementary/test_ui_popup.c b/src/bin/elementary/test_ui_popup.c index 8ac846cdff..16b0b9ccb1 100644 --- a/src/bin/elementary/test_ui_popup.c +++ b/src/bin/elementary/test_ui_popup.c @@ -428,7 +428,7 @@ _alert_scroll_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); //This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined. - efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(320, -1)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(320, -1)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); @@ -454,7 +454,7 @@ _alert_scroll_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); //This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined. - efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 320)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 320)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); @@ -480,7 +480,7 @@ _alert_scroll_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); //This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined. - efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(320, 320)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(320, 320)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); @@ -506,7 +506,7 @@ _alert_scroll_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); //This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined. - efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(80, 80)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(80, 80)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL); @@ -619,7 +619,7 @@ _alert_text_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eo *efl_ui_popup= efl_add(EFL_UI_TEXT_ALERT_POPUP_CLASS, win); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, 300)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, 300)); efl_text_set(efl_part(efl_ui_popup, "title"), "title"); efl_text_set(efl_ui_popup, "This is Text Popup"); @@ -646,7 +646,7 @@ _alert_text_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, -1)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, -1)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); } @@ -664,7 +664,7 @@ _alert_text_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -686,7 +686,7 @@ _alert_text_case6_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, 300)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, 300)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); @@ -713,7 +713,7 @@ _alert_text_case7_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, -1)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, -1)); efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL); @@ -736,7 +736,7 @@ _alert_text_case8_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); @@ -761,7 +761,7 @@ _alert_text_case9_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(10, 10)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(10, 10)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); @@ -786,7 +786,7 @@ _alert_text_case10_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(150, 150)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(150, 150)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); @@ -811,7 +811,7 @@ _alert_text_case11_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(150, -1)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(150, -1)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); @@ -836,7 +836,7 @@ _alert_text_case12_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, -1)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, -1)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); @@ -861,7 +861,7 @@ _alert_text_case13_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 150)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 150)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); @@ -886,7 +886,7 @@ _alert_text_case14_cb(void *data, const Efl_Event *ev EINA_UNUSED) efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL); - efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); + efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 300)); efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200)); diff --git a/src/lib/elementary/efl_ui_scroll_alert_popup.c b/src/lib/elementary/efl_ui_scroll_alert_popup.c index 37311883fb..bba1392aed 100644 --- a/src/lib/elementary/efl_ui_scroll_alert_popup.c +++ b/src/lib/elementary/efl_ui_scroll_alert_popup.c @@ -20,13 +20,12 @@ _scroller_sizing_eval(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd, Eina_Size2D obj_min, Eina_Size2D scr_min) { Eina_Size2D max_size, min_size; - max_size.w = -1; - max_size.h = -1; + max_size = efl_gfx_hint_size_max_get(obj); - if (pd->max_size.w != -1) - max_size.w = (obj_min.w > pd->max_size.w) ? obj_min.w : pd->max_size.w; - if (pd->max_size.h != -1) - max_size.h = (obj_min.h > pd->max_size.h) ? obj_min.h : pd->max_size.h; + if (max_size.w != -1) + max_size.w = (obj_min.w > max_size.w) ? obj_min.w : max_size.w; + if (max_size.h != -1) + max_size.h = (obj_min.h > max_size.h) ? obj_min.h : max_size.h; min_size = efl_gfx_hint_size_min_get(obj); @@ -216,38 +215,6 @@ _efl_ui_scroll_alert_popup_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Alert_Pop return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part)); } -static void -_efl_ui_scroll_alert_popup_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Alert_Popup_Data *pd, Eina_Size2D max_size) -{ - Eina_Bool valid_max_w = EINA_FALSE; - Eina_Bool valid_max_h = EINA_FALSE; - - if ((max_size.w == -1) || (max_size.w >= 0)) - valid_max_w = EINA_TRUE; - - if ((max_size.h == -1) || (max_size.h >= 0)) - valid_max_h = EINA_TRUE; - - if (!valid_max_w || !valid_max_h) - { - ERR("Invalid max size(%d, %d)!" - "The max size should be equal to or bigger than 0. " - "To disable expandable property, set -1 to the max size.", - max_size.w, max_size.h); - return; - } - - pd->max_size = max_size; - - efl_canvas_group_change(obj); -} - -static Eina_Size2D -_efl_ui_scroll_alert_popup_expandable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Alert_Popup_Data *pd) -{ - return pd->max_size; -} - EOLIAN static Eo * _efl_ui_scroll_alert_popup_efl_object_constructor(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd) @@ -267,8 +234,6 @@ _efl_ui_scroll_alert_popup_efl_object_constructor(Eo *obj, efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.content"), pd->scroller); - pd->max_size = EINA_SIZE2D(-1, -1); - return obj; } diff --git a/src/lib/elementary/efl_ui_scroll_alert_popup.eo b/src/lib/elementary/efl_ui_scroll_alert_popup.eo index 8f75b5a44e..709ff55004 100644 --- a/src/lib/elementary/efl_ui_scroll_alert_popup.eo +++ b/src/lib/elementary/efl_ui_scroll_alert_popup.eo @@ -3,27 +3,6 @@ import eina_types; class @beta Efl.Ui.Scroll_Alert_Popup extends Efl.Ui.Alert_Popup { [[EFL UI Scroll Alert Popup class]] - methods { - @property expandable @beta { - set { - [[Set the expandable max size of popup. - - If the given max_size is -1, then a popup appears with its size. - However, if the given max_size is bigger than 0 the popup size is up to the given max_size. If popup content's min size is bigger than the given max_size the scroller appears in the popup content area. - ]] - } - get { - [[Get the expandable max size of popup. - - If the given max_size is -1, then popup appears with its size. - However, if the given max_size is bigger than 0 the popup size is up to the given max_size. If popup content's min size is bigger than the given max_size the scroller appears in the popup content area. - ]] - } - values { - max_size: Eina.Size2D; [[A 2D max size in pixel units.]] - } - } - } implements { Efl.Object.constructor; Efl.Canvas.Group.group_calculate; diff --git a/src/lib/elementary/efl_ui_scroll_alert_popup_private.h b/src/lib/elementary/efl_ui_scroll_alert_popup_private.h index 98ff244b15..2fe522a86b 100644 --- a/src/lib/elementary/efl_ui_scroll_alert_popup_private.h +++ b/src/lib/elementary/efl_ui_scroll_alert_popup_private.h @@ -8,8 +8,6 @@ struct _Efl_Ui_Scroll_Alert_Popup_Data { Eo *scroller; Eo *content; - Eina_Size2D size; - Eina_Size2D max_size; }; #endif diff --git a/src/lib/elementary/efl_ui_text_alert_popup.c b/src/lib/elementary/efl_ui_text_alert_popup.c index 6fc625d3d2..64dfcc856f 100644 --- a/src/lib/elementary/efl_ui_text_alert_popup.c +++ b/src/lib/elementary/efl_ui_text_alert_popup.c @@ -21,13 +21,13 @@ static void _scroller_sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd, Eina_Size2D obj_min, Eina_Size2D text_min) { Eina_Size2D max_size, min_size; - max_size.w = -1; - max_size.h = -1; - if (pd->max_size.w != -1) - max_size.w = (obj_min.w > pd->max_size.w) ? obj_min.w : pd->max_size.w; - if (pd->max_size.h != -1) - max_size.h = (obj_min.h > pd->max_size.h) ? obj_min.h : pd->max_size.h; + max_size = efl_gfx_hint_size_max_get(obj); + + if (max_size.w != -1) + max_size.w = (obj_min.w > max_size.w) ? obj_min.w : max_size.w; + if (max_size.h != -1) + max_size.h = (obj_min.h > max_size.h) ? obj_min.h : max_size.h; min_size = efl_gfx_hint_size_min_get(obj); @@ -231,32 +231,6 @@ _efl_ui_text_alert_popup_efl_text_text_get(const Eo *obj, Efl_Ui_Text_Alert_Popu return _efl_ui_text_alert_popup_text_get(obj, pd, "efl.text"); } -static void -_efl_ui_text_alert_popup_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Alert_Popup_Data *pd, Eina_Size2D max_size) -{ - Eina_Bool valid_max_w = EINA_FALSE; - Eina_Bool valid_max_h = EINA_FALSE; - - if ((max_size.w == -1) || (max_size.w >= 0)) - valid_max_w = EINA_TRUE; - - if ((max_size.h == -1) || (max_size.h >= 0)) - valid_max_h = EINA_TRUE; - - if (!valid_max_w || !valid_max_h) - { - ERR("Invalid max size(%d, %d)!" - "The max size should be equal to or bigger than 0. " - "To disable expandable property, set -1 to the max size.", - max_size.w, max_size.h); - return; - } - - pd->max_size = max_size; - - efl_canvas_group_change(obj); -} - EOLIAN static Eo * _efl_ui_text_alert_popup_efl_object_constructor(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd) @@ -276,8 +250,6 @@ _efl_ui_text_alert_popup_efl_object_constructor(Eo *obj, efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.content"), pd->scroller); - pd->max_size = EINA_SIZE2D(-1, -1); - return obj; } diff --git a/src/lib/elementary/efl_ui_text_alert_popup.eo b/src/lib/elementary/efl_ui_text_alert_popup.eo index b8e48da770..8ec9f71f88 100644 --- a/src/lib/elementary/efl_ui_text_alert_popup.eo +++ b/src/lib/elementary/efl_ui_text_alert_popup.eo @@ -3,21 +3,6 @@ import eina_types; class @beta Efl.Ui.Text_Alert_Popup extends Efl.Ui.Alert_Popup implements Efl.Text { [[EFL UI Text Alert Popup class]] - methods { - @property expandable { - set { - [[Set the expandable of popup. - - If the contents of the popup has min size, the popup will be increased by min size along the Y axis. - If max hint is set it will be increased to the value of max hint - and scrolling will occur. - ]] - } - values { - max_size: Eina.Size2D; [[A 2D max size in pixel units.]] - } - } - } implements { Efl.Object.constructor; Efl.Canvas.Group.group_calculate; diff --git a/src/lib/elementary/efl_ui_text_alert_popup_private.h b/src/lib/elementary/efl_ui_text_alert_popup_private.h index f07d460f1a..30f567b987 100644 --- a/src/lib/elementary/efl_ui_text_alert_popup_private.h +++ b/src/lib/elementary/efl_ui_text_alert_popup_private.h @@ -8,7 +8,6 @@ struct _Efl_Ui_Text_Alert_Popup_Data { Eo *scroller; Eo *message; - Eina_Size2D max_size; }; #endif diff --git a/src/tests/elementary/efl_ui_test_popup.c b/src/tests/elementary/efl_ui_test_popup.c index 0c161dc366..df9208d47b 100644 --- a/src/tests/elementary/efl_ui_test_popup.c +++ b/src/tests/elementary/efl_ui_test_popup.c @@ -332,7 +332,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand) popup_sz_min = popup_sz_min1 = efl_gfx_hint_size_combined_min_get(popup); /* first test horizontal expand */ - efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, -1)); + efl_gfx_hint_size_max_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, -1)); efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); @@ -358,7 +358,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand) } /* now expand vertically */ - efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(-1, POPUP_SIZE_EXPAND)); + efl_gfx_hint_size_max_set(popup, EINA_SIZE2D(-1, POPUP_SIZE_EXPAND)); efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); @@ -385,7 +385,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand) } /* now both */ - efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, POPUP_SIZE_EXPAND)); + efl_gfx_hint_size_max_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, POPUP_SIZE_EXPAND)); efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); @@ -417,7 +417,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand) } /* now use a confining expand which ignores content min size */ - efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE / 2, POPUP_SIZE / 2)); + efl_gfx_hint_size_max_set(popup, EINA_SIZE2D(POPUP_SIZE / 2, POPUP_SIZE / 2)); efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE)); efl_canvas_group_calculate(popup); @@ -511,7 +511,7 @@ EFL_START_TEST(efl_ui_test_popup_text_alert) eina_strbuf_append(buf, test_string); efl_text_set(popup, eina_strbuf_string_get(buf)); - efl_ui_text_alert_popup_expandable_set(popup, test_expands[i]); + efl_gfx_hint_size_max_set(popup, test_expands[i]); efl_canvas_group_calculate(popup); /* get internal label object: VERY illegal */ From c375bbcfa7f224e2be540cf122488b477032c9c1 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 9 Aug 2019 15:13:09 -0400 Subject: [PATCH 12/24] efl/hint: add doc note about max size hint ref T8122 Reviewed-by: Cedric BAIL Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D9551 --- src/lib/efl/interfaces/efl_gfx_hint.eo | 8 ++++++++ src/lib/evas/canvas/evas_object_main.c | 21 ++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_hint.eo b/src/lib/efl/interfaces/efl_gfx_hint.eo index 286474f888..42d1b7a7f2 100644 --- a/src/lib/efl/interfaces/efl_gfx_hint.eo +++ b/src/lib/efl/interfaces/efl_gfx_hint.eo @@ -65,6 +65,10 @@ interface Efl.Gfx.Hint Note: Smart objects (such as elementary) can have their own hint policy. So calling this API may or may not affect the size of smart objects. + + Note: It is an error for the @.hint_size_max to be smaller in either axis + than @.hint_size_min. In this scenario, the max size hint will be + prioritized over the user min size hint. ]] values { sz: Eina.Size2D; [[Maximum size (hint) in pixels, (-1, -1) by @@ -85,6 +89,10 @@ interface Efl.Gfx.Hint Note: This property is meant to be set by applications and not by EFL itself. Use this to request a specific size (treated as minimum size). + + Note: It is an error for the @.hint_size_max to be smaller in either axis + than @.hint_size_min. In this scenario, the max size hint will be + prioritized over the user min size hint. ]] values { sz: Eina.Size2D; [[Minimum size (hint) in pixels.]] diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 50234f9002..257d4ff1b9 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1479,8 +1479,16 @@ _efl_canvas_object_efl_gfx_hint_hint_size_combined_min_get(const Eo *eo_obj EINA if ((!obj->size_hints) || obj->delete_me) return sz; - sz.w = MAX(obj->size_hints->min.w, obj->size_hints->user_min.w); - sz.h = MAX(obj->size_hints->min.h, obj->size_hints->user_min.h); + sz.w = obj->size_hints->user_min.w; + if (obj->size_hints->max.w != -1) + sz.w = obj->size_hints->max.w; + sz.h = obj->size_hints->user_min.h; + if (obj->size_hints->max.h != -1) + sz.h = obj->size_hints->max.h; + + /* clamp user min to user max here */ + sz.w = MAX(obj->size_hints->min.w, MIN(sz.w, obj->size_hints->user_min.w)); + sz.h = MAX(obj->size_hints->min.h, MIN(sz.h, obj->size_hints->user_min.h)); return sz; } @@ -1509,6 +1517,10 @@ _efl_canvas_object_efl_gfx_hint_hint_size_max_set(Eo *eo_obj, Evas_Object_Protec if ((obj->size_hints->max.w == sz.w) && (obj->size_hints->max.h == sz.h)) return; obj->size_hints->max.w = sz.w; obj->size_hints->max.h = sz.h; + if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w)) + ERR("max width hint is now smaller than user_min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->user_min.w); + if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h)) + ERR("max height hint is now smaller than user_min height hint! (%d < %d)", obj->size_hints->max.h, obj->size_hints->user_min.h); evas_object_inform_call_changed_size_hints(eo_obj, obj); } @@ -1572,7 +1584,10 @@ _efl_canvas_object_efl_gfx_hint_hint_size_min_set(Eo *eo_obj, Evas_Object_Protec } if ((obj->size_hints->user_min.w == sz.w) && (obj->size_hints->user_min.h == sz.h)) return; obj->size_hints->user_min = sz; - + if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w)) + ERR("max width hint is now smaller than user_min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->user_min.w); + if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h)) + ERR("max height hint is now smaller than user_min height hint! (%d < %d)", obj->size_hints->max.h, obj->size_hints->user_min.h); evas_object_inform_call_changed_size_hints(eo_obj, obj); } From c3f78d8b4f860956943d8fa9714b1ae13c48febe Mon Sep 17 00:00:00 2001 From: SangHyeon Jade Lee Date: Tue, 13 Aug 2019 11:30:06 +0000 Subject: [PATCH 13/24] efl_ui: update efl_ui_list_view example to work seems name for the model property_name is now allowed, so fix it to title and now it works well. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9558 --- src/examples/elementary/efl_ui_list_view_example_1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/examples/elementary/efl_ui_list_view_example_1.c b/src/examples/elementary/efl_ui_list_view_example_1.c index 78489017ca..c0b377b128 100644 --- a/src/examples/elementary/efl_ui_list_view_example_1.c +++ b/src/examples/elementary/efl_ui_list_view_example_1.c @@ -61,7 +61,7 @@ _make_model(Evas_Object *win) snprintf(buf, sizeof(buf), "Item # %i", i); eina_value_set(&vtext, buf); - efl_model_property_set(child, "name", &vtext); + efl_model_property_set(child, "title", &vtext); } eina_value_flush(&vtext); @@ -90,7 +90,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); efl_ui_property_bind(factory, "signal/efl,state,%v", "odd_style"); efl_ui_property_bind(factory, "signal/efl,state,%{selected;unselected}", "selected"); - efl_ui_property_bind(factory, "efl.text", "name"); + efl_ui_property_bind(factory, "efl.text", "title"); li = efl_add(EFL_UI_LIST_VIEW_CLASS, win , efl_ui_list_view_layout_factory_set(efl_added, factory) From e1fda2cbdb435c251ced9843bc87dd7f99639fb7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 12 Aug 2019 11:14:49 -0400 Subject: [PATCH 14/24] efl/hints: add restricted and combined max size hints these function the same as the min size hint versions and enable distinction between internally-set max size hints and user-set max size hints @feature ref T8122 Reviewed-by: Cedric BAIL Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D9553 --- src/lib/ecore_evas/ecore_evas_util.c | 2 +- src/lib/edje/edje_util.c | 2 +- src/lib/efl/interfaces/efl_gfx_hint.eo | 49 ++++++++++ src/lib/elementary/efl_ui_container_layout.c | 2 +- src/lib/elementary/efl_ui_flip.c | 12 +-- src/lib/elementary/efl_ui_frame.c | 5 +- src/lib/elementary/efl_ui_image.c | 2 +- src/lib/elementary/efl_ui_image_zoomable.c | 7 +- .../efl_ui_list_view_precise_layouter.c | 2 +- src/lib/elementary/efl_ui_relative_layout.c | 2 +- src/lib/elementary/efl_ui_scroller.c | 2 +- src/lib/elementary/efl_ui_win.c | 8 +- src/lib/evas/Evas_Internal.h | 9 ++ src/lib/evas/canvas/efl_canvas_object.eo | 2 + src/lib/evas/canvas/evas_object_main.c | 98 ++++++++++++++++--- src/lib/evas/include/evas_private.h | 2 +- 16 files changed, 170 insertions(+), 36 deletions(-) diff --git a/src/lib/ecore_evas/ecore_evas_util.c b/src/lib/ecore_evas/ecore_evas_util.c index fb4a9aa7a5..4f3e9c4baa 100644 --- a/src/lib/ecore_evas/ecore_evas_util.c +++ b/src/lib/ecore_evas/ecore_evas_util.c @@ -136,7 +136,7 @@ _ecore_evas_object_callback_changed_size_hints(void *data, Evas *e EINA_UNUSED, evas_object_size_hint_combined_min_get(obj, &w, &h); ecore_evas_size_min_set(ee, w, h); - evas_object_size_hint_max_get(obj, &w, &h); + evas_object_size_hint_combined_max_get(obj, &w, &h); if (w < 1) w = -1; if (h < 1) h = -1; ecore_evas_size_max_set(ee, w, h); diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index ec6b841985..2f6c5b2d22 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -6021,7 +6021,7 @@ _edje_real_part_swallow_hints_update(Edje_Real_Part *rp) Evas_Aspect_Control am = EVAS_ASPECT_CONTROL_NONE; evas_object_size_hint_combined_min_get(rp->typedata.swallow->swallowed_object, &w1, &h1); - evas_object_size_hint_max_get(rp->typedata.swallow->swallowed_object, &w2, &h2); + evas_object_size_hint_combined_max_get(rp->typedata.swallow->swallowed_object, &w2, &h2); evas_object_size_hint_aspect_get(rp->typedata.swallow->swallowed_object, &am, &aw, &ah); rp->typedata.swallow->swallow_params.min.w = w1; rp->typedata.swallow->swallow_params.min.h = h1; diff --git a/src/lib/efl/interfaces/efl_gfx_hint.eo b/src/lib/efl/interfaces/efl_gfx_hint.eo index 42d1b7a7f2..d00c83e246 100644 --- a/src/lib/efl/interfaces/efl_gfx_hint.eo +++ b/src/lib/efl/interfaces/efl_gfx_hint.eo @@ -75,6 +75,51 @@ interface Efl.Gfx.Hint default for canvas objects).]] } } + @property hint_size_restricted_max { + [[Internal hints for an object's maximum size. + + This is not a size enforcement in any way, it's just a hint + that should be used whenever appropriate. + + Values -1 will be treated as unset hint components, when + queried by managers. + + Note: This property is internal and meant for widget developers to + define the absolute maximum size of the object. EFL itself sets + this size internally, so any change to it from an application + might be ignored. Applications should use @.hint_size_max instead. + + Note: It is an error for the @.hint_size_restricted_max to be smaller in either axis + than @.hint_size_restricted_min. In this scenario, the max size hint will be + prioritized over the user min size hint. + ]] + set @protected { + [[This function is protected as it is meant for widgets to indicate + their "intrinsic" maximum size. + ]] + } + get { + [[Get the "intrinsic" maximum size of this object.]] + } + values { + sz: Eina.Size2D; [[Maximum size (hint) in pixels.]] + } + } + @property hint_size_combined_max { + [[Read-only maximum size combining both @.hint_size_restricted_max and + @.hint_size_max hints. + + @.hint_size_restricted_max is intended for mostly internal usage + and widget developers, and @.hint_size_max is intended to be + set from application side. @.hint_size_combined_max combines both values + by taking their repective maximum (in both width and height), and + is used internally to get an object's maximum size. + ]] + get {} + values { + sz: Eina.Size2D; [[Maximum size (hint) in pixels.]] + } + } @property hint_size_min { [[Hints on the object's minimum size. @@ -111,6 +156,10 @@ interface Efl.Gfx.Hint define the absolute minimum size of the object. EFL itself sets this size internally, so any change to it from an application might be ignored. Use @.hint_size_min instead. + + Note: It is an error for the @.hint_size_restricted_max to be smaller in either axis + than @.hint_size_restricted_min. In this scenario, the max size hint will be + prioritized over the user min size hint. ]] set @protected { [[This function is protected as it is meant for widgets to indicate diff --git a/src/lib/elementary/efl_ui_container_layout.c b/src/lib/elementary/efl_ui_container_layout.c index 770e55a5dc..34a8bbb49b 100644 --- a/src/lib/elementary/efl_ui_container_layout.c +++ b/src/lib/elementary/efl_ui_container_layout.c @@ -53,7 +53,7 @@ _efl_ui_container_layout_item_init(Eo* o, Efl_Ui_Container_Item_Hints *item) efl_gfx_hint_margin_get(o, &item[0].margin[0], &item[0].margin[1], &item[1].margin[0], &item[1].margin[1]); efl_gfx_hint_fill_get(o, &item[0].fill, &item[1].fill); - max = efl_gfx_hint_size_max_get(o); + max = efl_gfx_hint_size_combined_max_get(o); min = efl_gfx_hint_size_combined_min_get(o); efl_gfx_hint_aspect_get(o, &aspect_type, &aspect); item[0].aspect = aspect.w; diff --git a/src/lib/elementary/efl_ui_flip.c b/src/lib/elementary/efl_ui_flip.c index e24583796d..26f8d848bf 100644 --- a/src/lib/elementary/efl_ui_flip.c +++ b/src/lib/elementary/efl_ui_flip.c @@ -67,8 +67,8 @@ static void _sizing_eval(Evas_Object *obj) { Evas_Coord minw = -1, minh = -1, minw2 = -1, minh2 = -1; - Evas_Coord maxw = -1, maxh = -1, maxw2 = -1, maxh2 = -1; int fingx = 0, fingy = 0; + Eina_Size2D max = EINA_SIZE2D(-1, -1), max2 = EINA_SIZE2D(-1, -1); EFL_UI_FLIP_DATA_GET(obj, sd); @@ -77,14 +77,14 @@ _sizing_eval(Evas_Object *obj) if (sd->back.content) evas_object_size_hint_combined_min_get(sd->back.content, &minw2, &minh2); if (sd->front.content) - evas_object_size_hint_max_get(sd->front.content, &maxw, &maxh); + max = efl_gfx_hint_size_combined_max_get(sd->front.content); if (sd->back.content) - evas_object_size_hint_max_get(sd->back.content, &maxw2, &maxh2); + max2 = efl_gfx_hint_size_combined_max_get(sd->back.content); if (minw2 > minw) minw = minw2; if (minh2 > minh) minh = minh2; - if ((maxw2 >= 0) && (maxw2 < maxw)) maxw = maxw2; - if ((maxh2 >= 0) && (maxh2 < maxh)) maxh = maxh2; + if ((max2.w >= 0) && (max2.w < max.w)) max.w = max2.w; + if ((max2.h >= 0) && (max2.h < max.h)) max.h = max2.h; if (sd->dir_enabled[ELM_FLIP_DIRECTION_UP]) fingy++; if (sd->dir_enabled[ELM_FLIP_DIRECTION_DOWN]) fingy++; @@ -94,7 +94,7 @@ _sizing_eval(Evas_Object *obj) elm_coords_finger_size_adjust(fingx, &minw, fingy, &minh); efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); - evas_object_size_hint_max_set(obj, maxw, maxh); + efl_gfx_hint_size_restricted_max_set(obj, max); } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_frame.c b/src/lib/elementary/efl_ui_frame.c index 5680fdf901..0e6f230d5b 100644 --- a/src/lib/elementary/efl_ui_frame.c +++ b/src/lib/elementary/efl_ui_frame.c @@ -39,7 +39,10 @@ _sizing_eval(Evas_Object *obj, if ((minw == cminw) && (minh == cminh)) return; efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); - evas_object_size_hint_max_set(obj, -1, -1); + if (elm_widget_is_legacy(obj)) + evas_object_size_hint_max_set(obj, -1, -1); + else + efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); } static void diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index c07f2b2ca4..916eb2bb6e 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -803,7 +803,7 @@ _efl_ui_image_sizing_eval(Evas_Object *obj) } efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); - evas_object_size_hint_max_set(obj, maxw, maxh); + efl_gfx_hint_size_restricted_max_set(obj, EINA_SIZE2D(maxw, maxh)); if (sd->img) { diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 64eda7a52d..88824c3985 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -111,13 +111,12 @@ _photocam_image_file_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd) static void _sizing_eval(Evas_Object *obj) { - Evas_Coord minw = 0, minh = 0, maxw = -1, maxh = -1; + Evas_Coord minw = 0, minh = 0; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + Eina_Size2D max = efl_gfx_hint_size_combined_max_get(wd->resize_obj); - evas_object_size_hint_max_get - (wd->resize_obj, &maxw, &maxh); efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); - evas_object_size_hint_max_set(obj, maxw, maxh); + efl_gfx_hint_size_restricted_max_set(obj, max); } static void diff --git a/src/lib/elementary/efl_ui_list_view_precise_layouter.c b/src/lib/elementary/efl_ui_list_view_precise_layouter.c index d20d706d3f..a7ee6ec102 100644 --- a/src/lib/elementary/efl_ui_list_view_precise_layouter.c +++ b/src/lib/elementary/efl_ui_list_view_precise_layouter.c @@ -65,7 +65,7 @@ _item_size_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Lay efl_gfx_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb); efl_gfx_hint_align_get(item->layout, &align[0], &align[1]); efl_gfx_hint_fill_get(item->layout, &fill[0], &fill[1]); - max = efl_gfx_hint_size_max_get(item->layout); + max = efl_gfx_hint_size_combined_max_get(item->layout); // box outer margin boxw -= boxl + boxr; diff --git a/src/lib/elementary/efl_ui_relative_layout.c b/src/lib/elementary/efl_ui_relative_layout.c index 983a507e71..c591c154c8 100644 --- a/src/lib/elementary/efl_ui_relative_layout.c +++ b/src/lib/elementary/efl_ui_relative_layout.c @@ -497,7 +497,7 @@ _hash_child_init_foreach_cb(const Eina_Hash *hash EINA_UNUSED, const void *key E calc->aspect[1] = aspect.h; efl_gfx_hint_margin_get(child->obj, &calc->margin[LEFT], &calc->margin[RIGHT], &calc->margin[TOP], &calc->margin[BOTTOM]); - max = efl_gfx_hint_size_max_get(child->obj); + max = efl_gfx_hint_size_combined_max_get(child->obj); min = efl_gfx_hint_size_combined_min_get(child->obj); calc->max[0] = max.w; calc->max[1] = max.h; diff --git a/src/lib/elementary/efl_ui_scroller.c b/src/lib/elementary/efl_ui_scroller.c index 56adea8332..cbcb2c97f2 100644 --- a/src/lib/elementary/efl_ui_scroller.c +++ b/src/lib/elementary/efl_ui_scroller.c @@ -302,7 +302,7 @@ _efl_ui_scroller_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Scroller_Data if (sd->content) { min = efl_gfx_hint_size_combined_min_get(sd->content); - max = efl_gfx_hint_size_max_get(sd->content); + max = efl_gfx_hint_size_combined_max_get(sd->content); efl_gfx_hint_weight_get(sd->content, &xw, &yw); } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 32f0ded966..c50ec79fa7 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -963,7 +963,7 @@ _elm_win_size_hints_update(Efl_Ui_Win *win, Efl_Ui_Win_Data *sd) Eina_Size2D min, max; min = efl_gfx_hint_size_combined_min_get(win); - max = efl_gfx_hint_size_max_get(win); + max = efl_gfx_hint_size_combined_max_get(win); if (max.w < 1) max.w = -1; if (max.h < 1) max.h = -1; @@ -1637,7 +1637,7 @@ _win_rotate(Evas_Object *obj, Efl_Ui_Win_Data *sd, int rotation, Eina_Bool resiz if (resize) TRAP(sd, rotation_with_resize_set, rotation); else TRAP(sd, rotation_set, rotation); efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(-1, -1)); - efl_gfx_hint_size_max_set(obj, EINA_SIZE2D(-1, -1)); + efl_gfx_hint_size_restricted_max_set(obj, EINA_SIZE2D(-1, -1)); _elm_win_resize_objects_eval(obj, EINA_FALSE); #ifdef HAVE_ELEMENTARY_X _elm_win_xwin_update(sd); @@ -3701,6 +3701,7 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize) evas_object_size_hint_combined_min_get(sd->legacy.edje, &minw, &minh); if ((!minw) && (!minh) && (!sd->deferred_resize_job)) return; + efl_gfx_hint_size_restricted_max_set(obj, EINA_SIZE2D(-1, -1)); // If content has a weight, make resizable efl_gfx_hint_weight_get(sd->legacy.edje, &wx, &wy); @@ -3722,6 +3723,7 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize) if (maxh > 32767) maxh = 32767; unresizable = ((minw == maxw) && (minh == maxh)); + if (sd->csd.need_unresizable != unresizable) { sd->csd.need_unresizable = unresizable; @@ -3741,7 +3743,7 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize) sd->tmp_updating_hints = 1; efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh)); - efl_gfx_hint_size_max_set(obj, EINA_SIZE2D(maxw, maxh)); + efl_gfx_hint_size_restricted_max_set(obj, EINA_SIZE2D(maxw, maxh)); sd->tmp_updating_hints = 0; _elm_win_size_hints_update(obj, sd); diff --git a/src/lib/evas/Evas_Internal.h b/src/lib/evas/Evas_Internal.h index 48b7928014..2958977275 100644 --- a/src/lib/evas/Evas_Internal.h +++ b/src/lib/evas/Evas_Internal.h @@ -61,6 +61,15 @@ evas_object_size_hint_combined_min_get(const Eo *obj, int *w, int *h) if (h) *h = sz.h; } +static inline void +evas_object_size_hint_combined_max_get(const Eo *obj, int *w, int *h) +{ + Eina_Size2D sz; + sz = efl_gfx_hint_size_combined_max_get(obj); + if (w) *w = sz.w; + if (h) *h = sz.h; +} + /* Internal EO APIs */ EAPI Eo *evas_find(const Eo *obj); EOAPI void efl_canvas_object_legacy_ctor(Eo *obj); diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo index ff4703e25a..51154068f9 100644 --- a/src/lib/evas/canvas/efl_canvas_object.eo +++ b/src/lib/evas/canvas/efl_canvas_object.eo @@ -540,7 +540,9 @@ abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity, Efl.Gfx.Hint.hint_aspect { get; set; } Efl.Gfx.Hint.hint_align { get; set; } Efl.Gfx.Hint.hint_size_combined_min { get; } + Efl.Gfx.Hint.hint_size_combined_max { get; } Efl.Gfx.Hint.hint_size_restricted_min { get; set; } + Efl.Gfx.Hint.hint_size_restricted_max { get; set; } Efl.Gfx.Hint.hint_size_min { get; set; } Efl.Gfx.Hint.hint_size_max { get; set; } Efl.Gfx.Hint.hint_margin { get; set; } diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 257d4ff1b9..1280cce9ec 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1405,6 +1405,8 @@ _evas_object_size_hint_alloc(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protec obj->size_hints = EVAS_MEMPOOL_ALLOC(_mp_sh, Evas_Size_Hints); if (!obj->size_hints) return; EVAS_MEMPOOL_PREP(_mp_sh, obj->size_hints, Evas_Size_Hints); + obj->size_hints->user_max.w = -1; + obj->size_hints->user_max.h = -1; obj->size_hints->max.w = -1; obj->size_hints->max.h = -1; obj->size_hints->align.x = 0.5; @@ -1443,6 +1445,37 @@ evas_object_size_hint_display_mode_set(Eo *eo_obj, Evas_Display_Mode dispmode) evas_object_inform_call_changed_size_hints(eo_obj, obj); } +EOLIAN static Eina_Size2D +_efl_canvas_object_efl_gfx_hint_hint_size_restricted_max_get(const Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) +{ + if ((!obj->size_hints) || obj->delete_me) + return EINA_SIZE2D(0, 0); + + return obj->size_hints->max; +} + +EOLIAN static void +_efl_canvas_object_efl_gfx_hint_hint_size_restricted_max_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Size2D sz) +{ + if (obj->delete_me) + return; + + EVAS_OBJECT_DATA_VALID_CHECK(obj); + evas_object_async_block(obj); + if (EINA_UNLIKELY(!obj->size_hints)) + { + if (!sz.w && !sz.h) return; + _evas_object_size_hint_alloc(eo_obj, obj); + } + if ((obj->size_hints->max.w == sz.w) && (obj->size_hints->max.h == sz.h)) return; + obj->size_hints->max = sz; + if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->min.w)) + ERR("restricted max width hint is now smaller than restricted min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->min.w); + if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->min.h)) + ERR("restricted max height hint is now smaller than restricted min height hint! (%d < %d)", obj->size_hints->max.h, obj->size_hints->min.h); + evas_object_inform_call_changed_size_hints(eo_obj, obj); +} + EOLIAN static Eina_Size2D _efl_canvas_object_efl_gfx_hint_hint_size_restricted_min_get(const Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) { @@ -1467,7 +1500,10 @@ _efl_canvas_object_efl_gfx_hint_hint_size_restricted_min_set(Eo *eo_obj, Evas_Ob } if ((obj->size_hints->min.w == sz.w) && (obj->size_hints->min.h == sz.h)) return; obj->size_hints->min = sz; - + if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->min.w)) + ERR("restricted max width hint is now smaller than restricted min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->min.w); + if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->min.h)) + ERR("restricted max height hint is now smaller than restricted min height hint! (%d < %d)", obj->size_hints->max.h, obj->size_hints->min.h); evas_object_inform_call_changed_size_hints(eo_obj, obj); } @@ -1486,19 +1522,53 @@ _efl_canvas_object_efl_gfx_hint_hint_size_combined_min_get(const Eo *eo_obj EINA if (obj->size_hints->max.h != -1) sz.h = obj->size_hints->max.h; - /* clamp user min to user max here */ + /* clamp user min to restricted max here */ sz.w = MAX(obj->size_hints->min.w, MIN(sz.w, obj->size_hints->user_min.w)); sz.h = MAX(obj->size_hints->min.h, MIN(sz.h, obj->size_hints->user_min.h)); return sz; } +EOLIAN static Eina_Size2D +_efl_canvas_object_efl_gfx_hint_hint_size_combined_max_get(const Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) +{ + Eina_Size2D sz = { -1, -1 }; + + if ((!obj->size_hints) || obj->delete_me) + return sz; + + sz.w = obj->size_hints->user_max.w; + sz.h = obj->size_hints->user_max.h; + + /* clamp user max to restricted max here */ + if (obj->size_hints->max.w != -1) + { + if (sz.w == -1) + sz.w = obj->size_hints->max.w; + else + sz.w = MIN(obj->size_hints->max.w, sz.w); + } + if (obj->size_hints->max.h != -1) + { + if (sz.h == -1) + sz.h = obj->size_hints->max.h; + else + sz.h = MIN(obj->size_hints->max.h, sz.h); + } + /* then clamp to restricted min */ + if ((sz.w != -1) && obj->size_hints->min.w > 0) + sz.w = MAX(sz.w, obj->size_hints->min.w); + if ((sz.h != -1) && obj->size_hints->min.h > 0) + sz.h = MAX(sz.h, obj->size_hints->min.h); + return sz; +} + EOLIAN static Eina_Size2D _efl_canvas_object_efl_gfx_hint_hint_size_max_get(const Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) { if ((!obj->size_hints) || obj->delete_me) return EINA_SIZE2D(-1, -1); - return obj->size_hints->max; + return obj->size_hints->user_max; } EOLIAN static void @@ -1514,13 +1584,13 @@ _efl_canvas_object_efl_gfx_hint_hint_size_max_set(Eo *eo_obj, Evas_Object_Protec if ((sz.w == -1) && (sz.h == -1)) return; _evas_object_size_hint_alloc(eo_obj, obj); } - if ((obj->size_hints->max.w == sz.w) && (obj->size_hints->max.h == sz.h)) return; - obj->size_hints->max.w = sz.w; - obj->size_hints->max.h = sz.h; - if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w)) - ERR("max width hint is now smaller than user_min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->user_min.w); - if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h)) - ERR("max height hint is now smaller than user_min height hint! (%d < %d)", obj->size_hints->max.h, obj->size_hints->user_min.h); + if ((obj->size_hints->user_max.w == sz.w) && (obj->size_hints->user_max.h == sz.h)) return; + obj->size_hints->user_max.w = sz.w; + obj->size_hints->user_max.h = sz.h; + if ((obj->size_hints->user_max.w != -1) && (obj->size_hints->user_max.w < obj->size_hints->user_min.w)) + ERR("user_max width hint is now smaller than user_min width hint! (%d < %d)", obj->size_hints->user_max.w, obj->size_hints->user_min.w); + if ((obj->size_hints->user_max.h != -1) && (obj->size_hints->user_max.h < obj->size_hints->user_min.h)) + ERR("user_max height hint is now smaller than user_min height hint! (%d < %d)", obj->size_hints->user_max.h, obj->size_hints->user_min.h); evas_object_inform_call_changed_size_hints(eo_obj, obj); } @@ -1584,10 +1654,10 @@ _efl_canvas_object_efl_gfx_hint_hint_size_min_set(Eo *eo_obj, Evas_Object_Protec } if ((obj->size_hints->user_min.w == sz.w) && (obj->size_hints->user_min.h == sz.h)) return; obj->size_hints->user_min = sz; - if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w)) - ERR("max width hint is now smaller than user_min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->user_min.w); - if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h)) - ERR("max height hint is now smaller than user_min height hint! (%d < %d)", obj->size_hints->max.h, obj->size_hints->user_min.h); + if ((obj->size_hints->user_max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w)) + ERR("max width hint is now smaller than min width hint! (%d < %d)", obj->size_hints->user_max.w, obj->size_hints->user_min.w); + if ((obj->size_hints->user_max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h)) + ERR("max height hint is now smaller than min height hint! (%d < %d)", obj->size_hints->user_max.h, obj->size_hints->user_min.h); evas_object_inform_call_changed_size_hints(eo_obj, obj); } diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 4c22706c4a..a5ea99e958 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -959,7 +959,7 @@ struct _Evas_Double_Pair struct _Evas_Size_Hints { Evas_Size request; - Eina_Size2D min, user_min, max; + Eina_Size2D min, user_min, max, user_max; Evas_Aspect aspect; Evas_Double_Pair align, weight; Evas_Border padding; From 11d2202635587785baaa7276b1129d115d52f2ea Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 12 Aug 2019 11:28:25 -0400 Subject: [PATCH 15/24] efl_ui/text_scroller: remove erroneous max size hint setting this makes no sense ref T8122 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9554 --- src/lib/elementary/efl_ui_internal_text_scroller.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_internal_text_scroller.c b/src/lib/elementary/efl_ui_internal_text_scroller.c index f774d2f6dc..8ee50a7075 100644 --- a/src/lib/elementary/efl_ui_internal_text_scroller.c +++ b/src/lib/elementary/efl_ui_internal_text_scroller.c @@ -119,7 +119,6 @@ _efl_ui_internal_text_scroller_efl_canvas_group_group_calculate(Eo *obj, efl_gfx_entity_size_set(sd->text_table, fsz); efl_gfx_hint_size_restricted_min_set(obj, size); - efl_gfx_hint_size_max_set(obj, EINA_SIZE2D(-1, size.h)); } } From d672d55107efba803c928a55252ab00afe2d0ba3 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Tue, 13 Aug 2019 03:11:30 +0000 Subject: [PATCH 16/24] edje/optimization: keep a readonly flag on edje_style. Just to check if the edje style has text_class tag we do lot of pointer hopping by linearly scan through the tags in the style which is not very cache efficient. by keeping a readonly flag we can avoid those acess if the style dosen't have any text_class tags. and if we have those tags then we can start updating the style straight away. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9546 --- src/lib/edje/edje_private.h | 7 ++++++- src/lib/edje/edje_textblock_styles.c | 27 ++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 15145aeaa1..0eab189859 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -627,7 +627,12 @@ struct _Edje_Style Eina_List *tags; Evas_Textblock_Style *style; - Eina_Bool cache; + Eina_Bool cache : 1; + /* * read only * true if no text_class and no color_class exits in the style. + * added for performace as we don't have to check all tags to decide if we need to update + * this style or not. + */ + Eina_Bool readonly : 1; }; struct _Edje_Style_Tag diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index e83a21d227..555cab92c0 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -168,7 +168,6 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) Eina_Strbuf *txt = NULL; Edje_Style_Tag *tag; Edje_Text_Class *tc; - int found = 0; char *fontset = NULL, *fontsource = NULL; if (!ed->file) return; @@ -176,21 +175,12 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) /* Make sure the style is already defined */ if (!stl->style) return; + /* we are sure it dosen't have any text_class */ + if (stl->readonly) return; + /* No need to compute it again and again and again */ if (!force && stl->cache) return; - /* Make sure the style contains a text_class */ - EINA_LIST_FOREACH(stl->tags, l, tag) - { - if (tag->text_class) - { - found = 1; - break; - } - } - - /* No text classes , goto next style */ - if (!found) return; if (!txt) txt = eina_strbuf_new(); @@ -430,7 +420,8 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class) EINA_LIST_FOREACH(ed->file->styles, l, stl) { Edje_Style_Tag *tag; - Eina_Bool found = EINA_FALSE; + + if (stl->readonly) continue; EINA_LIST_FOREACH(stl->tags, ll, tag) { @@ -438,12 +429,10 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class) if (!strcmp(tag->text_class, text_class)) { - found = EINA_TRUE; + stl->cache = EINA_FALSE; break; } } - if (found) - stl->cache = EINA_FALSE; } } @@ -467,6 +456,8 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) if (stl->style) break; + stl->readonly = EINA_TRUE; + if (!txt) txt = eina_strbuf_new(); @@ -516,6 +507,8 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) } } eina_strbuf_append(txt, "'"); + + if (tag->text_class) stl->readonly = EINA_FALSE; } if (fontset) free(fontset); if (fontsource) free(fontsource); From 252f0c42a07b23e21f9fbe7153895d9b92be0cae Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Wed, 14 Aug 2019 18:45:38 +0000 Subject: [PATCH 17/24] elementary: Avoid segfault when part is not set. Check whether we called `efl_part_get` before. This was happening to C# bindings (maybe a bug there?) but in any case a failure is safer than a segfault. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9563 --- src/lib/elementary/efl_ui_widget_factory.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index da83117007..371b81984e 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -189,7 +189,7 @@ _efl_ui_widget_factory_efl_part_part_get(const Eo *obj, part = efl_add(EFL_UI_PROPERTY_BIND_PART_CLASS, (Eo*) obj); if (!part) return NULL; - ppd = efl_data_scope_get(obj, EFL_UI_PROPERTY_BIND_PART_CLASS); + ppd = efl_data_scope_get(part, EFL_UI_PROPERTY_BIND_PART_CLASS); ppd->name = eina_stringshare_add(name); ppd->pd = pd; @@ -213,6 +213,12 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE Efl_Ui_Bind_Part_Data *bpd; Efl_Ui_Property_Bind_Data *bppd; + if (!pd->pd) + { + EINA_LOG_ERR("Trying to bind part property without specifying which part"); + return ENOENT; + } + if (!pd->pd->parts) pd->pd->parts = eina_hash_stringshared_new(NULL); @@ -228,13 +234,15 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE } bppd = calloc(1, sizeof (Efl_Ui_Property_Bind_Data)); - if (bppd) return ENOMEM; + if (!bppd) return ENOMEM; bppd->part_property = eina_stringshare_add(key); bppd->model_property = eina_stringshare_add(property); bpd->properties = eina_list_append(bpd->properties, bppd); + efl_event_callback_call(obj, EFL_UI_PROPERTY_BIND_EVENT_PROPERTY_BOUND, (void*) key); + return 0; } From 894c1b34b3c4f8cad370edca00cd57997add7436 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 15 Aug 2019 00:08:57 +0100 Subject: [PATCH 18/24] elm entry - respect plain text newlines on paste again... make this work like it used to... fixes T8135 --- src/lib/elementary/elm_entry.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 0de3937f7c..1fa1a9096a 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -730,6 +730,16 @@ _selection_data_cb(void *data EINA_UNUSED, } else { + if (!(sel_data->format & ELM_SEL_FORMAT_MARKUP)) + { + char *txt = _elm_util_text_to_mkup(buf); + if (txt) + { + _edje_entry_user_insert(obj, txt); + free(txt); + } + } + else _edje_entry_user_insert(obj, buf); } free(buf); From c3c903b9ccbaab4226da471add7add013f5c709d Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 15 Aug 2019 13:27:54 +0100 Subject: [PATCH 19/24] elm - dnd - fix drop target del to not nuke handler all the time this broke dnd if u have multiple drop targets in a window... keep the functions there if we still have drop targets... especially in x11. @fix --- src/lib/elementary/efl_ui_selection_manager.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c index 59b96858f8..49b3c5a3b1 100644 --- a/src/lib/elementary/efl_ui_selection_manager.c +++ b/src/lib/elementary/efl_ui_selection_manager.c @@ -4999,6 +4999,7 @@ _efl_ui_selection_manager_drop_target_del(Eo *obj EINA_UNUSED, Efl_Ui_Selection_ { Sel_Manager_Dropable *dropable = NULL; Sel_Manager_Seat_Selection *seat_sel; + Eina_Bool remove_handler = EINA_FALSE; dropable = efl_key_data_get(target_obj, "__elm_dropable"); if (dropable) @@ -5040,14 +5041,21 @@ _efl_ui_selection_manager_drop_target_del(Eo *obj EINA_UNUSED, Efl_Ui_Selection_ break; } } - if (!have_drop_list) ecore_x_dnd_aware_set(xwin, EINA_FALSE); + if (!have_drop_list) + { + ecore_x_dnd_aware_set(xwin, EINA_FALSE); + remove_handler = EINA_TRUE; + } } #endif - seat_sel = _sel_manager_seat_selection_init(pd, seat); - ELM_SAFE_FREE(seat_sel->pos_handler, ecore_event_handler_del); - ELM_SAFE_FREE(seat_sel->drop_handler, ecore_event_handler_del); - ELM_SAFE_FREE(seat_sel->enter_handler, ecore_event_handler_del); - ELM_SAFE_FREE(seat_sel->leave_handler, ecore_event_handler_del); + if (remove_handler) + { + seat_sel = _sel_manager_seat_selection_init(pd, seat); + ELM_SAFE_FREE(seat_sel->pos_handler, ecore_event_handler_del); + ELM_SAFE_FREE(seat_sel->drop_handler, ecore_event_handler_del); + ELM_SAFE_FREE(seat_sel->enter_handler, ecore_event_handler_del); + ELM_SAFE_FREE(seat_sel->leave_handler, ecore_event_handler_del); + } } EOLIAN static void From a84cfbae7209fd9743b5521d2635b1af72e498d9 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 15 Aug 2019 19:17:35 +0100 Subject: [PATCH 20/24] ethumb - fix short alloc on stack not including nul char space fix space for nul byte with alloca. --- src/lib/ethumb/ethumb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ethumb/ethumb.c b/src/lib/ethumb/ethumb.c index 00edfd5bed..38552bfad3 100644 --- a/src/lib/ethumb/ethumb.c +++ b/src/lib/ethumb/ethumb.c @@ -911,7 +911,7 @@ _ethumb_generate_hash(const char *file) { char *tmp; - tmp = alloca(length); + tmp = alloca(length + 1); length = getxattr(file, "user.e.md5", tmp, length); /* check if we have at least something that look like a md5 hash */ From 10c0e37a72e4e7ddfa17c476ae6fa6feb6bc00ea Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Thu, 15 Aug 2019 15:35:17 -0400 Subject: [PATCH 21/24] tests/ecore_wl2: Add ecore_wl2_surface tests to build order ref T8016 --- src/tests/ecore_wl2/ecore_wl2_suite.c | 1 + src/tests/ecore_wl2/ecore_wl2_suite.h | 1 + src/tests/ecore_wl2/meson.build | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tests/ecore_wl2/ecore_wl2_suite.c b/src/tests/ecore_wl2/ecore_wl2_suite.c index b6875c006d..623d601cd6 100644 --- a/src/tests/ecore_wl2/ecore_wl2_suite.c +++ b/src/tests/ecore_wl2/ecore_wl2_suite.c @@ -13,6 +13,7 @@ static const Efl_Test_Case etc[] = { "Display", ecore_wl2_test_display }, { "Window", ecore_wl2_test_window }, { "Input", ecore_wl2_test_input }, + { "Surface", ecore_wl2_test_surface }, #endif { NULL, NULL } }; diff --git a/src/tests/ecore_wl2/ecore_wl2_suite.h b/src/tests/ecore_wl2/ecore_wl2_suite.h index a8edf93074..ce0e1b482f 100644 --- a/src/tests/ecore_wl2/ecore_wl2_suite.h +++ b/src/tests/ecore_wl2/ecore_wl2_suite.h @@ -8,5 +8,6 @@ void ecore_wl2_test_init(TCase *tc); void ecore_wl2_test_display(TCase *tc); void ecore_wl2_test_window(TCase *tc); void ecore_wl2_test_input(TCase *tc); +void ecore_wl2_test_surface(TCase *tc); #endif diff --git a/src/tests/ecore_wl2/meson.build b/src/tests/ecore_wl2/meson.build index eb1a13db6a..c1d37cbbdd 100644 --- a/src/tests/ecore_wl2/meson.build +++ b/src/tests/ecore_wl2/meson.build @@ -5,7 +5,8 @@ ecore_wl2_suite_src = [ 'ecore_wl2_test_ecore_wl2.c', 'ecore_wl2_test_display.c', 'ecore_wl2_test_window.c', - 'ecore_wl2_test_input.c' + 'ecore_wl2_test_input.c', + 'ecore_wl2_test_surface.c' ] ecore_wl2_suite = executable('ecore_wl2_suite', From f5063b8733b0081e689894ba27a727549cb48321 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Thu, 15 Aug 2019 15:36:29 -0400 Subject: [PATCH 22/24] meson: add xkbcommon to the build deps Summary: fix T8064 Reviewers: cedric, zmike, devilhorns Reviewed By: devilhorns Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8064 Differential Revision: https://phab.enlightenment.org/D9573 --- src/modules/ecore_imf/wayland/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/ecore_imf/wayland/meson.build b/src/modules/ecore_imf/wayland/meson.build index f2c6e53dde..f49cc3f0fb 100644 --- a/src/modules/ecore_imf/wayland/meson.build +++ b/src/modules/ecore_imf/wayland/meson.build @@ -3,7 +3,10 @@ mod_src = files([ 'wayland_imcontext.c', 'wayland_imcontext.h' ]) -mod_deps = [ecore, ecore_imf, ecore_wl2, wayland_protocol, ecore_evas, ecore_input] + +libxkbcommon = dependency('xkbcommon', version : ['>=0.3.0']) + +mod_deps = [ecore, ecore_imf, ecore_wl2, wayland_protocol, ecore_evas, ecore_input, libxkbcommon] shared_module(mod_name, mod_src, From 289cd1f3d499f3f587bed2954dc5d878f75e0c68 Mon Sep 17 00:00:00 2001 From: Felipe Magno de Almeida Date: Thu, 15 Aug 2019 20:47:23 +0000 Subject: [PATCH 23/24] eolian-cxx: Fix use after free for base variable T8137 Differential Revision: https://phab.enlightenment.org/D9575 --- src/bin/eolian_cxx/eolian_cxx.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc index 1e0842873d..6f719f178f 100644 --- a/src/bin/eolian_cxx/eolian_cxx.cc +++ b/src/bin/eolian_cxx/eolian_cxx.cc @@ -287,10 +287,10 @@ run(options_type const& opts) { const Eolian_Class *klass = nullptr; char* dup = strdup(opts.in_files[0].c_str()); - char* base = basename(dup); + std::string base (basename(dup)); std::string cpp_types_header; opts.unit = (Eolian_Unit*)opts.state; - klass = ::eolian_state_class_by_file_get(opts.state, base); + klass = ::eolian_state_class_by_file_get(opts.state, base.c_str()); free(dup); if (klass) { @@ -346,8 +346,8 @@ run(options_type const& opts) opts.unit = unit; } char* dup = strdup(name.c_str()); - char* base = basename(dup); - Eolian_Class const* klass = ::eolian_state_class_by_file_get(opts.state, base); + std::string base(basename(dup)); + Eolian_Class const* klass = ::eolian_state_class_by_file_get(opts.state, base.c_str()); free(dup); if (klass) { From f5aa672853d4fe70a60508e9abc796b0246915ba Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Fri, 16 Aug 2019 16:54:50 +0900 Subject: [PATCH 24/24] evas: fix png regression issue Summary: The evas_image_load_file_data_png had called png_set_tRNS_to_alpha from following commit. 6988a38 evas: fix png loader to actually produce lower resolution content when asked. You could refer to following information regarding png_set_tRNS_to_alpha which is available on page http://www.libpng.org/pub/png/libpng-manual.txt The following code transforms grayscale images of less than 8 to 8 bits, changes paletted images to RGB, and adds a full alpha channel if there is transparency information in a tRNS chunk. This is most useful on grayscale images with bit depths of 2 or 4 or if there is a multiple-image viewing application that wishes to treat all images in the same way. if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr); if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr) Accidentally commit "382c580 evas: add support for .9.png file to PNG loader." adding a new feature with small code refactoring missed the line calling png_set_tRNS_to_alpha. So we got a rendering issue. It made around 75% size white rectangle using a grayscale and transparent image. I'd like to attach the image which has following type information for test purpose. $ identify -verbose ./grayscale_transparent.png | grep type -i Mime type: image/png Type: Bilevel png:IHDR.color-type-orig: 0 png:IHDR.color_type: 0 (Grayscale) Test Plan: This is the sample image file grayscale_transparent.png {F3748665} Reviewers: cedric, Hermet, jsuya Reviewed By: Hermet Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9580 --- src/modules/evas/image_loaders/png/evas_image_load_png.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/evas/image_loaders/png/evas_image_load_png.c b/src/modules/evas/image_loaders/png/evas_image_load_png.c index 7b440d5089..1eb8b12dc8 100644 --- a/src/modules/evas/image_loaders/png/evas_image_load_png.c +++ b/src/modules/evas/image_loaders/png/evas_image_load_png.c @@ -212,7 +212,14 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader, prop->info.w = (int) epi->w32; prop->info.h = (int) epi->h32; } - if (png_get_valid(epi->png_ptr, epi->info_ptr, PNG_INFO_tRNS)) epi->hasa = 1; + + if (png_get_valid(epi->png_ptr, epi->info_ptr, PNG_INFO_tRNS)) + { + /* expand transparency entry -> alpha channel if present */ + if (!close_file) png_set_tRNS_to_alpha(epi->png_ptr); + epi->hasa = 1; + } + switch (epi->color_type) { case PNG_COLOR_TYPE_RGB_ALPHA: