From 470142acc34c5ec0f1e0a52fa6502b29d05ce024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= Date: Sun, 20 Jan 2013 15:00:29 +0100 Subject: [PATCH] wibox.widget.textbox: return 0, 0 from fit() if either w or h is 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ý Signed-off-by: Uli Schlachter --- lib/wibox/widget/textbox.lua.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/wibox/widget/textbox.lua.in b/lib/wibox/widget/textbox.lua.in index 7578f3e0..4ebd31ad 100644 --- a/lib/wibox/widget/textbox.lua.in +++ b/lib/wibox/widget/textbox.lua.in @@ -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