awesome/lib/wibox/layout
Shay Agroskin a18e3508f6 layout/fixed: Fix wrong space calculation in fit
The fit function is called twice in row.

- The first time it gets the maximum available width, and returns how
  much of it it needs (with 0 spacing it would be 477)

- The second time the available width it gets is the same as it returned
  last phase (and probably is expected to return the same result again)

The width fit requests is the total width of all widgets together + the
spacing (e.g. if each tag widget is 53 px and spacing is -10 then the
requested width 53 * 9 - 80).

The function tries to first fit all its widgets (the tag numbers) in the
amount of width it received, and only then adds the spacing to it. This
is problematic because in the second phase the widgets need to fit
themselves in the same width they requested earlier minus the spacing
(in case of negative spacing). This is of course impossible and so some
widgets are just not being drawn correctly.

This patch makes fit function take into account the spacing while
placing the widgets and not afterwards.

Also add unit-testing that test the bug described.

Signed-off-by: Shay Agroskin <agrosshay@gmail.com>
2021-03-26 16:11:01 +03:00
..
align.lua doc: Upgrade the widget layout documentation. 2019-11-30 01:26:06 -05:00
constraint.lua Move awful.util.deprecate and awful.util.deprecate_class to gears.debug 2017-03-15 20:08:22 -05:00
fixed.lua layout/fixed: Fix wrong space calculation in fit 2021-03-26 16:11:01 +03:00
flex.lua doc: Upgrade the widget layout documentation. 2019-11-30 01:26:06 -05:00
grid.lua Fix setters/getters for grid layout direction properties 2020-10-10 17:32:04 +02:00
init.lua Fix ldoc modules summaries missing the final `.`. 2019-11-28 13:53:59 +01:00
manual.lua doc: Upgrade the widget layout documentation. 2019-11-30 01:26:06 -05:00
margin.lua Move awful.util.deprecate and awful.util.deprecate_class to gears.debug 2017-03-15 20:08:22 -05:00
mirror.lua Move awful.util.deprecate and awful.util.deprecate_class to gears.debug 2017-03-15 20:08:22 -05:00
ratio.lua Fix adjust misspelling 2020-07-31 17:33:12 -06:00
rotate.lua Move awful.util.deprecate and awful.util.deprecate_class to gears.debug 2017-03-15 20:08:22 -05:00
scroll.lua Move awful.util.deprecate and awful.util.deprecate_class to gears.debug 2017-03-15 20:08:22 -05:00
stack.lua Remove unused first parameter in some constructors 2021-03-08 20:09:41 +01:00