Page MenuHomePhabricator

elm box size hints can desync
Closed, InvalidPublic

Description

if someone calls size_hint_min_set(box, -1, -1) to force a recalc on a box, the box will fail to re-set its size hints on the elm widget object if the inner box's size hints have not changed.

example:
elm_box 10x10 [ evas_box 10x10 ]
size_hint_min_set(elm_box, -1, -1)
recalc
elm_box -1x-1 [ evas_box 10x10 ]

the elm_box _sizing_eval() function can only be called if the size hints of the inner evas box have changed

zmike created this task.Oct 19 2016, 8:27 AM
raster added a subscriber: raster.Oct 25 2016, 12:57 AM

i dont quite get your example. the first line specifically. if some code OTHEr than elm_box messes with min (or max) size hints then that other piece of code is messing with a property that does not belong to it. it should not touch it at all. a calc should not force a reset of it. elm box is free to shadow and figure this out and NOT reset it if it thinks it has not changed because it can assume that no one other than elm box itself will mess with min size. this applies to every widget in elm etc. (except those that dont have min sizing like elm_grid for example)

zmike added a comment.Oct 25 2016, 7:30 AM

The issue with this response is that there's (currently) only one method to set a min size for an object, and this is used by both the widgets internally and the user; if the widget sets a size hint and the user wants to set a different size hint, conflict occurs.

Saying to the user "you can't set a min size, but only on some objects" is unintuitive, and it's even more so when there's no documentation to support it.

Lastly, some properties (e.g., box align) require the user to set min size hints in order for the property to work. An elm box will size to its smallest possible size, so getting the contents to scroll based on the align requires the user to set an even smaller size on the box in order to force viewporting and trigger the align codepath.

yes. there is only one method... and it should never be used by the user... on any object that controls its own minsize. which is almost every elm widget. this is nothing new. expecting this to work is just going to lead to bugs. it can and never will work. there is a min size property. it is not possible to control which piece of code is allowed to call such a function at all. it's a rule you follow. if 2 different pieces of code want to control the same property all you end up with is a fight and the results of that fight will change over time.

and in fact there is documentation to support this.

https://www.enlightenment.org/samples/elm_min_size_control

even if there is not. LOGICALLY if a widget sets its min size, you can't go setting it too however you please. if an app saves its config files you cannot expect to go write/modify those config files at the same time and expect everything to work out fine. if you have a data structure in memory and one thread is writing to its content then another thread wishes to do the same... you can't expect this to work well without a clearly defined set of controls to determine who does and does not win. so the general solution is "single controller" for such things. and that's what applies here.

and box align does not require setting a min size. box align is for aligning content when box is expanded bigger than the max size of all its content - do you center the content when the max width of all children is 100 and box width is actually 200? align to left? right? how. it also works in reverse if box size is smaller than content. it also defines align. you do not have to set max size at all... but you DO need to resize the box. and no an elm box will not size to its smallest size. it will expect the parent controller to do that based on min size hints. there was a bug were elm box did do this resize and should not have. i fixed it. maybe 6 months ago. all widgets just set min size hint and expect whoever is listening on that to make a decision how to size. if parent wants box to expand and fill an area based on weight and align properties, then it does that. the only widget that actually should and needs to size is the window because... it has no parent. :)

zmike closed this task as Invalid.Nov 7 2016, 7:36 AM
jpeg added a comment.Nov 20 2016, 5:48 PM

With EO APIs you can set the min size and EFL can set a min size independently. The combined min size will be used for actual calc. There are 3 properties:

  • efl_gfx_size_hint_min_set -> user min size, never set by EFL
  • efl_gfx_size_hint_restricted_min_set -> internal min size, protected, set by the widget itself, shouldn't be messed with by users
  • efl_gfx_size_hint_combined_min_get -> read-only MAX of above two sizes