Fix wibox.layout.flex:fit() (FS#1126)

The flex:fit() function was calling the fit() function of the widgets it
contained with too large values, trying to hand out more space than it had
available. This resulted in more space being requested than was available and
some weird layout issues resulted.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2013-03-24 22:32:53 +01:00
parent e7912fc2a8
commit 8af54130d6
1 changed files with 5 additions and 1 deletions

View File

@ -85,8 +85,12 @@ function flex:fit(orig_width, orig_height)
#self.widgets * self._max_widget_size)
end
-- Figure out the maximum size we can give out to sub-widgets
local sub_height = self.dir == "x" and orig_height or floor(used_in_dir / #self.widgets)
local sub_width = self.dir == "y" and orig_width or floor(used_in_dir / #self.widgets)
for k, v in pairs(self.widgets) do
local w, h = v:fit(orig_width, orig_height)
local w, h = v:fit(sub_width, sub_height)
local max
if self.dir == "y" then
max = w