From ebcda492a1e9e937e523bfb6346f82d3c389820b Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 6 Oct 2010 19:47:34 +0200 Subject: [PATCH] wibox.layout.fixed: Always draw "empty" widgets If a widget has a width/height of 0, we can safely draw it without running out of the available space. This code checks if we got enough space after we now how much space the next widget wants. This fixes the systray. It has to be drawn at least once so that the C core can set up stuff correctly. However, thanks to the systray having a width of 0, it wasn't drawn by the layout. Signed-off-by: Uli Schlachter --- lib/wibox/layout/fixed.lua.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/wibox/layout/fixed.lua.in b/lib/wibox/layout/fixed.lua.in index 3bd43a2a7..ba04b1709 100644 --- a/lib/wibox/layout/fixed.lua.in +++ b/lib/wibox/layout/fixed.lua.in @@ -25,6 +25,7 @@ function draw_fixed(dir, widgets, fill_space, wibox, cr, width, height) for k, v in pairs(widgets) do local x, y, w, h + local in_dir if dir == "y" then x, y = 0, pos w, h = width, height - pos @@ -32,6 +33,7 @@ function draw_fixed(dir, widgets, fill_space, wibox, cr, width, height) _, h = v:fit(w, h); end pos = pos + h + in_dir = h else x, y = pos, 0 w, h = width - pos, height @@ -39,13 +41,14 @@ function draw_fixed(dir, widgets, fill_space, wibox, cr, width, height) w, _ = v:fit(w, h); end pos = pos + w + in_dir = w end - base.draw_widget(wibox, cr, v, x, y, w, h) - if (dir == "y" and pos >= height) or - (dir ~= "y" and pos >= width) then + if (dir == "y" and pos > height) or + (dir ~= "y" and pos > width) then break end + base.draw_widget(wibox, cr, v, x, y, w, h) end end