wibox.container.margin: Do not produce negative sizes
With draw_empty=false, :fit() can return 0,0. Then, when :layout() is called, it will compute negative widths and heights. This can then cause lots of problems later on. Avoid this by having :layout() return nothing instead of producing negative sizes. Fixes: https://github.com/awesomeWM/awesome/issues/2799 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
99e81c097a
commit
f025409cd3
|
@ -44,7 +44,12 @@ function margin:layout(_, width, height)
|
|||
local w = self._private.right
|
||||
local h = self._private.bottom
|
||||
|
||||
return { base.place_widget_at(self._private.widget, x, y, width - x - w, height - y - h) }
|
||||
local resulting_width = width - x - w
|
||||
local resulting_height = height - y - h
|
||||
|
||||
if resulting_width > 0 and resulting_height > 0 then
|
||||
return { base.place_widget_at(self._private.widget, x, y, resulting_width, resulting_height) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue