From 107f1cf1dc86962b586c10ad07d050c9f381dc6f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 27 Aug 2009 14:21:41 +0200 Subject: [PATCH] widget.layout.horizontal: simplify .resize handling Signed-off-by: Julien Danjou --- lib/awful/widget/layout/horizontal.lua.in | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/awful/widget/layout/horizontal.lua.in b/lib/awful/widget/layout/horizontal.lua.in index 5f518fd9..2e7bf6d7 100644 --- a/lib/awful/widget/layout/horizontal.lua.in +++ b/lib/awful/widget/layout/horizontal.lua.in @@ -61,10 +61,13 @@ local function horizontal(direction, bounds, widgets, screen) height = 0, } end - g.ratio = 1 - if g.height > 0 then - g.ratio = g.width / g.height + + if v.resize and g.width > 0 and g.height > 0 then + local ratio = g.width / g.height + g.width = math.floor(bounds.height * ratio) + g.height = bounds.height end + if g.width > bounds.width then g.width = bounds.width end @@ -76,10 +79,6 @@ local function horizontal(direction, bounds, widgets, screen) g.y = 0 end - if v.resize and g.width > 0 then - g.width = math.floor(g.height * g.ratio) - end - if direction == "leftright" then if margins[v] then g.x = x + (margins[v].left or 0)