wibox.widget.textbox: return 0, 0 from fit() if either w or h is 0

A hack around abusing the fact that width of a textbox is 0 when its
empty, while it's height is still set according to the font.

Signed-off-by: Lukáš Hrázký <lukkash@email.cz>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Lukáš Hrázký 2013-01-20 15:00:29 +01:00 committed by Uli Schlachter
parent 1881ceb9d3
commit 470142acc3

View file

@ -45,6 +45,11 @@ end
function textbox:fit(width, height)
setup_layout(self, width, height)
local ink, logical = self._layout:get_pixel_extents()
if logical.width == 0 or logical.height == 0 then
return 0, 0
end
return logical.width, logical.height
end