summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-08-09 12:04:43 -0400
committerCedric BAIL <cedric.bail@free.fr>2019-08-09 10:25:26 -0700
commit3aee9a96c03a018d9d509c244068e58a19ee8def (patch)
treed7c97a822db7fa6a0301d1eb5fd28c0857a82ed9 /src/lib
parent219cb6fe9e060350e393c0a332942dc20733d949 (diff)
efl_ui/popup: optimize popup sizing calcs slightly
ensure that scroll-based popups don't accidentally trigger a full recalc and (wrong) size change during group_calc by hitting the base popup size_set() implementation and setting the needs_calc flag or by using the base popup calc code when it should not be used this resolves a corner case sizing issue in the text_alert 2 popup case in elm_test which seems to have been present for a long time Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9538
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_popup.c13
-rw-r--r--src/lib/elementary/efl_ui_popup_private.h1
-rw-r--r--src/lib/elementary/efl_ui_scroll_alert_popup.c3
-rw-r--r--src/lib/elementary/efl_ui_text_alert_popup.c3
4 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index eea29e7bdc..f38e27cb74 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -75,11 +75,12 @@ _calc_align(Eo *obj)
75} 75}
76 76
77EOLIAN static void 77EOLIAN static void
78_efl_ui_popup_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eina_Size2D size) 78_efl_ui_popup_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Popup_Data *pd, Eina_Size2D size)
79{ 79{
80 efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size); 80 efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size);
81 81
82 efl_canvas_group_change(obj); 82 if (!pd->in_calc)
83 efl_canvas_group_change(obj);
83} 84}
84 85
85static void 86static void
@@ -269,7 +270,6 @@ _sizing_eval(Eo *obj)
269 new_size.w = (min.w > size.w ? min.w : size.w); 270 new_size.w = (min.w > size.w ? min.w : size.w);
270 new_size.h = (min.h > size.h ? min.h : size.h); 271 new_size.h = (min.h > size.h ? min.h : size.h);
271 efl_gfx_entity_size_set(obj, new_size); 272 efl_gfx_entity_size_set(obj, new_size);
272 efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
273} 273}
274 274
275EOLIAN static void 275EOLIAN static void
@@ -280,7 +280,12 @@ _efl_ui_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Data *pd)
280 * The actual size calculation is done here when the object is rendered to 280 * The actual size calculation is done here when the object is rendered to
281 * avoid duplicate size calculations. */ 281 * avoid duplicate size calculations. */
282 efl_canvas_group_need_recalculate_set(obj, EINA_FALSE); 282 efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
283 _sizing_eval(obj); 283 if (!pd->in_calc)
284 {
285 pd->in_calc = EINA_TRUE;
286 _sizing_eval(obj);
287 pd->in_calc = EINA_FALSE;
288 }
284 _calc_align(obj); 289 _calc_align(obj);
285 290
286 Eina_Rect p_geom = efl_gfx_entity_geometry_get(pd->win_parent); 291 Eina_Rect p_geom = efl_gfx_entity_geometry_get(pd->win_parent);
diff --git a/src/lib/elementary/efl_ui_popup_private.h b/src/lib/elementary/efl_ui_popup_private.h
index 77b989af75..9472d63b87 100644
--- a/src/lib/elementary/efl_ui_popup_private.h
+++ b/src/lib/elementary/efl_ui_popup_private.h
@@ -9,6 +9,7 @@ struct _Efl_Ui_Popup_Data
9 Efl_Ui_Popup_Align align; 9 Efl_Ui_Popup_Align align;
10 Ecore_Timer *timer; 10 Ecore_Timer *timer;
11 double timeout; 11 double timeout;
12 Eina_Bool in_calc : 1;
12}; 13};
13 14
14#define EFL_UI_POPUP_DATA_GET_OR_RETURN(o, ptr, ...) \ 15#define EFL_UI_POPUP_DATA_GET_OR_RETURN(o, ptr, ...) \
diff --git a/src/lib/elementary/efl_ui_scroll_alert_popup.c b/src/lib/elementary/efl_ui_scroll_alert_popup.c
index e8d50115f9..1bc757422a 100644
--- a/src/lib/elementary/efl_ui_scroll_alert_popup.c
+++ b/src/lib/elementary/efl_ui_scroll_alert_popup.c
@@ -136,6 +136,8 @@ _sizing_eval(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd)
136EOLIAN static void 136EOLIAN static void
137_efl_ui_scroll_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd) 137_efl_ui_scroll_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd)
138{ 138{
139 EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
140 ppd->in_calc = EINA_TRUE;
139 /* When efl_canvas_group_change() is called, just flag is set instead of size 141 /* When efl_canvas_group_change() is called, just flag is set instead of size
140 * calculation. 142 * calculation.
141 * The actual size calculation is done here when the object is rendered to 143 * The actual size calculation is done here when the object is rendered to
@@ -146,6 +148,7 @@ _efl_ui_scroll_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Scro
146 148
147 //Not to calculate size by super class 149 //Not to calculate size by super class
148 efl_canvas_group_calculate(efl_super(obj, MY_CLASS)); 150 efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
151 ppd->in_calc = EINA_FALSE;
149} 152}
150 153
151static Eina_Bool 154static Eina_Bool
diff --git a/src/lib/elementary/efl_ui_text_alert_popup.c b/src/lib/elementary/efl_ui_text_alert_popup.c
index abb9a0338b..ad0c222d5f 100644
--- a/src/lib/elementary/efl_ui_text_alert_popup.c
+++ b/src/lib/elementary/efl_ui_text_alert_popup.c
@@ -158,6 +158,8 @@ _sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd)
158EOLIAN static void 158EOLIAN static void
159_efl_ui_text_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd) 159_efl_ui_text_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd)
160{ 160{
161 EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
162 ppd->in_calc = EINA_TRUE;
161 /* When efl_canvas_group_change() is called, just flag is set instead of size 163 /* When efl_canvas_group_change() is called, just flag is set instead of size
162 * calculation. 164 * calculation.
163 * The actual size calculation is done here when the object is rendered to 165 * The actual size calculation is done here when the object is rendered to
@@ -167,6 +169,7 @@ _efl_ui_text_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_A
167 _sizing_eval(obj, pd); 169 _sizing_eval(obj, pd);
168 170
169 efl_canvas_group_calculate(efl_super(obj, MY_CLASS)); 171 efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
172 ppd->in_calc = EINA_FALSE;
170} 173}
171 174
172static Eina_Bool 175static Eina_Bool