awesome/lib/wibox/widget
Uli Schlachter 0ac80ddf30 imagebox: Avoid division by zero
Given an imagebox i with i.resize_forbidden = false and a valid image set, the
call t:fit(0, 0) would return two times "not a number".

This is because the code first does some calculations to get the input image
into the available space and then tried to do some calculations needed for
scaling images up.

The first calculation already gave us h == 0 == w, the second calculation would
then calculate 0/0. This results in NaNs.

This was only noticed because NaN is not a valid table index in lua.

Fix this by returning 0,0 if we have an image of width or height 0 after the
first calculation. Since 0x0 images are valid in cairo, this also fixes the same
bug with such images.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 17:39:42 +01:00
..
background.lua.in wibox: Improve constructor functions for some layouts 2013-03-10 13:46:28 +01:00
base.lua.in wibox: Add widget geometry cache 2013-08-21 12:26:47 +02:00
imagebox.lua.in imagebox: Avoid division by zero 2014-03-23 17:39:42 +01:00
init.lua.in Fix warnings from LDoc 2012-11-19 15:35:32 +01:00
systray.lua.in wibox.wibox.systray: Allow multiple systrays 2013-03-10 11:11:43 +01:00
textbox.lua.in wibox.widget.textbox: return 0, 0 from fit() if either w or h is 0 2013-02-20 13:08:27 +01:00