summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-08-09 15:13:09 -0400
committerCedric BAIL <cedric.bail@free.fr>2019-08-14 12:08:09 -0700
commitc375bbcfa7f224e2be540cf122488b477032c9c1 (patch)
tree313a69228e86700b79b04b62308ea43b91588ace
parent144d086fd700a7993fe3b7167599bcd3a9d6969b (diff)
efl/hint: add doc note about max size hint
ref T8122 Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D9551
-rw-r--r--src/lib/efl/interfaces/efl_gfx_hint.eo8
-rw-r--r--src/lib/evas/canvas/evas_object_main.c21
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
65 Note: Smart objects (such as elementary) can have their own 65 Note: Smart objects (such as elementary) can have their own
66 hint policy. So calling this API may or may not affect 66 hint policy. So calling this API may or may not affect
67 the size of smart objects. 67 the size of smart objects.
68
69 Note: It is an error for the @.hint_size_max to be smaller in either axis
70 than @.hint_size_min. In this scenario, the max size hint will be
71 prioritized over the user min size hint.
68 ]] 72 ]]
69 values { 73 values {
70 sz: Eina.Size2D; [[Maximum size (hint) in pixels, (-1, -1) by 74 sz: Eina.Size2D; [[Maximum size (hint) in pixels, (-1, -1) by
@@ -85,6 +89,10 @@ interface Efl.Gfx.Hint
85 Note: This property is meant to be set by applications and not by 89 Note: This property is meant to be set by applications and not by
86 EFL itself. Use this to request a specific size (treated as minimum 90 EFL itself. Use this to request a specific size (treated as minimum
87 size). 91 size).
92
93 Note: It is an error for the @.hint_size_max to be smaller in either axis
94 than @.hint_size_min. In this scenario, the max size hint will be
95 prioritized over the user min size hint.
88 ]] 96 ]]
89 values { 97 values {
90 sz: Eina.Size2D; [[Minimum size (hint) in pixels.]] 98 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
1479 if ((!obj->size_hints) || obj->delete_me) 1479 if ((!obj->size_hints) || obj->delete_me)
1480 return sz; 1480 return sz;
1481 1481
1482 sz.w = MAX(obj->size_hints->min.w, obj->size_hints->user_min.w); 1482 sz.w = obj->size_hints->user_min.w;
1483 sz.h = MAX(obj->size_hints->min.h, obj->size_hints->user_min.h); 1483 if (obj->size_hints->max.w != -1)
1484 sz.w = obj->size_hints->max.w;
1485 sz.h = obj->size_hints->user_min.h;
1486 if (obj->size_hints->max.h != -1)
1487 sz.h = obj->size_hints->max.h;
1488
1489 /* clamp user min to user max here */
1490 sz.w = MAX(obj->size_hints->min.w, MIN(sz.w, obj->size_hints->user_min.w));
1491 sz.h = MAX(obj->size_hints->min.h, MIN(sz.h, obj->size_hints->user_min.h));
1484 return sz; 1492 return sz;
1485} 1493}
1486 1494
@@ -1509,6 +1517,10 @@ _efl_canvas_object_efl_gfx_hint_hint_size_max_set(Eo *eo_obj, Evas_Object_Protec
1509 if ((obj->size_hints->max.w == sz.w) && (obj->size_hints->max.h == sz.h)) return; 1517 if ((obj->size_hints->max.w == sz.w) && (obj->size_hints->max.h == sz.h)) return;
1510 obj->size_hints->max.w = sz.w; 1518 obj->size_hints->max.w = sz.w;
1511 obj->size_hints->max.h = sz.h; 1519 obj->size_hints->max.h = sz.h;
1520 if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w))
1521 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);
1522 if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h))
1523 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);
1512 1524
1513 evas_object_inform_call_changed_size_hints(eo_obj, obj); 1525 evas_object_inform_call_changed_size_hints(eo_obj, obj);
1514} 1526}
@@ -1572,7 +1584,10 @@ _efl_canvas_object_efl_gfx_hint_hint_size_min_set(Eo *eo_obj, Evas_Object_Protec
1572 } 1584 }
1573 if ((obj->size_hints->user_min.w == sz.w) && (obj->size_hints->user_min.h == sz.h)) return; 1585 if ((obj->size_hints->user_min.w == sz.w) && (obj->size_hints->user_min.h == sz.h)) return;
1574 obj->size_hints->user_min = sz; 1586 obj->size_hints->user_min = sz;
1575 1587 if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w))
1588 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);
1589 if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h))
1590 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);
1576 evas_object_inform_call_changed_size_hints(eo_obj, obj); 1591 evas_object_inform_call_changed_size_hints(eo_obj, obj);
1577} 1592}
1578 1593