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 <psychon@znc.in>
This commit is contained in:
parent
1fab3aa745
commit
ebcda492a1
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue