From 8af54130d6f5b025999b5c209e96c2e8472270cf Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 24 Mar 2013 22:32:53 +0100 Subject: [PATCH] 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 --- lib/wibox/layout/flex.lua.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/wibox/layout/flex.lua.in b/lib/wibox/layout/flex.lua.in index 9fe2a4571..0b2b5a847 100644 --- a/lib/wibox/layout/flex.lua.in +++ b/lib/wibox/layout/flex.lua.in @@ -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