Overlay/x11-wm/awesome/files/awesome-3.5.4-imagebox.patch

29 lines
1.1 KiB
Diff

From: Uli Schlachter <psychon@znc.in>
Date: Wed, 2 Apr 2014 20:48:06 +0000 (+0200)
Subject: imagebox: Don't try to scale by infinite (FS#1248)
X-Git-Url: http://git.naquadah.org/?p=awesome.git;a=commitdiff_plain;h=7967d05915c95c8eba7709a46093cc1b6de55572;hp=afa50904fb1c79a24ddda8fb242afe2dcc1de841
imagebox: Don't try to scale by infinite (FS#1248)
When an imagebox was drawn with width or height zero, it tried to calculate the
needed scale factor for making the image fit. Sadly, this would be a division by
zero aka infinite in this case.
Fix this by just not drawing anything if there is no space available.
Signed-off-by: Uli Schlachter <psychon@znc.in>
---
diff --git a/lib/wibox/widget/imagebox.lua.in b/lib/wibox/widget/imagebox.lua.in
index da51634..5963d0e 100644
--- a/lib/wibox/widget/imagebox.lua.in
+++ b/lib/wibox/widget/imagebox.lua.in
@@ -18,6 +18,7 @@ local imagebox = { mt = {} }
--- Draw an imagebox with the given cairo context in the given geometry.
function imagebox:draw(wibox, cr, width, height)
if not self._image then return end
+ if width == 0 or height == 0 then return end
cr:save()